cschreib / fastpp

C++ version of the SED fitting code FAST (Kriek et al. 2009); it's faster, uses less memory, and has more features.
MIT License
27 stars 4 forks source link

Question: How to access the scaling factor for the spectra in the grid file? #18

Closed Nikhil0504 closed 1 year ago

Nikhil0504 commented 1 year ago

Hello, I am doing a combined fit of photometry and spectrum for a galaxy. I set AUTO_SCALE to 1 and SAVE_CHI_GRID to 1 but I don't seem to find the scaling factor in FITS file after converting the grid to .FITS.

This was the output I got after using the convert script provided:

found 1 galaxies, with 42 properties, 6 grid parameters and 674016 models
grid names: z, Av, Av_bc, lage, metal, ltau
prop names: lscale, sscale, lmass, lsfr, lssfr, lldust, lldust_bc, llion, lmform, la2t, CN_1, CN_2, Ca4227, G4300, Fe4383, Ca4455, Fe4531, Fe4668, Hbeta, Fe5015, Mg_1, Mg_2, Mg_b, Fe5270, Fe5335, Fe5406, Fe5709, Fe5782, Na_D, TiO_1, TiO_2, Hdelta_A, Hgamma_A, Hdelta_F, Hgamma_F, Halpha, tsf, past_sfr, sfr10, sfr50, brate10, brate50
[--------------------------------] 28982688 100%, 104ms elapsed, 0ns left, 104ms total  

Can you please tell me where the scaling factor is located at? Or is it something we will need to extrapolate somehow?

cschreib commented 1 year ago

Hi, and thanks for the feedback. I wasn't sure I remembered, so I looked at the code to confirm; the spectrum rescaling should be saved alongside the other properties of the model (SFR, etc). It should be found in the column called sscale. Can you find it? If not, could you show me the list of columns you see in the FITS file please?

NB: The value found in sscale is actually the ratio L/S, where L and S are the model scaling factors for the photometey and the spectrum, respectively. So sscale can essentially be interpreted as the factor that would have to be applied to the spectrum for it to match the photometry. For a well calibrated spectrum, it should be equal to one.

Nikhil0504 commented 1 year ago

Sure, here are the columns for the source:

ColDefs(
    name = 'CHI2'; format = '1E'; dim = '(1)'
    name = 'MODEL'; format = '1K'; dim = '(1)'
    name = 'LSCALE'; format = '1E'; dim = '(1)'
    name = 'SSCALE'; format = '1E'; dim = '(1)'
    name = 'LMASS'; format = '1E'; dim = '(1)'
    name = 'LSFR'; format = '1E'; dim = '(1)'
    name = 'LSSFR'; format = '1E'; dim = '(1)'
    name = 'LLDUST'; format = '1E'; dim = '(1)'
    name = 'LLDUST_BC'; format = '1E'; dim = '(1)'
    name = 'LLION'; format = '1E'; dim = '(1)'
    name = 'LMFORM'; format = '1E'; dim = '(1)'
    name = 'LA2T'; format = '1E'; dim = '(1)'
    name = 'CN_1'; format = '1E'; dim = '(1)'
    name = 'CN_2'; format = '1E'; dim = '(1)'
    name = 'CA4227'; format = '1E'; dim = '(1)'
    name = 'G4300'; format = '1E'; dim = '(1)'
    name = 'FE4383'; format = '1E'; dim = '(1)'
    name = 'CA4455'; format = '1E'; dim = '(1)'
    name = 'FE4531'; format = '1E'; dim = '(1)'
    name = 'FE4668'; format = '1E'; dim = '(1)'
    name = 'HBETA'; format = '1E'; dim = '(1)'
    name = 'FE5015'; format = '1E'; dim = '(1)'
    name = 'MG_1'; format = '1E'; dim = '(1)'
    name = 'MG_2'; format = '1E'; dim = '(1)'
    name = 'MG_B'; format = '1E'; dim = '(1)'
    name = 'FE5270'; format = '1E'; dim = '(1)'
    name = 'FE5335'; format = '1E'; dim = '(1)'
    name = 'FE5406'; format = '1E'; dim = '(1)'
    name = 'FE5709'; format = '1E'; dim = '(1)'
    name = 'FE5782'; format = '1E'; dim = '(1)'
    name = 'NA_D'; format = '1E'; dim = '(1)'
    name = 'TIO_1'; format = '1E'; dim = '(1)'
    name = 'TIO_2'; format = '1E'; dim = '(1)'
    name = 'HDELTA_A'; format = '1E'; dim = '(1)'
    name = 'HGAMMA_A'; format = '1E'; dim = '(1)'
    name = 'HDELTA_F'; format = '1E'; dim = '(1)'
    name = 'HGAMMA_F'; format = '1E'; dim = '(1)'
    name = 'HALPHA'; format = '1E'; dim = '(1)'
    name = 'TSF'; format = '1E'; dim = '(1)'
    name = 'PAST_SFR'; format = '1E'; dim = '(1)'
    name = 'SFR10'; format = '1E'; dim = '(1)'
    name = 'SFR50'; format = '1E'; dim = '(1)'
    name = 'BRATE10'; format = '1E'; dim = '(1)'
    name = 'BRATE50'; format = '1E'; dim = '(1)'
    name = 'Z'; format = '1E'; dim = '(1)'
    name = 'AV'; format = '1E'; dim = '(1)'
    name = 'AV_BC'; format = '1E'; dim = '(1)'
    name = 'LAGE'; format = '1E'; dim = '(1)'
    name = 'METAL'; format = '1E'; dim = '(1)'
    name = 'LTAU'; format = '1E'; dim = '(1)'
)
cschreib commented 1 year ago

That's it: name = 'SSCALE'; format = '1E'; dim = '(1)'. Are you able to read the data from that column?

Nikhil0504 commented 1 year ago

Yes, but is it supposed to be below 1?

cschreib commented 1 year ago

That's a different question. Theoretically yes, it can be below one; there is nothing in the code stopping that if that is what the data and model prefer.

In practice, I would expect it to be exclusively close to or above one only if all the conditions below are met:

If all the above is true, then:

Nikhil0504 commented 1 year ago

Thank you so much for your help and inputs! I'm going to close this issue as it's resolved.

cschreib commented 1 year ago

Glad I could help. Good luck!