lephare-photoz / lephare

LePHARE is a code for calculating photometric redshifts.
MIT License
5 stars 1 forks source link

Port over test_suite.sh to the new repository #115

Closed drewoldag closed 4 months ago

drewoldag commented 5 months ago

Now that we have python executables, we would like to include a version of the original test_suite.sh script to show how to use this.

The original test_suite is here: https://gitlab.lam.fr/Galaxies/LEPHARE/-/blob/master/tests/test_suite.sh?ref_type=heads

We would want to avoid including COSMOS.in as a file in the examples directory, so we should add a line like: curl -O https://raw.githubusercontent.com/lephare-photoz/lephare-data/main/examples/COSMOS.in.

We would also want to avoid using env vars as much as possible. But, to use the command line, we probably need to use at least $LEPHAREWORK. To support this, we would probably need to output the LEPHAREWORK and LEPHAREDIR variables, perhaps with something like this:

export LEPHAREDIR=$(python -c "import lephare as lp; print(f'{lp.LEPHAREDIR}')")
export LEPHAREWORK=$(python -c "import lephare as lp; print(f'{lp.dm.LEPHAREWORK}')")
drewoldag commented 5 months ago

This could be turned into rail_lephare_command_line_demo and could be included in rail_hub/examples. On RTD there will be links to all the demo notebooks.

We should probably include a placeholder notebook that just provides a link to the .sh file.

drewoldag commented 5 months ago

A rough starting point.

#!/usr/bin/env bash

export OMP_NUM_THREADS='30'
tmpdir=$(python -c "import lephare as lp; print(f'{lp.LEPHAREDIR}')")
tmpwork=$(python -c "import lephare as lp; print(f'{lp.dm.LEPHAREWORK}')")
echo $tmpdir
echo $tmpwork
export LEPHAREDIR=$tmpdir
export LEPHAREWORK=$tmpwork
echo $LEPHAREDIR
echo $LEPHAREWORK

# filter -c ./COSMOS.para

# sedtolib -c ./COSMOS.para -t S --STAR_SED $LEPHAREDIR/examples/STAR_MOD_ALL.list --LIB_ASCII YES
# mag_gal -c ./COSMOS.para -t S --LIB_ASCII YES --STAR_LIB_OUT ALLSTAR_COSMOS

# sedtolib -c $LEPHAREDIR/examples/COSMOS.para -t Q --QSO_SED  $LEPHAREDIR/sed/QSO/SALVATO09/AGN_MOD.list
# mag_gal -c $LEPHAREDIR/examples/COSMOS.para -t Q --MOD_EXTINC 0,1000  --EB_V 0.,0.1,0.2,0.3 --EXTINC_LAW SB_calzetti.dat --LIB_ASCII NO  --Z_STEP 0.04,0,6 --LIB_ASCII YES

# sedtolib -c $LEPHAREDIR/examples/COSMOS.para -t G --GAL_SED $LEPHAREDIR/examples/COSMOS_MOD.list  --GAL_LIB LIB_VISTA
# mag_gal  -c $LEPHAREDIR/examples/COSMOS.para -t G --GAL_LIB_IN LIB_VISTA --GAL_LIB_OUT VISTA_COSMOS_FREE --MOD_EXTINC 18,26,26,33,26,33,26,33  --EXTINC_LAW SMC_prevot.dat,SB_calzetti.dat,SB_calzetti_bump1.dat,SB_calzetti_bump2.dat  --EM_LINES EMP_UV  --EM_DISPERSION 0.5,0.75,1.,1.5,2. --Z_STEP 0.04,0,6 --LIB_ASCII YES

# cat_out=zphot_short.out

# zphota -c $LEPHAREDIR/examples/COSMOS.para --CAT_IN $LEPHAREDIR/examples/COSMOS.in --CAT_OUT $cat_out --ZPHOTLIB VISTA_COSMOS_FREE,ALLSTAR_COSMOS,QSO_COSMOS  --ADD_EMLINES 0,100 --AUTO_ADAPT YES   --Z_STEP 0.04,0,6 --CAT_LINES 1,100 --SPEC_OUT YES --PARA_OUT $LEPHAREDIR/examples/output.para --VERBOSE NO --ZFIX NO --PDZ_OUT $LEPHAREWORK/zphota/

# python $LEPHAREDIR/examples/figuresLPZ.py $cat_out
# python $LEPHAREDIR/examples/spec.py *.spec -d pdf -o $LEPHAREWORK/zphota/spec

# mv $cat_out Id*.spec figuresLPZ.pdf $LEPHAREWORK/zphota/
drewoldag commented 5 months ago

Also move examples to ./docs/historical_examples.

We don't want old, not-recommended examples at the top level of the repo.