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

conversion formula for flux #221

Open
Amararyan opened this issue Aug 20, 2018 · 15 comments
Open

conversion formula for flux #221

Amararyan opened this issue Aug 20, 2018 · 15 comments

Comments

@Amararyan
Copy link

please explain how has the flux been calculated in example_photometric_data.dat and what is its unit.

@kbarbary
Copy link
Member

The data are generated with this script: https://github.com/sncosmo/sncosmo/blob/master/misc/gen_example_data.py

Interpret the flux using the zp and zpsys columns: the flux is the number of photons through the given bandpass relative to a source with magnitude 'zp' in the 'zpsys' magnitude system. (Eg, a source with a magnitude of 25 in the AB system.)

@Amararyan
Copy link
Author

Thank you for your response sir. How can i generate the sample data for other models (Other Models have other parameters ). Please mention an script for any other model( eg. snf-2011fe).

@kbarbary
Copy link
Member

This documentation page demonstrates how to use Models to generate synthetic photmetry: https://sncosmo.readthedocs.io/en/latest/models.html Do you have a question about a specific model's parameters?

@Amararyan
Copy link
Author

The data in 'example_photometric_data.txt' is that of supernova 2006lc( that i have downloaded from an open catalog and converted it in the format that is accepted by sncosmo) . I am trying to fit "snana-2006lc" model in this data but i am getting some random results. I am enclosing here the data file(in txt format) and the screenshots of program(lightcurve.png) to fit the light curve and the results(result1.png &result2.png) that i have got. Also please tell something about " t0 " for this model, in my data i have taken " t0 " as the day of band maximum.For calculating the errors i have used the error propagation equation.
Please look into the program that i am sending to you and suggest the modifications required or in brief please mentions the steps to fit a model in the given data.

lightcurve
result1
result2
example_photometric_data.txt

@Amararyan
Copy link
Author

dear sir,
In data file "example_photometric_data.txt" and in the script for fitting lightcurve by setting t0=54029. and amplitude=9.32e-18 , i am getting reasonably better fit(but the value of ki square is around 1800). I am enclosing here the screenshot of script for fitting lightcurve (lightcurve.png) and the results(result1.png and result2.png) that i have got by doing these modifications.Here t0 is the day of detection.
Please tell if i am moving in the right direction.
lightcurve
result1
result2

@kbarbary
Copy link
Member

Thanks for including the script you're using. Here are some observations:

  • You don't need to copy your data to the example data file. Use data = sncosmo.read_lc('your_data_file.txt').

  • In the script, you're only fitting redshift and t0. You probably want to fit amplitude as well. You may also want to add dust to the model and fit the amount of dust. (this will change the relative amplitude between bands). Here's how you would create a model with dust (from the docs here:) :

    >>> dust = sncosmo.CCM89Dust()
    >>> model = sncosmo.Model(source='snana-2006lc',
    ...                       effects=[dust],
    ...                       effect_names=['host'],
    ...                       effect_frames=['rest'])

    Then try fitting parameters ['z', 't0', 'amplitude', 'hostebv'].

  • The definition of t0 is "the observer-frame time corrsponding to the model's phase=0." Phase=0 varies from model to model; in general it is arbitrary. Think of t0 as just a parameter that shifts the model in time with respect to the data. It's not necessarily the time of max in any band.

  • Finally, it is a bit weird to be fitting a model based on 2006lc to the data for 2006lc. What are you trying to accomplish here?

@Amararyan
Copy link
Author

Amararyan commented Aug 29, 2018 via email

@kbarbary
Copy link
Member

  1. In case i need to fit Core collapse supernovae(CCNe) type 1b and 1c then which model
    should i call in the script?

