Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue/49/delight #57

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a87c686
very first import of pseudo delight in rail for further developpements
sylvielsstfr Feb 23, 2021
8cb5db6
first link between delight and Rail. Instructions in HowToDelightPZ.md
sylvielsstfr Feb 24, 2021
30aea5f
in principe do the configfile in the format required by Delight, conf…
sylvielsstfr Feb 25, 2021
8541a80
minor correction
sylvielsstfr Feb 25, 2021
2e39115
add process SEDs
sylvielsstfr Feb 26, 2021
78877b7
Does the SED flux simulation and the template fitting
sylvielsstfr Feb 26, 2021
ca4787c
change name delightLearn
sylvielsstfr Feb 26, 2021
3bc639d
add delightApply
sylvielsstfr Feb 27, 2021
904a32e
define a tutorial mode
sylvielsstfr Feb 28, 2021
2d4db09
steer redshift of delight from rail and extend to 3
sylvielsstfr Mar 4, 2021
0782ee2
able to convert hdf5 files
sylvielsstfr Mar 9, 2021
1ddfa9d
adding calibrateTemplateMixturePriors but under debug now
sylvielsstfr Mar 9, 2021
adc63a4
import*
sylvielsstfr Mar 14, 2021
8c06b38
Now Delight Apply to the whole DC2 test sample
sylvielsstfr Mar 20, 2021
88c1aad
move template fit into estimation
sylvielsstfr Mar 20, 2021
5728f2d
should wrok
sylvielsstfr Mar 20, 2021
bd0116b
add comments in yaml file
sylvielsstfr Mar 21, 2021
4dfd169
get the entry number of entries selected
sylvielsstfr Mar 22, 2021
211051f
rail get back redshifts from delight at the end of chunk
sylvielsstfr Mar 22, 2021
762be04
add param
sylvielsstfr Mar 28, 2021
ae37d0b
remove unnecessary config parameters
sylvielsstfr Mar 29, 2021
ec49ebc
after move of delight into rail
sylvielsstfr May 8, 2021
7ccd31a
correct new RAIL with makeConfigParam.py corrected
sylvielsstfr May 9, 2021
7c8ffb7
Set yaml for DC2 data
sylvielsstfr May 9, 2021
b6c07c7
add libPriorPZ
sylvielsstfr May 13, 2021
a5ea4ed
put a new templates
sylvielsstfr May 13, 2021
2688502
update for changing the simulation normalisation
sylvielsstfr May 14, 2021
539d3cc
put simulation and DC2 data to same internal delight flux units
sylvielsstfr May 17, 2021
1158a3c
update yaml
sylvielsstfr May 17, 2021
07ed7d5
convertDESCcat.py : forgot multiplicative fator
sylvielsstfr May 20, 2021
02d9ad3
add few comments
sylvielsstfr May 25, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 131 additions & 0 deletions examples/HowToDelightPZ.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# DelightPZ README.md

- sylvielsstfr,
- creation date : Feb 24th 2021
- update : May 9th 2021

## Delight reference package

- You must have a working Delight package installed.

- Get it from https://github.com/LSSTDESC/Delight

- Then install Delight according the instructions here

- **https://delight.readthedocs.io/en/latest/install.html**


Get the Delight data https://github.com/LSSTDESC/Delight/tree/master/data

in some path defined in RAIL config file (see file **DelightPZ.yaml**).



## LSSTDESC/RAIL

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in DESC we are advocating to avoid --user as it is extremely fragile. If the packages are not conda installable, one should still work in a conda env and run pip within this env, without --user

### Installation of RAIL

Installation from here
- **https://github.com/LSSTDESC/RAIL**

git clone git@github.com:LSSTDESC/RAIL.git
cd RAIL


For the moment, the following files are under developpment in the branch **issue/49/delight**

git checkout issue/49/delight


