Closed mfuphi closed 2 years ago
@andreatramacere Also, I am using the latest version of jetset: 1.2. But I'm sure this part of the code is available in all the versions.
Hi @mfuphi, I guess that the easiest solution is to rename the columns in the file photandseds_3c279.ecsv
that match those in the standard jetset template, i.e. 'Frequency', 'Flux_Density', 'Uncertainty'->'x', 'y', 'dy'.
If you share the photandseds_3c279.ecsv
rather than the pdf version I can give a try.
Yes @andreatramacere, I agree, modifying the data file itself is easier. I can see that changing the code will be an even bigger exercise. Inside 3C279_SED.zip is the original csv file and my conversion of it to ecsv. I am interested in fitting the 'Frequency' vs 'Flux Density' columns. I think I can manage to isolate only the columns I am interested in.
For now I will manipulate the data file because I have to finish the work I'm doing right now. In future, I will try to modify the code to have flexibility in terms of taking in file with arbitrary number of columns. If it works I will share with you.
@mfuphi, there are several inconsistencies in the .ecsv file. If you try read it with astropy table it will give you several errors. I suggest to format before the file in such a way that you can read it with a command like:
from astropy.table import Table
t=Table.read('photandseds_3c279.ecsv',format='ascii.ecsv')
In particular, if you have strings with more than one word, please put them within quotes, otherwise the space (default delimiter for ecsv, will add a new column). Then check that the columns number matches the number of columns names. I also noticed that the name of the column No
was interpreted by astropy as False
, so it is better to rename it as'Number
@andreatramacere, I didn't know about this. Thanks I will revise the file.
Thanks, @andreatramacere ,
So this is the new ecsv I have created photandseds_3c279.ecsv.
I have made changes to lines 60, 62, 64 of jetset.data_loader.py as follows From self._names = ['x', 'dx', 'y', 'dy', 'T_start', 'T_stop', 'UL', 'data_set']
self._dt = ('f8', 'f8', 'f8', 'f8', 'f8', 'f8', 'bool', 'S16')
*self._units = [u.Hz, u.Hz,(u.erg / (u.cm * 2 u.s)) ,(u.erg / (u.cm * 2 u.s)), cds.MJD, cds.MJD, None, None]*
To self._names = ['No', 'Observed_Passband', 'Photometry_Measurement', 'Uncertainty', 'Units', 'Frequency', 'Flux_Density', 'Upper_limit_of_uncertainty', 'Lower_limit_of_uncertainty', 'Upper_limit_of_Flux_Density', 'Lower_limit_of_Flux_Density', 'NED_Uncertainty', 'Refcode', 'Significance', 'Published_frequency', 'Frequency_Mode', 'Coordinates_Targeted', 'Spatial_Mode', 'Qualifiers', 'Comments']
self._dt = ('f8', 'S16', 'f8', 'f8', 'S16', 'f8', 'f8', 'S16', 'S16', 'S16', 'S16', 'f8', 'S16', 'S16', 'S16', 'S16', 'S16', 'S16', 'S16', 'S16')
*self._units = [None, None, u.erg/(u.cm2 * u.s), u.erg/(u.cm*2 u.s), None, u.Hz, u.erg/(u.cm2 u.s u.Hz), u.erg/(u.cm2 u.s u.Hz), u.erg/(u.cm2 u.s u.Hz), u.erg/(u.cm2 u.s u.Hz), u.erg/(u.cm2 u.s u.Hz), u.erg/(u.cm2 u.s), None, None, u.Hz, None, None, None, None, None] So far, no complaints when I ran these (above*) lines There is a complaint on line 113 corresponding to the method from_file()*.
Further proposed changes are on lines: 122 - 140 _check_frame_and_scale() change: all previous labels 'x', 'dx', 'y', 'dy', etc... to: new labels, e.g. 'No', 'Observed_Passband', 'Photometry_Measurement', etc...
lines: 237 - 244 from_asdc() change: all previous labels 'x', 'dx', 'y', 'dy', etc... to: new labels, e.g. 'No', 'Observed_Passband', 'Photometry_Measurement', etc...
lines: 447 - 463 _build_data() change: instances of 'x', 'y', 'dx', 'dy' to: 'Frequency', 'Flux_Density', 'Uncertainty'
Or maybe instead of replacing the existing headings, I could simply expand the list by including ones in the photandseds_3c279.ecsv file that are not represented by code?
I hope this make sense?