Depends on what you are trying to accomplish. But there is a list of built-in sources and their types here:
https://sncosmo.readthedocs.io/en/v1.5.x/source-list.html

  1. Generally data are available in the format (
    #event,time,magnitude,e_magnitude,upper limit,band). Is there any built in
    script in sncosmo which translates any different format to the one that is
    accepted by sncosmo?

No (because it's not possible to cover every type of file format people use for their data). But you don't have to write a file that is accepted by sncosmo, you just have to get the data into a table in the right format. So, you can read in your data and then programmatically construct an astropy Table with columns 'time', 'flux', 'fluxerr', 'band', 'zp', and 'zpsys'. See the astropy docs for help with astropy Table.

Yes, you do have to convert magnitude errors to flux errors yourself. Watch out for the upper limits in your file. You should take those into account in the flux errors.

  1. I am using error propagation equation to calculate error in the flux. Is
    this the reason for getting higher value of chi square? Then how should i
    calculate error?

You should not expect to get a chi^2 / dof of 1 if your model is not a good representation of the data. When you have very small errors on the data (as is the case here), discrepancies between the model and the data become more apparent. This will always be the case for any model: No model is perfect, but some models are useful.

Moreover how different data points can have same error
(the example data file in sncosmo consist of constant error for every data).

The example data is synthetic (made up). I pointed you to the script that creates it in my first reply.

@Amararyan
Copy link
Author

Thank you very much for such a nice and clear reply.
I still have a small question. As far as type Ia fitting are concerned with sncosmo, I think there are various models of type Ia in sncosmo that we can fit like SALT2, MLCS2K2 etc. However in case of CCSNe there seems to be only specific templets.
So my question is "Do we have specific models of CCSNe in sncosmo that can be fitted ?". Please mention with published example for CCSNe fitting using SNCosmo if possible? I want to try modeling various class of CCSNe using SNcosmo?

 

@kbarbary
Copy link
Member

kbarbary commented Sep 2, 2018

Core collapse SNe (even for a given subtype such as IIp) are much less uniform than Type Ia SNe. Therefore, it's more difficult to come up with a model that adequately explains the diversity of light curve shapes for CC SNe. The CC models in sncosmo are typically used in simulations. By using many different models, each based on a single SN, we hope to cover most of the diversity of light curve shapes.

There may be parameterized models for some CC subtypes in the literature, but we don't have any in sncosmo at the moment.

@kbarbary
Copy link
Member

kbarbary commented Sep 2, 2018

If you have data for a new CC SN, and you want to identify which subtype it belongs to, you could fit it to all the different CC models and see which one fits best.

Just be aware that you are not going to get a great chi^2 value.

@Amararyan
Copy link
Author

Hi sir,
Hope you are doing great.
This time i am trying fit the UBVRI light curves of a Type Ib/c-BL supernova. I am using the sources nugent-sn1bc and nugent-hyper (only models with Type Ib/c), but not getting reasonably good fit, in fact i am getting low model fluxes in the U, B and I bands though i have fitted host and milky way extinction and also tried all the dust models available, but hardly having any impact on these fluxes. I tried sncosmo.fit_lc and sncosmo.mcmc_lc options also. I am also enclosing the python program and corresponding results.
Please suggest a way.
amar
amar1
result.txt
plot_lc_fit.zip

@kbarbary
Copy link
Member

kbarbary commented Feb 7, 2019

Fit the color

When you call fit_lc in your script:

result, fitted_model = sncosmo.fit_lc(
    data, model,
    ['z', 't0','amplitude'],  # parameters of model to vary
   bounds={'z':(0.01, 0.018)},method='minuit', guess_amplitude =True,
   guess_t0=True, guess_z=True, minsnr=5.0, modelcov=False,maxcall=10000,
   phase_range=None,wave_range=None, warn=True) 

you are fitting z, t0 and amplitude but not hostebv. This means that the amplitude of dust remains fixed at zero and the dust has no effect. As you can see in the above plots, "hostebv" is 0.0.

No template is going to be great

Looking at the plots, I would predict that no value of hostebv will give you a great fit though. This may just be a case of the model not being a great description of all Ib/c SNe. It is illuminating to read about the template on Peter Nugent's website:

Type Ib/c: This is one is based on the work seen in Levan et al. (2005), ApJ (accepted), GRB 020410: A Gamma-Ray Burst Afterglow Discovered by its Supernova Light. It is based on all the Ib/c's Brian Barris put together for me a while back during a summer-time project for SNAP. The lightcurve comes from SN 1999ex based on the work of Hamuy et al. (2002), AJ, vol. 124, pg. 417. You will note that this template is blue compared to what you normally see for Ib/c's. My guess is that most, if not all, of these objects suffer from considerable extinction. Here I basically assume an E(B-V) of 0.4 and corrected accordingly.

Note that the lightcurve is based on a single SN. The spectral template (which dictates the color ) is based on more SNe, but there's probably diversity of color behavior within those SNe, and that diversity is not captured in the template.

Don't fit the redshift

Do you have a spectroscopic redshift for this SN? I'm assuming you do, since you have a type. If so, I would recommend setting the redshift to this value and not varying z in the fit.

@Amararyan
Copy link
Author

Amararyan commented Feb 7, 2019

Thank you very much for your reply. I would do the required modifications and will inform you.
Regards...

@Amararyan
Copy link
Author

Hello sir,
This time i have a very basic problem. Like the previous case (the case of a type Ib/c supernova in earlier discussions), i am still not able to get reasonable fit for a type Ib supernova case, though i tried every Ib and type Ib/c supernovae template available in sncosmo. This time i included "hostebv" and "hostr_v" as fitting parameters as suggested by you previously, in fact i am getting some nonphysical values of hostebv (something like few +10000)!! I think i am doing some mistakes while converting the data in to required format. Here i briefly explain the process:
a) I have data in the UBVRI band (most probably they are in vega system)
b) Then i converted the vega magnitudes in to magnitudes in the ab system using the following conversion formulas (http://www.astronomy.ohio-state.edu/~martini/usefuldata.html) :
i) mAB - mVega = 0.79 for U band
II)mAB - mVega = -0.09 for B band and similarly for other bands.

Honestly speaking, here i am confused about zero point (zp). After converting in to "ab" system, i simply took zp = 25 , i am not sure how to obtain the zp (is 25 default zp for every data in "ab" system if not then how to decide this??). Is this my mistake???
c) After converting into ab system, i converted magnitudes into fluxes.
d) then i tried to fit the models using sncosmo to this data.
I also attach the result image.
Please help.
sncomo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants