ObsData

class ObsData(cosmo=None, data_table=None, dupl_filter=False, data_set_filter=None, UL_filtering=False, UL_value=None, UL_CL=0.95, **keywords)[source]

Bases: object

ObsData class

This class provides a powerful interface to load observational data stored in a file. The following parameters set the corresponding class members

Attributes Summary

gammapy_table

metadata

table

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, silent])

filter_freq([nu_min, nu_max, exclude])

filter the data, keeping all the data with nu_min <nu< nu_max if exclude=False (defualt).

filter_time([T_min, T_max, exclude])

filter the data, keeping all the data with T_min <T< T_max if exclude=False (defualt).

find_time_span([data_set, silent, get_values])

returns Tstart, Tstop, and Delta T for the full data set (if no dat_set is provided), or for a specific data_set

get_data_points([log_log, skip_UL, frame, ...])

Gives data point

get_data_sets()

get_gammapy_table()

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])

load(file_name)

log_to_lin([log_val, log_err])

plot_sed([plot_obj, frame, color, fmt, ms, ...])

plot_time_spans([save_as])

remove_dupl_entries(data)

remove duplicate entries

reset_data()

save(file_name)

set_UL([val])

set_error(error_value[, nu_range, data_set, ...])

set all the paramters to same error

set_fake_error(val)

Sets the value for the fake error

set_zero_error([val, replace_zero])

show_data_sets()

show_time_span([data_set])

Attributes Documentation

gammapy_table
metadata
table

Methods Documentation

add_systematics(syst, nu_range=None, data_set=None)[source]

add systematics to errors

Parameters:
  • syst – (float) systematic value (fractional)

  • nu_range – array_like of floats, [nu_min,nu_max], optional, range of frequencies to apply sistematics

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, silent=False)[source]
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:
  • nu_min (float) – lower limit of the range (linear scale, in Hz)

  • nu_max (float) – upper limit of the range (linear scale, in Hz)

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:
  • T_min (float) – lower limit of the range (MJD)

  • T_max (float) – upper limit of the range (MJD)

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

get_data_points(log_log=False, skip_UL=False, frame='obs', density=False)[source]

Gives data point

get_data_sets()[source]
get_gammapy_table()[source]
get_time_span(data_set=None)[source]
group_data(N_bin=None, bin_width=None)[source]

function to perform a spectral group of the data

Parameters:
  • N_bin – (int)

  • bin_width – (float) logarthmic

Note

To perform a rebinning of the data has to be provided either N_bin or bin_width.

lin_to_log(val=None, err=None)[source]
static load(file_name)[source]
log_to_lin(log_val=None, log_err=None)[source]
plot_sed(plot_obj=None, frame='obs', color=None, fmt='o', ms=4, mew=0.5, figsize=None, show_dataset=False, density=False)[source]
plot_time_spans(save_as=None)[source]
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

reset_data()[source]
save(file_name)[source]
set_UL(val=None)[source]
set_error(error_value, nu_range=None, data_set=None, data_msk=None)[source]

set all the paramters to same error

Parameters:
  • error_value – float, value of the error (fractional error)

  • nu_range – array_like of floats, [nu_min,nu_max], optional, range of frequencies to apply the error value

set_fake_error(val)[source]

Sets the value for the fake error

set_zero_error(val=0.2, replace_zero=True)[source]
show_data_sets()[source]
show_time_span(data_set=None)[source]