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

1994I throws nan for specphot #28

Closed
RobFirth opened this issue Nov 22, 2017 · 4 comments
Closed

1994I throws nan for specphot #28

RobFirth opened this issue Nov 22, 2017 · 4 comments
Assignees
Labels

Comments

@RobFirth
Copy link
Owner

As title, problem occurs when running get_specphot such as in scripts/extend_all_spectra.py

@RobFirth RobFirth self-assigned this Nov 22, 2017
@RobFirth RobFirth added the bug label Nov 22, 2017
@RobFirth
Copy link
Owner Author

I think this is linked to #24 and has now become pretty critical to figure out. It seems like it is distorting the integrated flux of all functions that use kcorr.calc_spectrum_filter_flux which underpins lots of stuff, including zeropoints and the mangling.

I get the following output from the code below:

SN2006aj_53786.270000
Filter_area = 958.904702526
Integrated flux = 65.3955702281
SN2006aj_53787.230000
Filter_area = 583.185950131
Integrated flux = 41.0298233406
SN2006aj_53788.200000
Filter_area = 1358.72907164
Integrated flux = 131.886385781
SN2006aj_53789.170000
Filter_area = 1357.72217486
Integrated flux = 146.521717503
SN2006aj_53790.140000
Filter_area = 1361.80653493
Integrated flux = 164.34213622
SN2006aj_53791.100000
Filter_area = 1356.94789874
Integrated flux = 163.802182486
SN2006aj_53792.070000
Filter_area = 1358.08475139
Integrated flux = 170.17603978
SN2006aj_53793.040000
Filter_area = 1342.63870674
Integrated flux = 156.866851118
SN2006aj_53794.010000
Filter_area = 1358.55873129
Integrated flux = 160.605022385
SN2006aj_53794.970000
Filter_area = 494.406955809
Integrated flux = 64.3739416067
SN2006aj_53795.940000
Filter_area = 1315.20012487
Integrated flux = 137.109302356
SN2006aj_53796.910000
Filter_area = 1313.60589901
Integrated flux = 121.107583058
SN2006aj_53797.880000
Filter_area = 1313.47758368
Integrated flux = 110.196456176
SN2006aj_53798.840000
Filter_area = 1315.40072684
Integrated flux = 92.2847571523
SN2006aj_53799.810000
Filter_area = 1314.80756892
Integrated flux = 91.8528874753
SN2006aj_53801.750000
Filter_area = 1298.16443106
Integrated flux = 63.0384962734
SN2006aj_53802.720000
Filter_area = 1299.82908919
Integrated flux = 45.3544694847
SN2006aj_53803.680000
Filter_area = 1296.91402526
Integrated flux = 37.1949955268
SN2006aj_53803.680001
Filter_area = 1296.93821395
Integrated flux = 51.5059756933

Notice something weird - the filter area is changing. The filter area shouldn't change. Suspect that it might be to do with the resampling of the filter response, but the fluctuations are severe - around 1300 for most, but as low as 494 for SN2006aj_53794.970000.

snname="SN2006aj"

sn = pcc.classes.SNClass(snname)
sn.load_phot(verbose=False)
sn.get_lcfit(os.path.join(pcc.defaults._default_recon_dir_path, snname + ".dat"))

sn.plot_lc(multiplot=False)

sn.load_list(path=os.path.join(pcc.defaults._default_list_dir_path, sn.name+".list"))
sn.load_spec()

# sn.load_mangledspec()
sn.load_reconspec()
sn.load_simspec()


path_to_filter = os.path.join(pcc.defaults._default_filter_dir_path,"BessellB.dat")
BessellB = pcc.classes.FilterClass()
BessellB.read_filter_file(path_to_filter)
BessellB.calculate_AB_zp()

sim_spec_flux = []
sim_mjd_obs = []

for spec in sn.sim_spec:
    print(spec)
    flux = pcc.kcorr.calc_spectrum_filter_flux(filter_object=BessellB, spectrum_object=sn.sim_spec[spec], 
                                               correct_for_area=False)
    mjd_obs = float(spec.split("_")[-1])
    
    sim_spec_flux.append(flux)
    sim_mjd_obs.append(mjd_obs)
    

@RobFirth
Copy link
Owner Author

After running the above, the filter object that has been loaded in is totally messed up:
filter_integration_bughunt_fig1-bessellb_after_some_resampling

@RobFirth
Copy link
Owner Author

For reference, it should look like this:
filter_integration_bughunt_fig2-bessellb

RobFirth pushed a commit that referenced this issue Dec 12, 2017
@RobFirth
Copy link
Owner Author

Recon spec for SN2006aj before:
sn2006aj_before_fix
and after bugfix:
sn2006aj_after_fix

There are obviously 2 discrepant spectra - I think this is a separate issue. Closing.

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

No branches or pull requests

1 participant