-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Experiment 4.0 realistic noise gaussian galaxies (#81)
* script to submit batch jobs (temporary) * rename * what distribution off luxes to use for tests? * nothing * setup experiment 40 * forgot true flux might be useful * simple script to collate samples from individual files into one * ordering * simplify script * figures with higher noise * higher jackknife default and more explicit variables * changes to ensure correct ordering * run in two modes * get jackknife estimate of mean shear posterior and reduce error * draft figure file * slurm file update to run in two modes * useful for mode * update import * preliminary figures look great * check * modes * update shell script * update with flags * vmap version of jackknife * more plots * all figures in this experiment * draft make file for exp40 * add multiplicative bias contours * no jack * trying to understand * simplify makefile works really well * slight improvements * redo figures * move figures around * add tag for generality * script to make figures for exp 40 * make file absorbts this * instructions for make files * tag option * fix makefile * example plots for another experiment * return both samples to be summarized later * use new vectorized version of JK * consistent tag * add tag to figures * add jackknife as an option * more options to propagate for more general usage * add summary of bias results * make file for low noise experimen * readme * bug in jackknife * looks nicer * more samples just in case * fix makefile * no updates * fix quote * doesn't matter * more careful so it run sfaster * less samples is probably OK * debug * all new results * don't need as many resources * a little more * another seed * seed
- Loading branch information
1 parent
3d48d44
commit 50bbbf3
Showing
53 changed files
with
1,919 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
SHELL=/bin/bash | ||
SEED := 42 | ||
DIR := /pscratch/sd/i/imendoza/data/cache_chains/exp40_${SEED} | ||
TAG := exp40_${SEED} | ||
export JAX_ENABLE_X64=True | ||
|
||
figures: | ||
./get_figures.py ${SEED} --tag ${TAG} | ||
|
||
jackknife: | ||
export CUDA_VISIBLE_DEVICES=0 | ||
./get_shear_jackknife.py ${SEED} --old-seed ${SEED} \ | ||
--samples-plus-fname interim_samples_${SEED}_plus.npz \ | ||
--samples-minus-fname interim_samples_${SEED}_minus.npz \ | ||
--tag ${TAG} --overwrite | ||
|
||
shear: | ||
export CUDA_VISIBLE_DEVICES=0 | ||
../../scripts/get_shear_from_shapes.py ${SEED} --old-seed ${SEED} --interim-samples-fname "interim_samples_${SEED}_plus.npz" --tag ${TAG} --overwrite --extra-tag "plus" | ||
../../scripts/get_shear_from_shapes.py ${SEED} --old-seed ${SEED} --interim-samples-fname "interim_samples_${SEED}_minus.npz" --tag ${TAG} --overwrite --extra-tag "minus" | ||
|
||
collate: | ||
./collate_samples.py ${SEED} --tag ${TAG} --mode "plus" --n-files 4 | ||
./collate_samples.py ${SEED} --tag ${TAG} --mode "minus" --n-files 4 | ||
|
||
samples: | ||
./slurm_get_interim_samples.py ${SEED} --tag ${TAG} --g1 0.02 --g2 0.0 --mode "plus" | ||
./slurm_get_interim_samples.py ${SEED} --tag ${TAG} --g1 -0.02 --g2 0.0 --mode "minus" | ||
|
||
clean: | ||
rm -f ${DIR}/g_samples_*.npy ${DIR}/interim_samples_*.npz |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Experiment 4.0 | ||
|
||
Shear inference on images with more or less realistic noise conditions, only ellipticities are free. | ||
|
||
- SNR is centered around ~15 | ||
- 10^4 galaxies | ||
- Use jackknife + shape noise cancellation to estimate mean and error on mean shear. | ||
- HLR is fixed to `0.8` where images of size `63` are sufficient. | ||
|
||
## Reproducing results | ||
|
||
```bash | ||
make samples # wait for slurm job to finish | ||
make collate | ||
make shear | ||
make figures | ||
``` |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env python3 | ||
import os | ||
|
||
import jax.numpy as jnp | ||
import typer | ||
|
||
from bpd import DATA_DIR | ||
from bpd.io import load_dataset, save_dataset | ||
|
||
|
||
def main( | ||
seed: int, tag: str = typer.Option(), mode: str = typer.Option(), n_files: int = 4 | ||
): | ||
assert mode in ("plus", "minus", "") | ||
mode_txt = f"_{mode}" if mode else "" | ||
dirpath = DATA_DIR / "cache_chains" / tag | ||
newpath = dirpath / f"interim_samples_{seed}{mode_txt}.npz" | ||
|
||
if newpath.exists(): | ||
os.remove(newpath) | ||
|
||
full_ds = {} | ||
|
||
for ii in range(n_files): | ||
fp = dirpath / f"interim_samples_{seed}{ii}{mode_txt}.npz" | ||
ds = load_dataset(fp) | ||
|
||
for k, v in ds.items(): | ||
if k in ("e_post", "e1_true", "e2_true", "f"): | ||
if k in full_ds: | ||
full_ds[k] = jnp.concatenate([full_ds[k], v]) | ||
else: | ||
full_ds[k] = ds[k] | ||
else: | ||
full_ds[k] = ds[k] | ||
|
||
save_dataset(full_ds, newpath, overwrite=True) | ||
|
||
|
||
if __name__ == "__main__": | ||
typer.run(main) |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#### Full results #### | ||
Units: 1e-3 | ||
|
||
m_mean: -10.47 | ||
m_std: 29.65 | ||
|
||
c_mean: -0.03942 | ||
c_std: 1.104 | ||
|
||
#### Jackknife results #### | ||
Units: 1e-3 | ||
|
||
m_mean: -10.77 | ||
m_std: 4.564 | ||
|
||
c_mean: -0.05475 | ||
c_std: 1.003 | ||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#### Full results #### | ||
Units: 1e-3 | ||
|
||
m_mean: -18.61 | ||
m_std: 3.958 | ||
|
||
c_mean: -1.391 | ||
c_std: 1.225 | ||
|
||
#### Jackknife results #### | ||
Units: 1e-3 | ||
|
||
m_mean: -18.92 | ||
m_std: 3.841 | ||
|
||
c_mean: -1.399 | ||
c_std: 1.298 | ||
|
Binary file not shown.
Binary file not shown.
Oops, something went wrong.