ObsData
(data_file=None, dupl_filter=False, data_set_filter=None, UL_filtering=False, UL_value=0, **keywords)[source]¶Bases: object
This class provides a powerful interface to load observational data stored in a file. The following parameters set the corresponding class members:
Parameters: |
|
---|
Class Members storing the SED data:
data used to fit
- nu_data
- nuFnu_data
- dnu_data
- dnuFnu_data
- T_data
- data_set
upper limits
- nu_data_UL
- UL_data
The private method _load_data()
populates the data members starting from the data in the file. Data are properly transformed according
to the restframe
and data_scale
values.
Examples
The following lines shows and example of how to embed meta-data in the header of the SED data file,
just adding in the header of the file a line starting with #
and followed by the
indetifier md
, the meta-data name and value :
Assuming that the data file path has been stored in SED_file=/path/to/file/file.txt
,
the data can be imported as follows:
that is completely equivalent to:
Methods Summary
add_systematics (syst[, nu_range, data_set]) |
add systematics to errors |
filter_UL ([val]) |
remove the upper limits points from from data |
filter_data_set (filters[, exclude]) |
filter the data, returning all the data with |
filter_freq ([nu_min, nu_max, exclude]) |
filter the data, keeping all the data with |
filter_time ([T_min, T_max, exclude]) |
filter the data, keeping all the data with |
find_time_span ([data_set, silent, get_values]) |
returns Tstart, Tstop, and Delta T for the full data set (if no dat_set |
get_data_points ([log_log, skip_UL]) |
Gives data point |
get_data_sets () |
|
get_time_span ([data_set]) |
|
group_data ([N_bin, bin_width]) |
function to perform a spectral group of the data |
lin_to_log ([val, err]) |
|
log_to_lin ([log_val, log_err]) |
|
plot_time_spans (SEDdata[, save_as]) |
|
remove_dupl_entries (data) |
remove duplicate entries |
reset_data () |
|
set_UL ([val]) |
|
set_data_cols (col_types, col_nums) |
This method build the data columns from the columns in the data file, according to the user supplied specifications. |
set_error (error_value[, nu_range, data_set, …]) |
set all the paramters to same error |
set_facke_error (val) |
Sets the value for the facke error |
set_md_from_file (infile_name) |
get all the meta-data from the header of the SED data file. |
set_zero_error ([val, replace_zero]) |
|
show_data_sets () |
|
show_time_span ([data_set]) |
Methods Documentation
add_systematics
(syst, nu_range=None, data_set=None)[source]¶add systematics to errors
Parameters: |
|
---|
filter_UL
(val=None)[source]¶remove the upper limits points from from data
Parameters: | val – minimum value to set the upper limit. As default, negative errors indicates upper limits, hence val=0. |
---|---|
Retruns msk: | a boolean array to mask the upper limits, i.e. all the data points with negative errors. |
filter_data_set
(filters, exclude=False)[source]¶filter the data, returning all the data with data_set=filter if exclude=False (default) or returning all the data with data_set!=filter if exclude=True
Parameters: | filter (str) – name of the data_set to filter |
---|
filter_freq
(nu_min=None, nu_max=None, exclude=False)[source]¶filter the data, keeping all the data with nu_min <nu< nu_max if exclude=False (defualt). The opposite if exclude=True
both nu_max and nu_min are in linear scale
Parameters: |
|
---|
filter_time
(T_min=None, T_max=None, exclude=False)[source]¶filter the data, keeping all the data with T_min <T< T_max if exclude=False (defualt). The opposite if exclude=True
Parameters: |
|
---|
find_time_span
(data_set=None, silent=True, get_values=False)[source]¶returns Tstart, Tstop, and Delta T for the full data set (if no dat_set is provided), or for a specific data_set
group_data
(N_bin=None, bin_width=None)[source]¶function to perform a spectral group of the data
Parameters: |
|
---|
Note
To perform a rebinning of the data has to be provided either N_bin
or bin_width
.
remove_dupl_entries
(data)[source]¶remove duplicate entries
Parameters: | data – (array) 2-dim array storing the the table of the data. |
---|---|
Returns msk: | a boolean array to mask the duplicated entries |
Note
One entry is flagged as duplicated as each comlum in a row of the data table is equal to the corresponding elements of another row
set_data_cols
(col_types, col_nums)[source]¶This method build the data columns from the columns in the data file, according to the user supplied specifications.
Parameters: |
|
---|
as parameter a strings listing the fields separated by a comma.
Note
if col_nums is not provide the order of the fields in the string must have the same order of the columns position in the input file, but is completely flexible, meaning that the order of the columns in the data file can be arbitrary. If you have an SED data file ready, for example with the flux on the first column, and the freq on the second, you have just to set
means that the y column is the first (i.e. number 0) and the x column is the second (i.e. number 1). This is equivalent to
and equivalent to
The columns allowed for the SED ascii data file are:
Examples
If your file has a structure like:
Alternatively the dataCols specification can be stored as a metadata in the header of the SED ascii file:
set_error
(error_value, nu_range=None, data_set=None, data_msk=None)[source]¶set all the paramters to same error
Parameters: |
|
---|