- **RAIL/examples/configs/delightPZ.yaml**
- **RAIL/rail/estimation/algos/delightPZ.py**
- **RAIL/rail/estimation/algos/include_delightPZ/**

Note **include_delightPZ** includes scripts interfaces from Delight.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is probably not a good idea even if it is a lot of code. And the copying of the utils.py file in Delight, which anyway is going to be deprecated, is a red flag.



rail
├── README.md
├── __init__.py
├── creation
│   ├── README.md
│   └── __init__.py
├── estimation
│   ├── README.md
│   ├── __init__.py
│   ├── algos
│   │   ├── __init__.py
│   │   ├── delightPZ.py
│   │   ├── flexzboost.py
│   │   ├── include_delightPZ
│   │   │   ├── __init__.py
│   │   │   ├── calibrateTemplateMixturePriors.py
│   │   │   ├── convertDESCcat.py
│   │   │   ├── delightApply.py
│   │   │   ├── delightLearn.py
│   │   │   ├── getDelightRedshiftEstimation.py
│   │   │   ├── makeConfigParam.py
│   │   │   ├── processFilters.py
│   │   │   ├── processSEDs.py
│   │   │   ├── simulateWithSEDs.py
│   │   │   └── templateFitting.py
│   │   ├── randomPZ.py
│   │   ├── sklearn_nn.py
│   │   └── trainZ.py
│   ├── estimator.py
│   └── utils.py
└── evaluation
├── README.md
└── __init__.py


### Build RAIL


python setup.py install


### Run RAIL


- delightPZ generates the configuration file **parametersTest.cfg** required by Delight

The path of the configuration file is defined in **DelightPZ.yaml** (RAIL/example/configs) .

#### RAIL temporay files

The recommended temporary structure in **examples/** directory from where one issue the command to run RAILS with Delight:

python main.py config/delightPZ.yaml

- Some temporary directories must be created in **examples/** for Delight input and output data.

- The recommended structure is the following

#### For DC2 data
tree tmp

tmp
├── delight_data
├── delight_indata
│   ├── BROWN_SEDs
│   ├── CWW_SEDs
│   └── FILTERS



#### For internal mock data (simulation)
tree tmpsim

tmpsim
├── delight_data
├── delight_indata
│   ├── BROWN_SEDs
│   ├── CWW_SEDs
│   └── FILTERS


Note the directories BROWN_SEDs, CWW_SEDs, FILTERS must be copied from Delight installation
https://github.com/LSSTDESC/Delight/tree/master/data .

76 changes: 76 additions & 0 deletions examples/configs/delightPZ.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
##########################################################################################
#
# RAIL configuration file for delightPZ module
#
# Steering Delight from RAIL
# Used on Vera C. Rubin LSST only estimation
#
# Author : Sylvie Dagoret-Campagne
# Affiliation : IJCLab/IN2P3/CNRS/France
# Creation date : March 2021
# Last update : May 8th 2021
#
############################################################################################
run_params:
class_name: delightPZ
run_name: test_delightPZ
#------------------------------------------------
# redshift range and binning for delight
# dlght_ prepend means a parameter used by Delight
#------------------------------------------------
dlght_redshiftMin: 0.01
dlght_redshiftMax: 3.01
dlght_redshiftNumBinsGPpred: 300
dlght_redshiftBinSize: 0.01
dlght_redshiftDisBinSize: 0.2
#-----------------------------------------------
# Delight input data (Filters and SED templates), note Delight will write inside this directory
# example recommended:
# - DC2 mode : dlght_inputdata: "./tmp/delight_indata"
# - tutorial mode : dlght_inputdata: "./tmpsim/delight_indata"
#----------------------------------------------
dlght_inputdata: "./tmp/delight_indata"
#---------------------------------------
# temporary directory for delight work
# example recommended:
# - DC2 mode : tempdir: "./tmp" and tempdatadir: "./tmp/delight_data"
# - tutorial mode : tempdir: "./tmpsim" and tempdatadir: "./tmpsim/delight_data"
#---------------------------------------
tempdir: "./tmp"
tempdatadir: "./tmp/delight_data"
#----------------------------------------
# delight configuration file filename
#----------------------------------------
delightparamfile: "parametersTest.cfg"
#------------------------------------------------------------------------
# Running mode
# tutorial mode :
# - True : activate internal flux simulation
# - False : activate use of DC2 datasets for training and Validation
#-----------------------------------------------------------------------
dlght_tutorialmode: False
#------------------------------------------------------------------------
# Filtering of training and Validation dataset
# according flux SNR
#-------------------------------------------------------------------------
flag_filter_training: True
snr_cut_training: 5
flag_filter_validation: True
snr_cut_validation: 3
#-----------------------------------------------------------------------
# Special run
# Should not be used
#-------------------------------------------------------------------------
dlght_calibrateTemplateMixturePrior: False
#-------------------------------------------------------------------------
# Delight hyper-parameters that must be optimized
#---------------------------------------------------------------------------
zPriorSigma: 0.2
ellPriorSigma: 0.5
fluxLuminosityNorm: 1.0
alpha_C: 1.0e3
V_C: 0.1
alpha_L: 1.0e2
V_L: 0.1
lineWidthSigma: 20

Loading