jacopo-chevallard / BEAGLE-general

Basic information to get started with the galaxy spectral modelling tool Beagle
https://www.iap.fr/beagle/
9 stars 0 forks source link

Inaccurate BEAGLE mock photometry - problem in "mock mode" for combined usage of 'gridded', 'fixed', and 'random' parameters #47

Closed kevinhainline closed 7 years ago

kevinhainline commented 7 years ago

I wanted to create some low mass, lower redshift, quiescent objects with BEAGLE, using the parameter file at the end of this post, and while it ran correctly, and produced objects with mass values and redshifts as expected, when I went to look at the output, I found that many of the apparent magnitude lines in the output file were repeated, even though the objects have different redshifts. The SEDs seem to be correct, but the photometry does not.

Here's the first object from the output fits file: image

And here's the second object from the output fits file: image

And here's the third object from the output fits file: image

These objects actually do have different tau values, but the remainder of their parameters are the same, outside of the observed redshift. This happens throughout the output file, which you can download here:

BEAGLE_mock_lowz_lowmass.fits.zip

# This is a stripped down version of the BEAGLE parameter file for 
# with checking the correct installation of BEAGLE using Docker.
# This file will be used for producing artificial photometry using
# an analytic star formation history.
# Verbose mode: 0 ---> no info
#               1 ----> print only errors
#               2 ---> print errors and warnings
#               3 ----> print errors, warnings and info 
VERBOSE = 1

# Seed for the random number generator
SEED = 994189

#****************************************************************
#******************** COSMOLOGICAL PARAMETERS *******************
#****************************************************************
#
# If left blank, default parameter values will be used.

HUBBLE_0 = 

OMEGA_MATTER =

OMEGA_LAMBDA =

#****************************************************************
# ******************* TEMPLATES  *****************************
#****************************************************************

#TEMPLATES = $BEAGLE_TEMPLATES/bc03/bc03_miles_chab_spectra
TEMPLATES NEBULAR = $BEAGLE_TEMPLATES/ineb_Jan16_C100/cb2013_n2_mup100_N015_O01_deplO70_C100_Jan16
EMISSION LINES CONFIGURATION = $BEAGLE_TEMPLATES/ineb_Jan16_C100/cb2013_n2_mup100_N015_O01_deplO70_C100_Jan16_line_wavelengths_PHOTOMETRY.dat

SHRINK TEMPLATES WL RANGE = 900 60000
REBIN TEMPLATES = 10

#****************************************************************
# ******************* SPECTROSCOPY ***************************
#****************************************************************

#SPECTRAL INDICES CONFIGURATION = $BEAGLE_FILTERS/spec_config.dat

#SPECTRAL INDICES CATALOGUE = $BEAGLE_DATA/spec_config_17_EWs.fits

FIT SPECTRUM = F

#****************************************************************
# ******************* PHOTOMETRY *****************************
#****************************************************************

FILTERS FILE = $BEAGLE_FILTERS/filter_NIRCam_DEEP.dat

FIT PHOTOMETRY = F
FIT SPECTRUM = F

# N_OBJECTS = 10

#****************************************************************
#******************** DUST ATTENUATION AND IGM ABSORPTION *******
#****************************************************************
#
IGM ABSORPTION = Inoue

# File containing set of radiative transfer (RT) calculations of dust attenuation of starlight
#RT CALCULATIONS = Tuffs_bulge_NEW-28-11.dat Tuffs_thick_NEW-28-11.dat Tuffs_thin_NEW-28-11.dat
#RT COMPONENTS NAMES = bulge thick_disc thin_disc

# **************************************************
# ************** SF BIN #1 **************************
# **************************************************
SF_PARAMETER  = name:sfh_type                  mock:type:fixed  char_value:delayed
#options for analytic SFHs are 'ssp' (for a burst), 'constant', 'exponential', 'delayed', 'rising'

# In log(yr)
SF_PARAMETER  = name:tau                       mock:type:random  mock:distribution:uniform  mock:range:[4.,8.0]

# in log(Z/Z_sun)
SF_PARAMETER  = name:metallicity               mock:type:random  mock:distribution:uniform  mock:range:[-1.3,-0.3] #mock:range:[-2.5,0.5]

