- bool:
yes = True, no = False
- int:
year = 2001
- float:
g = 9.81, G = 6.67e-11
- str:
name = "Welcome to 'P53'"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
conda create -n ML python=3.12 pip ipython jupyter jupyterlab ipykernel numpy wheel scipy pandas matplotlib | |
conda activate ML | |
# https://developer.apple.com/metal/pytorch/ | |
pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def plt_to_numpy_demo(width=15, height=11, dpi=32, offscreen=True): | |
if offscreen: | |
# Switch to Agg backend to prevent display | |
backend = matplotlib.get_backend() | |
plt.close('all') | |
plt.switch_backend('agg') | |
# Create figure with exactly width x height pixels | |
fig = plt.figure(figsize=(width/dpi, height/dpi), dpi=dpi, frameon=False) | |
ax = fig.add_subplot() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fpoffline.db | |
DB = fpoffline.db.DB() | |
dbname = 'telemetry' | |
schema = DB.query(f"SELECT table_name, column_name FROM information_schema.columns WHERE table_schema = '{dbname}' order by table_name asc", maxrows=5000) | |
schema.to_csv(f'{dbname}-schema.csv', index=None) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_contour_levels(data, nsigmas=(2,1)): | |
assert data.ndim == 2 | |
assert np.all(data >= 0) | |
assert np.sum(data) <= 1 + 1e-6 | |
assert np.all(np.asarray(nsigmas) > 0) | |
assert np.all(np.diff(nsigmas) < 0) | |
# Convert sigmas to confidence levels | |
CL = scipy.stats.chi2.cdf(x=np.asarray(nsigmas) ** 2, df=1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -name "*.ipynb" -not -path "*checkpoint*" -print0 | xargs -0 fgrep -l coordinates |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://developer.apple.com/metal/jax/ | |
conda create -n apple-ml python=3.10 pip ipython jupyter jupyterlab ipykernel numpy wheel scipy pandas matplotlib | |
conda activate apple-ml | |
python -m pip install ml-dtypes==0.2.0 jax-metal | |
# Successfully installed jax-0.4.11 jax-metal-0.0.4 jaxlib-0.4.11 ml-dtypes-0.2.0 opt-einsum-3.3.0 | |
## This installs a newer version of jaxlib that is incompatible with jax-metal ?? | |
##python -m pip install -q -U flax |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# exclude directories with specific names | |
find . -type d \( -name 'code' -o -name '.ipynb_checkpoints' \) -prune -o -name '*.ipynb' -type f -exec fgrep 'desietc' {} + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Need to convert from big-endian to little-endian to avoid this error: | |
# ValueError: Big-endian buffer not supported on little-endian compiler | |
data = fitsio.read(path).byteswap().newbyteorder() | |
df = pd.DataFrame(data) |
- Update version in
setup.cfg
, usually by remove.dev
- Check that CHANGES.rst describes all changes since the last version
- Replace
unreleased
with today'sYYYY-MM-DD
in CHANGES.rst - Commit and tag
git add .
git commit -m 'prepare for release'
git tag v0.15
- Bump version in
setup.cfg
and append.dev
NewerOlder