# In log M/M_sun
SF_PARAMETER  = name:mass                      mock:type:gridded  mock:grid:range:[4.0,8.0]  mock:grid:step:0.2

# **************************************************
# **************  OTHER SF PARAMETERS **************************
# **************************************************

# In log(M_sun/yr) 
#SF_PARAMETER  = name:sfr                      type:dependent

#SF_PARAMETER  = name:current_sfr_timescale    mock:type:fixed  mock:value:7.

SF_PARAMETER  = name:max_stellar_age   mock:type:random  mock:distribution:uniform mock:range:[7.3,8.7] #mock:range:[6.,9.0]

#****************************************************************
# ******************* PRINTED OUTPUT  *****************************
#****************************************************************

RESULTS DIRECTORY = $BEAGLE_RESULTS/BEAGLE_mock_lowz_lowmass/

MOCK CATALOGUE NAME = BEAGLE_mock_lowz_lowmass.fits

PRINT PHOTOMETRY = T
PRINT SPECTRUM = T
PRINT SPECTRAL INDICES = F
PRINT SF AND ChE HISTORIES = F

#****************************************************************
# ******************* PARAMETERS HANDLING  *****************************
#****************************************************************

PDF SAMPLER FILE = $BEAGLE_PARAM_DIR/MCMC_new.param

PARAMETER  = name:redshift                mock:type:gridded  mock:grid:range:[0.25,4.0]  mock:grid:step:0.25

PARAMETER  = name:nebular_logU            mock:type:random  mock:distribution:uniform  mock:range:[-4.0,-1.0]

PARAMETER  = name:nebular_xi              mock:type:random  mock:distribution:uniform  mock:range:[0.1,0.5]

PARAMETER  = name:nebular_Z      type:dependent 

PARAMETER  = name:attenuation_type  type:fixed  char_value:CCWW13_universal   
# values can be: CF00, Calzetti, CCWW13_universal, CCWW13_full

PARAMETER  = name:tauV_eff       mock:type:random  mock:distribution:uniform  mock:range:[0.001,5.]

PARAMETER  = name:mu            mock:type:fixed    mock:value:0.4
jacopo-chevallard commented 7 years ago

Hi Kevin, I agree that there is something not quite right in the output, my feeling is that the problem is related to using, at the same time, gridded and random parameters. While this is officially supported, I haven't tested this in a long time: to create mock catalogues I typically use a combination of gridded and fixed parameters, or a combination of from_file and fixed parameters.

You can you try this workaround, i.e. a combination of from_file and fixed parameters, to reproduce what you're trying to do. Let me know if you then get sensible results (I think you will), so that @eclake and I can take a look at this problem while you can go on with your work.

kevinhainline commented 7 years ago

When I fix the parameters that are set to random to a fixed value, it looks as if the issue goes away. The resulting SEDs all have different photometry, and their photometry is correct with respect to the SEDs. I was hoping to use the random setting to increase the variation in the output SEDs, but I suppose for this experiment I should probably just fix the free parameters! Thanks!

jacopo-chevallard commented 7 years ago

Good, but I'd keep this open, as this looks like a bug that should be looked at

jacopo-chevallard commented 7 years ago

Hi Kevin, thanks for reporting this, we'll take a look asap, in the meantime yes, I would suggest you to just create a grid and put into a FITS table, and read the parameters from there. I'm sorry that you're still stuck with this issue, I thought you were already using the from_file workaround.

jacopo-chevallard commented 7 years ago

Kevin, which Beagle version are you using?

kevinhainline commented 7 years ago

Jacopo, this the version installed on orange, v0.10.5.

I've also run BEAGLE with a fits table as the input catalogue, and if you give it this parameter file, and a set of redshifts (between 0.25 and 4) and masses (between 10^4 - 10^8), BEAGLE will only produce objects between z = 0.25 and 2.0, and while it results in the same number of objects as you might expect, each object at z < 2 with a given mass has been done twice. (If you instead give it a catalogue with z = 2.0 - 4.0, it will actually create these objects, though)

I've attached the input fits file (and the BEAGLE output file for comparison) if you want to try this out.

catalogue_param_test_files.zip

# This is a stripped down version of the BEAGLE parameter file for 
# with checking the correct installation of BEAGLE using Docker.
# This file will be used for producing artificial photometry using
# an analytic star formation history.
# Verbose mode: 0 ---> no info
#               1 ----> print only errors
#               2 ---> print errors and warnings
#               3 ----> print errors, warnings and info 
VERBOSE = 1

# Seed for the random number generator
SEED = 994189

#****************************************************************
#******************** COSMOLOGICAL PARAMETERS *******************
#****************************************************************
#
# If left blank, default parameter values will be used.

HUBBLE_0 = 

OMEGA_MATTER =

OMEGA_LAMBDA =

#****************************************************************
# ******************* TEMPLATES  *****************************
#****************************************************************

#TEMPLATES = $BEAGLE_TEMPLATES/bc03/bc03_miles_chab_spectra
TEMPLATES NEBULAR = $BEAGLE_TEMPLATES/ineb_Jan16_C100/cb2013_n2_mup100_N015_O01_deplO70_C100_Jan16
EMISSION LINES CONFIGURATION = $BEAGLE_TEMPLATES/ineb_Jan16_C100/cb2013_n2_mup100_N015_O01_deplO70_C100_Jan16_line_wavelengths_PHOTOMETRY.dat

SHRINK TEMPLATES WL RANGE = 900 60000
REBIN TEMPLATES = 10

#****************************************************************
# ******************* SPECTROSCOPY ***************************
#****************************************************************

#SPECTRAL INDICES CONFIGURATION = $BEAGLE_FILTERS/spec_config.dat

#SPECTRAL INDICES CATALOGUE = $BEAGLE_DATA/spec_config_17_EWs.fits

FIT SPECTRUM = F

#****************************************************************
# ******************* PHOTOMETRY *****************************
#****************************************************************

FILTERS FILE = $BEAGLE_FILTERS/filter_NIRCam_DEEP.dat

FIT PHOTOMETRY = F
FIT SPECTRUM = F

# N_OBJECTS = 10

#****************************************************************
#******************** DUST ATTENUATION AND IGM ABSORPTION *******
#****************************************************************
#
IGM ABSORPTION = Inoue

# File containing set of radiative transfer (RT) calculations of dust attenuation of starlight
#RT CALCULATIONS = Tuffs_bulge_NEW-28-11.dat Tuffs_thick_NEW-28-11.dat Tuffs_thin_NEW-28-11.dat
#RT COMPONENTS NAMES = bulge thick_disc thin_disc

# **************************************************
# ************** SF BIN #1 **************************
# **************************************************
SF_PARAMETER  = name:sfh_type                  mock:type:fixed  char_value:exponential
#options for analytic SFHs are 'ssp' (for a burst), 'constant', 'exponential', 'delayed', 'rising'

# In log(yr)
SF_PARAMETER  = name:tau                       mock:type:fixed    mock:value:6.0

# in log(Z/Z_sun)
SF_PARAMETER  = name:metallicity               mock:type:fixed    mock:value:-0.5

# In log M/M_sun
SF_PARAMETER  = name:mass                     type:from_file  

# **************************************************
# **************  OTHER SF PARAMETERS **************************
# **************************************************

# In log(M_sun/yr) 
#SF_PARAMETER  = name:sfr                      type:dependent

#SF_PARAMETER  = name:current_sfr_timescale    mock:type:fixed  mock:value:7.

SF_PARAMETER  = name:max_stellar_age   mock:type:fixed    mock:value:9.5

SF_PARAMETER = name:formation_redshift mock:type:fixed    mock:value:13.0

#****************************************************************
# ******************* PRINTED OUTPUT  *****************************
#****************************************************************

RESULTS DIRECTORY = $BEAGLE_RESULTS/BEAGLE_mock_lowz_lowmass_nogrid/

MOCK CATALOGUE NAME = BEAGLE_mock_lowz_lowmass_nogrid.fits

MOCK INPUT PARAMETERS = fileName:$BEAGLE_DATA/catalogue_params.fits

PRINT PHOTOMETRY = T
PRINT SPECTRUM = T
PRINT SPECTRAL INDICES = F
PRINT SF AND ChE HISTORIES = F

#****************************************************************
# ******************* PARAMETERS HANDLING  *****************************
#****************************************************************

#PDF SAMPLER FILE = $BEAGLE_PARAM_DIR/MCMC_example.param
PDF SAMPLER FILE = $BEAGLE_PARAM_DIR/MCMC_new.param

PARAMETER  = name:redshift     type:from_file

PARAMETER  = name:nebular_logU            mock:type:fixed    mock:value:-2.0

PARAMETER  = name:nebular_xi            mock:type:fixed    mock:value:0.3

PARAMETER  = name:nebular_Z      type:dependent 

PARAMETER  = name:attenuation_type  type:fixed  char_value:CCWW13_universal   
# values can be: CF00, Calzetti, CCWW13_universal, CCWW13_full

PARAMETER  = name:tauV_eff      mock:type:fixed    mock:value:0.0

PARAMETER  = name:mu            mock:type:fixed    mock:value:0.4
jacopo-chevallard commented 7 years ago

On it

jacopo-chevallard commented 7 years ago

The problem above is the same as in #49, i.e. line

SF_PARAMETER  = name:max_stellar_age   mock:type:fixed    mock:value:9.5

which produces unphysical combinations of parameters when z>2.

The behaviour of Beagle, however, was misleading, since it was using multiple times the same parameters, instead of just skipping the unphysical combinations. I'm working on a patch for this

jacopo-chevallard commented 7 years ago

version 0.11.2 should fix this, in the sense that you will get no output for unphysical combinations of parameters, while at the same time you should be able to more easily combine random and gridded parameters.

@eclake when you have time, can you update Orange? You should also recompile astrofortran!

@kevinhainline once Emma has updated Orange, can you retry the above cases? you may also just use Beagle-Docker 0.11.2 on your laptop while Emma updates Orange!

eclake commented 7 years ago

Updated on orange!

kevinhainline commented 7 years ago

@jacopo-chevallard I can go check, now that 0.11.2 is on orange. It seems like you want me to try both:

right?

jacopo-chevallard commented 7 years ago

If you have time, sure, otherwise just try the "real" case that you tried at the beginning!

kevinhainline commented 7 years ago

Ok, I've run things in the three ways I mentioned:

# This is a stripped down version of the BEAGLE parameter file for 
# with checking the correct installation of BEAGLE using Docker.
# This file will be used for producing artificial photometry using
# an analytic star formation history.
# Verbose mode: 0 ---> no info
#               1 ----> print only errors
#               2 ---> print errors and warnings
#               3 ----> print errors, warnings and info 
VERBOSE = 1

# Seed for the random number generator
SEED = 994189

#****************************************************************
#******************** COSMOLOGICAL PARAMETERS *******************
#****************************************************************
#
# If left blank, default parameter values will be used.

HUBBLE_0 = 

OMEGA_MATTER =

OMEGA_LAMBDA =

#****************************************************************
# ******************* TEMPLATES  *****************************
#****************************************************************

#TEMPLATES = $BEAGLE_TEMPLATES/bc03/bc03_miles_chab_spectra
TEMPLATES NEBULAR = $BEAGLE_TEMPLATES/ineb_Jan16_C100/cb2013_n2_mup100_N015_O01_deplO70_C100_Jan16
EMISSION LINES CONFIGURATION = $BEAGLE_TEMPLATES/ineb_Jan16_C100/cb2013_n2_mup100_N015_O01_deplO70_C100_Jan16_line_wavelengths_PHOTOMETRY.dat

SHRINK TEMPLATES WL RANGE = 900 60000
REBIN TEMPLATES = 10

#****************************************************************
# ******************* SPECTROSCOPY ***************************
#****************************************************************

#SPECTRAL INDICES CONFIGURATION = $BEAGLE_FILTERS/spec_config.dat

#SPECTRAL INDICES CATALOGUE = $BEAGLE_DATA/spec_config_17_EWs.fits

FIT SPECTRUM = F

#****************************************************************
# ******************* PHOTOMETRY *****************************
#****************************************************************

FILTERS FILE = $BEAGLE_FILTERS/filter_NIRCam_DEEP.dat

FIT PHOTOMETRY = F
FIT SPECTRUM = F

# N_OBJECTS = 10

#****************************************************************
#******************** DUST ATTENUATION AND IGM ABSORPTION *******
#****************************************************************
#
IGM ABSORPTION = Inoue

# File containing set of radiative transfer (RT) calculations of dust attenuation of starlight
#RT CALCULATIONS = Tuffs_bulge_NEW-28-11.dat Tuffs_thick_NEW-28-11.dat Tuffs_thin_NEW-28-11.dat
#RT COMPONENTS NAMES = bulge thick_disc thin_disc

# **************************************************
# ************** SF BIN #1 **************************
# **************************************************
SF_PARAMETER  = name:sfh_type                  mock:type:fixed  char_value:delayed
#options for analytic SFHs are 'ssp' (for a burst), 'constant', 'exponential', 'delayed', 'rising'

# In log(yr)
SF_PARAMETER  = name:tau                       mock:type:random  mock:distribution:uniform  mock:range:[4.,8.0]

# in log(Z/Z_sun)
SF_PARAMETER  = name:metallicity               mock:type:random  mock:distribution:uniform  mock:range:[-1.3,-0.3] #mock:range:[-2.5,0.5]

# In log M/M_sun
SF_PARAMETER  = name:mass                      mock:type:gridded  mock:grid:range:[4.0,8.0]  mock:grid:step:0.2
#SF_PARAMETER  = name:mass                      mock:type:random  mock:distribution:uniform  mock:range:[4.,8.0]
#SF_PARAMETER  = name:mass                      type:dependent

# **************************************************
# **************  OTHER SF PARAMETERS **************************
# **************************************************

# In log(M_sun/yr) 
#SF_PARAMETER  = name:sfr                      type:dependent

#SF_PARAMETER  = name:current_sfr_timescale    mock:type:fixed  mock:value:7.

SF_PARAMETER  = name:max_stellar_age   mock:type:random  mock:distribution:uniform mock:range:[7.3,8.7] #mock:range:[6.,9.0]

#****************************************************************
# ******************* PRINTED OUTPUT  *****************************
#****************************************************************

RESULTS DIRECTORY = $BEAGLE_RESULTS/BEAGLE_mock_lowz_low_mass_jacopo_test_3/

MOCK CATALOGUE NAME = BEAGLE_mock_lowz_low_mass.jacopo_test_3.fits

PRINT PHOTOMETRY = T
PRINT SPECTRUM = T
PRINT SPECTRAL INDICES = F
PRINT SF AND ChE HISTORIES = F

#****************************************************************
# ******************* PARAMETERS HANDLING  *****************************
#****************************************************************

#PDF SAMPLER FILE = $BEAGLE_PARAM_DIR/MCMC_example.param
PDF SAMPLER FILE = $BEAGLE_PARAM_DIR/MCMC_new.param

PARAMETER  = name:redshift                mock:type:gridded  mock:grid:range:[0.25,4.0]  mock:grid:step:0.25
#PARAMETER  = name:redshift                mock:type:fixed    mock:value:6.0
#PARAMETER  = name:formation_redshift      mock:type:fixed    mock:value:15.0

#PARAMETER  = name:nebular_logU  type:dependent
PARAMETER  = name:nebular_logU            mock:type:random  mock:distribution:uniform  mock:range:[-4.0,-1.0]

#PARAMETER  = name:nebular_xi    mock:type:fixed    mock:value:0.3
PARAMETER  = name:nebular_xi              mock:type:random  mock:distribution:uniform  mock:range:[0.1,0.5]

PARAMETER  = name:nebular_Z      type:dependent 

PARAMETER  = name:attenuation_type  type:fixed  char_value:CCWW13_universal   
# values can be: CF00, Calzetti, CCWW13_universal, CCWW13_full

#PARAMETER  = name:tauV_eff      mock:type:gridded  mock:grid:range:[0,2.0]  mock:grid:step:0.5
#PARAMETER  = name:tauV_eff      mock:type:fixed    mock:value:0.0
PARAMETER  = name:tauV_eff       mock:type:random  mock:distribution:uniform  mock:range:[0.001,5.]

PARAMETER  = name:mu            mock:type:fixed    mock:value:0.4

And here are the M*: image

And Mtot: image

distributions. It looks like it ran pretty well.

This ran exactly the same way as before, stopping at z < 2.

This ran correctly, ending with this Mtot distribution:

image

This seems to be the version that I wanted, in terms of creating quiescent SEDs.

jacopo-chevallard commented 7 years ago

Perfect, thanks for the careful testing kevin !! closing this and related #49