EPIC XMM-Newton Observation Data (EXOD) Documentation
This is the documentation for the EPIC XMM-Newton Observation Data (EXOD) project.
EXOD is designed for the detection of rapid transients in archival XMM-Newton data.
Contact: Norman Khan & Erwan Quintin (2024)
Norman.Khan@irap.omp.eu
Erwan.Quintin@irap.omp.eu
Installation
git clone https://github.com/nx1/EXOD2
cd EXOD
pip install -e .
Then set the 'EXOD' enviroment in your .bashrc to point to this repo i.e.
export EXOD='/home/{username}/EXOD2'
Running
The main script for the pipeline is found in EXOD2/exod/main.py
This will run over all the obsids specified in
EXOD2/data/observations.txt
and perform the transient search, the output is then saved in
/data/results/obsid/
Full Module Listing
post_processing
cluster_regions
Cluster regions in a DataFrame of regions by clustering sources within a certain radius using a K-D tree.
An example of how this works is provided below:
Input Regions (cartesian coords) xyz = [[0,0,0], # 0 [0,0,1], # 1 [0,1,0], # 2 [5,0,0], # 3 [4,0,0], # 4 [0,2,0], # 5 [0,3,0], # 6
cluster[0] = [0,1,3] --> cluster_num = 0 | mean position = 0,0,0 + 0,0,1 + 0,1,0 = 0.00, 0.33, 0.33 cluster[1] = [0,1,3] --> cluster_num = 0 | mean position = 0,0,0 + 0,0,1 + 0,1,0 = 0.00, 0.33, 0.33 cluster[2] = [1,3,6] --> cluster_num = 1 | mean position = 0,0,1 + 5,0,0 + 0,3,0 = 1.66, 1.00, 0.33 cluster[3] = [1,3,6] --> cluster_num = 1 | mean position = 0,0,1 + 5,0,0 + 0,3,0 = 1.66, 1.00, 0.33
Row 1 is both in cluster_num=1 and cluster_num=2, which one should we label it to? The closest mean position of course!
xyz[1] = [0,0,1]
distance.euclidean([0,0,1], [0.00, 0.33, 0.33]) = 0.75 (lowest!) distance.euclidean([0,0,1], 1.66, 1.00, 0.33) = 2.05
Row 1 therefore gets associated with cluster num 0
unique_regions = OrderedDict([((0,) : 0), ((1, 7) : 1), ((2, 8) : 2), ((3, 9) : 3), ((4, 10, 13, 16, 18) : 4), ((5, 11, 14, 17, 19, 27) : 5), ((6,) : 6), ((12,) : 7), ((15,) : 8), ((20, 23) : 9),
region_to_clusters = defaultdict(list, {0: [[0]], 1: [[1, 7], [1, 7]], 7: [[1, 7], [1, 7]], 2: [[2, 8], [2, 8]], 8: [[2, 8], [2, 8]], 3: [[3, 9], [3, 9]], 9: [[3, 9], [3, 9]], 4: [[4, 10, 13, 16, 18], [4, 10, 13, 16, 18], [4, 10, 13, 16, 18], [4, 10, 13, 16, 18], [4, 10, 13, 16, 18]], ... }
cluster_xyz_means = {(0,) : array([ 0.71092614, 0.12281395, -0.69245994]), (1, 7) : array([ 0.71165566, 0.12214711, -0.69182823]), (2, 8) : array([ 0.71478684, 0.1221836 , -0.68858618]), (3, 9) : array([ 0.71486105, 0.11933079, -0.68900932]), (4, 10, 13, 16, 18) : array([ 0.71399846, 0.11878942, -0.68999657]),
cluster_labels = [0, 1, 2, 3, 4, 5, 6, 1, 2, ...]
ClusterRegions
Cluster regions by clustering sources within a certain radius using a K-D tree.
Some definitions
Region Number: The index of the region in the DataFrame. Cluster: A collection of regions, e.g (0,) or (1,7) Cluster Number: The index of the cluster in the list of clusters.
Attributes:
| Name | Type | Description |
|---|---|---|
df_regions |
DataFrame
|
DataFrame containing ra_deg and dec_deg columns. |
clustering_radius |
Quantity
|
Clustering radius in arcseconds. |
xyz |
ndarray
|
Cartesian coordinates of the regions. |
clusters |
list
|
List of lists containing the regions in each cluster. |
cluster_xyz_means |
dict
|
Maps the cluster number to the mean cartesian position of the cluster on the unit sphere. |
region_to_clusters |
dict
|
Maps the region number to the containing the regions associated with each cluster. |
cluster_num_to_cluster |
dict
|
Maps the cluster number to the cluster. |
cluster_to_cluster_num |
dict
|
Maps the cluster to the cluster number. (reverse of cluster_num_to_cluster) |
region_num_to_cluster_num |
dict
|
Maps the region number to the cluster number (unique region number). |
df_regions_unique |
DataFrame
|
DataFrame containing the unique regions. |
n_clusters |
int
|
Number of unique regions. |
save |
bool
|
If True, save the clustered regions to a file. |
Source code in exod/post_processing/cluster_regions.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
calc_cluster_xyz_means()
Calculate the mean cartesian positions of each cluster.
Source code in exod/post_processing/cluster_regions.py
138 139 140 | |
cluster_regions()
Find unique regions by clustering sources within a certain radius using a K-D tree.
Source code in exod/post_processing/cluster_regions.py
142 143 144 145 146 147 | |
label_region_num_to_cluster_num()
Loop over all regions and label them to the closest cluster.
Source code in exod/post_processing/cluster_regions.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
map_region_num_to_clusters()
Create dictionary that maps the region number to the cluster.
Source code in exod/post_processing/cluster_regions.py
131 132 133 134 135 136 | |
number_clusters()
Create dictionary that maps each unique cluster to its unique cluster number.
Source code in exod/post_processing/cluster_regions.py
117 118 119 120 121 122 123 124 125 126 127 128 129 | |
renumber_clusters()
Renumber the clusters so that they go from 0 to n_clusters.
Source code in exod/post_processing/cluster_regions.py
185 186 187 188 189 190 191 192 193 194 195 196 197 | |
crossmatch
This module contains code for crossmatching the regions with various catalogues.
crossmatch_astropy_table_with_regions(tab, df_region, ra_col, dec_col)
Crossmatch with an arbitrary Fits Table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tab
|
Table
|
Astropy Table |
required |
df_region
|
DataFrame
|
DataFrame containing the regions to crossmatch (must have ra_deg and dec_deg columns) |
required |
ra_col
|
str
|
Column name for the RA values in degrees |
required |
dec_col
|
str
|
Column name for the DEC values in in degrees. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
tab_fits_cmatch |
Table
|
Table containing the crossmatched data. |
Source code in exod/post_processing/crossmatch.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
crossmatch_cds(df, max_sep_arcsec=20, catalogue='simbad', ra_col='ra_deg', dec_col='dec_deg')
Crossmatch using CDS X-Match Service.
Source code in exod/post_processing/crossmatch.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
crossmatch_dr14_slim(df_region, clobber=True)
Crossmatch regions with the 4XMM DR14 slim catalogue.
Source code in exod/post_processing/crossmatch.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
crossmatch_fits_table(fits_path, df_region, ra_col, dec_col)
Crossmatch with an arbitrary Fits Table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fits_path
|
Path
|
Path to the FITS file. |
required |
df_region
|
DataFrame
|
DataFrame containing the regions to crossmatch. |
required |
ra_col
|
str
|
Column name for the RA values in FITS file. |
required |
dec_col
|
str
|
Column name for the DEC values in FITS file. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
tab_fits_cmatch |
Table
|
Table containing the crossmatched data. |
Source code in exod/post_processing/crossmatch.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |
crossmatch_glade(df_region, clobber=True)
Crossmatch regions with GLADE+ catalogue, (converted to fits using topcat)
Source code in exod/post_processing/crossmatch.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
crossmatch_tranin_dr12(df_region)
Crossmatch the regions with the CLAXON Hugo Tranin DR12 catalogue.
Source code in exod/post_processing/crossmatch.py
106 107 108 109 110 111 | |
crossmatch_runs
This module is used for various the simulation subsets with each other In order to determine the crossmatch fraction and various other metrics.
calc_subset_cmatch_fraction(dfs_subset_crossmatch)
Calculate the fraction of successfully crossmatched regions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dfs_subset_crossmatch
|
dict
|
A dictionary containing the crossmatch results for each subset. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
df_subset_cmatch_fraction |
DataFrame
|
A DataFrame containing the fraction of successfully crossmatched regions. |
Source code in exod/post_processing/crossmatch_runs.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
calc_subset_n_regions(dfs_subset_crossmatch)
Calculate the number of regions in each subset.
Source code in exod/post_processing/crossmatch_runs.py
107 108 109 110 111 112 | |
crossmatch_simulation_subsets(dfs_subsets)
Crossmatch the subsets of simulations to each other.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dfs_subsets
|
dict
|
A dictionary containing the DataFrames for each subset. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dfs_subset_crossmatch |
dict
|
A dictionary containing the crossmatch results for each subset. Each DataFrame contains the indices of the crossmatched sources in the other subsets. A placeholder value of -1 is denoted for sources without a crossmatch. |
Source code in exod/post_processing/crossmatch_runs.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
get_run_subset_keys()
Get the keys for the simulation subsets.
Source code in exod/post_processing/crossmatch_runs.py
16 17 18 19 20 21 22 23 24 25 26 27 | |
plot_crossmatch_confusion_matrix(df_subset_cmatch_fraction, n_regions_sim)
Plot the confusion matrix for the crossmatch fractions.
Source code in exod/post_processing/crossmatch_runs.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
plot_mean_count_histogram(dfs_subsets)
Plot the mean count histograms for each subset.
Source code in exod/post_processing/crossmatch_runs.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | |
split_subsets(df_regions)
Split the regions into subsets based on the t_bin, E_lo, E_hi values in the runid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df_regions
|
DataFrame
|
The DataFrame containing the region information. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dfs_subsets |
dict
|
A dictionary containing the DataFrames for each subset. |
Source code in exod/post_processing/crossmatch_runs.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
ds9
View images from an XMM observation in DS9.
estimate_variability_properties
calc_sigma_cube(cube_n, cube_mu)
Calculate the sigma equivalent over a data cube. cube_n : observed data cube cube_mu : Expected data cube
Source code in exod/post_processing/estimate_variability_properties.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
clean_up_eclipses(data_cube, eclipses)
Removes eclipses in bright sources coming from merging of partial exposures. This is done by checking if the flux change is the same in the source and the rest of the frame
Source code in exod/post_processing/estimate_variability_properties.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |
clean_up_peaks(data_cube, peaks)
Removes peaks coming from flaring CCD edges
Source code in exod/post_processing/estimate_variability_properties.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
convert_count_to_flux(count, position, data_cube)
Used to convert count rates to fluxes, using vignetting / EEF / ECF
Source code in exod/post_processing/estimate_variability_properties.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
count_distant_peaks(peaks_or_eclipses, bins_min_between_peaks)
Counts the individual number of times the lightcurve went above the threshold for variability, and there was a given number of bins since the last time it was above this threshold last
Source code in exod/post_processing/estimate_variability_properties.py
135 136 137 138 139 140 141 142 143 144 145 146 | |
count_peaks(peaks_or_eclipses)
Counts the individual number of times the lightcurve went above the threshold for variability
Source code in exod/post_processing/estimate_variability_properties.py
130 131 132 133 | |
eclipse_count_estimate(fraction, N, mu)
Estimate the upper limit on the count of the eclipse, given an data_cube and observed counts, and a confidence fraction
Source code in exod/post_processing/estimate_variability_properties.py
155 156 157 158 | |
peak_count_estimate(fraction, N, mu)
Estimate the upper limit on the count of the peak, given an data_cube and observed counts, and a confidence fraction
Source code in exod/post_processing/estimate_variability_properties.py
149 150 151 152 | |
plot_lightcurve_alerts_with_background(cube, cube_background, cube_background_withsource, tab_boundingboxes)
This function creates the multi-panel lightcurve of the transient object. It will retrieve the background, and use it to compare the (source+background) to the background, and compute the likelihood in each frame :param cube: full data cube :param cube_background: data cube of de-sourced background estimate :param cube_background_withsource: data cube of de-sourced background estimate + constant contribution from the sources (i.e. we assume they are constant, take their stacked flux and distribute it over all frames) :param tab_boundingboxes: bounding boxes of variable objects, as obtained from variability.py :return: nothing, but saves the lightcurve of each (source+background) and its background, lightcurve of background-subtracted source, and lightcurve of likelihood of creating the signal with the background
Source code in exod/post_processing/estimate_variability_properties.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
extract_lc_features
calc_df_lc_feat_filter_flags(df_lc_feat)
Calculate the quality flags for the lightcurves in the sample.
Source code in exod/post_processing/extract_lc_features.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | |
calc_features(df_lc, key)
Calculate Features for a single lightcurve.
Source code in exod/post_processing/extract_lc_features.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
count_significant_bins(df_lc)
Count the total number of significant bins across all the lightcurves.
Source code in exod/post_processing/extract_lc_features.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
extract_lc_features(clobber=True)
Loop over all lightcurves and extract features.
Source code in exod/post_processing/extract_lc_features.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | |
largest_peak_info(df_lc)
Find the largest peak in the light curve and return some information about it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df_lc
|
DataFrame
|
DataFrame containing the light curve data. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
n_max_idx |
int
|
Index of the largest peak. |
n_max_last_bin |
bool
|
True if the largest peak is in the last bin. |
n_max_first_bin |
bool
|
True if the largest peak is in the first bin. |
n_max_isolated_flare |
bool
|
True if the largest peak is surrounded by zeros. |
Source code in exod/post_processing/extract_lc_features.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
print_df_lc_feat_filter_flag_stats(df_lc_feat)
Print a summary of the lightcurve quality flags.
Source code in exod/post_processing/extract_lc_features.py
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
filter
This module contains classes for filtering regions and lightcurves.
FilterBase
Bases: ABC
Base class for filters. All filters should inherit from this class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the filter. |
required |
Methods:
| Name | Description |
|---|---|
apply |
Apply the filter to the input dataframe. |
get_parameters |
Return a dictionary of filter-specific parameters. |
info |
Return a dictionary with information about the filter. |
Source code in exod/post_processing/filter.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
apply(df)
abstractmethod
This should set self.df_regions, self.df_filtered and self.removed.
Source code in exod/post_processing/filter.py
26 27 28 | |
get_parameters()
abstractmethod
This should return a dictionary of filter-specific parameters.
Source code in exod/post_processing/filter.py
30 31 32 | |
generate_combinations_with_one_or_none(filters)
Generates all combinations of zero or one filter from the given list.
This function creates an iterable that yields combinations of filters, where each combination includes either no filter or exactly one filter from the provided list. The function returns an iterator that produces these combinations on demand.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filters
|
list
|
A list of Filters() to generate combinations from. |
required |
Returns:
| Type | Description |
|---|---|
|
itertools.chain: An iterator yielding tuples that contain either |
|
|
no filters or one filter from the provided list. Each tuple is a |
|
|
valid combination. |
Example
filters = ['filter1', 'filter2'] result = generate_combinations_with_one_or_none(filters) print(list(result))
Output: [(), ('filter1',), ('filter2',)]
Source code in exod/post_processing/filter.py
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | |
generate_valid_combinations(*filter_lists)
Generates all valid combinations of filters from multiple lists, allowing at most one filter from each list.
This function takes multiple lists of filters as input and generates all possible combinations where each combination contains zero or one filter from each list. The Cartesian product of the combinations from each list is computed to create all valid combinations across multiple filter categories.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*filter_lists
|
list of lists
|
Variable number of filter lists. Each argument is a |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
list |
A list of valid filter combinations. Each combination is represented as a list of filters, |
|
|
where the filters are chosen from the input lists. The result includes combinations with zero |
||
|
or one filter from each list. |
Example
filters_energy = ['E1', 'E2'] filters_time = ['T1', 'T2'] result = generate_valid_combinations(filters_energy, filters_time) print(result)
Output: [[], ['E1'], ['E2'], ['T1'], ['T2'], ['E1', 'T1'], ['E1', 'T2'], ['E2', 'T1'], ['E2', 'T2']]
Source code in exod/post_processing/filter.py
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 | |
filter_subsets
FilterBase
Bases: ABC
Base class for filters. All filters should inherit from this class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the filter. |
required |
Methods:
| Name | Description |
|---|---|
apply |
Apply the filter to the input dataframe. |
get_parameters |
Return a dictionary of filter-specific parameters. |
info |
Return a dictionary with information about the filter. |
Source code in exod/post_processing/filter.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
apply(df)
abstractmethod
This should set self.df_regions, self.df_filtered and self.removed.
Source code in exod/post_processing/filter.py
26 27 28 | |
get_parameters()
abstractmethod
This should return a dictionary of filter-specific parameters.
Source code in exod/post_processing/filter.py
30 31 32 | |
generate_combinations_with_one_or_none(filters)
Generates all combinations of zero or one filter from the given list.
This function creates an iterable that yields combinations of filters, where each combination includes either no filter or exactly one filter from the provided list. The function returns an iterator that produces these combinations on demand.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filters
|
list
|
A list of Filters() to generate combinations from. |
required |
Returns:
| Type | Description |
|---|---|
|
itertools.chain: An iterator yielding tuples that contain either |
|
|
no filters or one filter from the provided list. Each tuple is a |
|
|
valid combination. |
Example
filters = ['filter1', 'filter2'] result = generate_combinations_with_one_or_none(filters) print(list(result))
Output: [(), ('filter1',), ('filter2',)]
Source code in exod/post_processing/filter.py
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | |
generate_valid_combinations(*filter_lists)
Generates all valid combinations of filters from multiple lists, allowing at most one filter from each list.
This function takes multiple lists of filters as input and generates all possible combinations where each combination contains zero or one filter from each list. The Cartesian product of the combinations from each list is computed to create all valid combinations across multiple filter categories.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*filter_lists
|
list of lists
|
Variable number of filter lists. Each argument is a |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
list |
A list of valid filter combinations. Each combination is represented as a list of filters, |
|
|
where the filters are chosen from the input lists. The result includes combinations with zero |
||
|
or one filter from each list. |
Example
filters_energy = ['E1', 'E2'] filters_time = ['T1', 'T2'] result = generate_valid_combinations(filters_energy, filters_time) print(result)
Output: [[], ['E1'], ['E2'], ['T1'], ['T2'], ['E1', 'T1'], ['E1', 'T2'], ['E2', 'T1'], ['E2', 'T2']]
Source code in exod/post_processing/filter.py
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 | |
hot_regions
calc_hot_region_flags(df_regions, df_regions_rotated, hot_regions)
Calculate the hot pixel flags for use on df_regions.
Source code in exod/post_processing/hot_regions.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
get_pointing_angle(obsid, tab_xmm_obslist)
Get the pointing angle for a given observation ID, reads from the xmm_obslist table.
Source code in exod/post_processing/hot_regions.py
68 69 70 71 72 73 | |
plot_detector_coords_soft_and_hard(df_regions_rotated)
Plot the detector coords plots for soft and hard energies.
Source code in exod/post_processing/hot_regions.py
169 170 171 172 173 174 175 176 177 178 179 180 181 | |
plot_hot_regions(df_regions_rotated, hot_regions)
Plot the hot regions and label them.
Source code in exod/post_processing/hot_regions.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
main
check_results_shape()
Check if the length of the results are consistent.
Source code in exod/post_processing/main.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
make_exod_cat
read_and_print_table_and_header(savepath)
Used to checking the file at the end.
Source code in exod/post_processing/make_exod_cat.py
15 16 17 18 19 20 21 22 | |
results_manager
create_iau_srcids(ra_deg, dec_deg, ra_precision=1, dec_precision=0)
Create Source Identifiers from coordinates in degrees (IAU name).
Source code in exod/post_processing/results_manager.py
32 33 34 35 36 37 38 39 40 41 | |
util
calc_detid_column(df_regions)
Calculate the detection id, defined as {runid}_{label}
Source code in exod/post_processing/util.py
13 14 15 16 | |
get_lc(key, df_lc_idx)
label : ('0761070101_0_5_0.2_12.0', '0')
Source code in exod/post_processing/util.py
4 5 6 7 8 9 10 | |
pre_processing
download_observations
download_observation_events(obsid, clobber=False)
Download the post-processed event lists for PN, M1 and M2.
Source code in exod/pre_processing/download_observations.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
event_filtering
Functions to filter events files and create images from the raw data.
Requires having pre-run the sas task 'setsas' and the enviroment variable 'export CCFPATH=' in the terminal.
espfilt(eventfile)
https://xmm-tools.cosmos.esa.int/external/sas/current/doc/espfilt/espfilt.html https://xmm-tools.cosmos.esa.int/external/sas/current/doc/espfilt/node9.html
Source code in exod/pre_processing/event_filtering.py
160 161 162 163 164 165 166 | |
processing
background_inference
calc_background_template(image_sub, image_mask_source)
Calculate the background template for a given image_sub.
This is done by the following
- Remove the sources from the image.
- Calculate the number of counts in the background.
- Inpaint the holes where the sources were.
- Divide the image by the total counts in the background.
We then blur the image and inpaint again, this is to deal with issues where if large sources were removed we can fill them in, we should probably only do this if we need to.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image_sub
|
ndarray
|
Summed image of BTI or GTI frames. |
required |
image_mask_source
|
ndarray
|
Mask of the sources. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
image_sub_background_template |
ndarray
|
The background template for the image subset. |
count_sub_outside_sources |
float
|
The number of counts outside the sources (total counts in background) |
Source code in exod/processing/background_inference.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
calc_cube_mu(data_cube, wcs)
Calculates an expectation (mu) data cube.
Any departure from this cube corresponds to variability.
The background is dealt with by assuming that all GTIs and BTIs follow respective templates (i.e., once each frame is divided by its total counts, they all look the same).
The sources are dealt with assuming they are constant. We take their net emission, and distribute it evenly across all frames.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_cube
|
DataCube
|
DataCube object. |
required |
wcs
|
WCS
|
wcs object. |
required |
Returns: cube_mu (np.ndarray): The expectation (mu) data cube.
Source code in exod/processing/background_inference.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
calc_source_template(image_sub, image_sub_background_template, image_mask_source, data_cube, count_sub_outside_sources, subset_bin_idx)
Calculate the average contribution from the sources in the field of the observation.
This is done by masking out the background and dividing by the effective exposed frames. This essentially gives the image of the average contribution of the sources in each frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image_sub
|
ndarray
|
image of GTI or BTIs obtained by summing the frames. |
required |
image_sub_background_template
|
ndarray
|
The template for the BTI or GTI obtained via calc_background_template. |
required |
image_mask_source
|
ndarray
|
Mask of the sources. |
required |
data_cube
|
DataCube
|
DataCube object. |
required |
count_sub_outside_sources
|
float
|
The number of counts outside the sources (total counts in background). |
required |
subset_bin_idx
|
ndarray
|
The bins corresponding to the subset (either the GTI or BTIs). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
image_source_template |
ndarray
|
The average contribution of the sources in each frame. |
Source code in exod/processing/background_inference.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | |
mask_known_sources(data_cube, wcs)
Mask known sources from the data cube.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_cube
|
DataCube
|
DataCube object. |
required |
wcs
|
WCS
|
wcs object. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
image_mask |
ndarray
|
The mask of the sources. |
Source code in exod/processing/background_inference.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
bayesian_computations
PrecomputeBayesLimits
Source code in exod/processing/bayesian_computations.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | |
__new__(threshold_sigma)
Creates or retrieves an instance of PrecomputeBayesLimits with a specific threshold.
This method implements a multiton pattern, where only one instance of
PrecomputeBayesLimits exists per unique value of threshold_sigma.
When a new threshold value is requested, a new instance is created and stored in
the _instances dictionary, keyed by threshold_sigma. If an instance with the same threshold_sigma
already exists, it is returned instead of creating a new one. https://en.wikipedia.org/wiki/Multiton_pattern
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold_sigma
|
int
|
The significance threshold for the instance. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
PrecomputeBayesLimits |
The existing or newly created instance with the specified |
Source code in exod/processing/bayesian_computations.py
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | |
B_eclipse(n, mu)
Computes the Bayes factors of the presence of an eclipse, given the data_cube (mu) and observed (n) counts
Source code in exod/processing/bayesian_computations.py
18 19 20 | |
B_eclipse_log(n, mu)
Computes the Bayes factors of the presence of an eclipse, given the data_cube (mu) and observed (n) counts
Source code in exod/processing/bayesian_computations.py
28 29 30 | |
B_peak(n, mu)
Computes the Bayes factors of the presence of a peak, given the data_cube (mu) and observed (n) counts.
Source code in exod/processing/bayesian_computations.py
13 14 15 | |
B_peak_log(n, mu)
Computes the Bayes factors of the presence of a peak, given the data_cube (mu) and observed (n) counts.
Source code in exod/processing/bayesian_computations.py
23 24 25 | |
get_bayes_thresholds(threshold_sigma)
The thresholds for B_peak and B_eclipse are calculated here for 3 and 5 sigma.
This is sort of a hack, and is done by finding the value of B(n,mu) that is equal to a given significance (sigma) under the Gaussian assumption at mu=1000.
For example, we want a significance level of sigma = 3. We first find what observed (n) value we need to get a 3 sigma peak Gaussian assumption. n_peak_large_mu(mu=1000, sigma=3) = 1139
Next, we find the value of B_peak that an observed (n) value of 1139 would give us. B_peak(n=1139, mu=1000) = 872908 (5.94 in log10)
We treat this value of B as being "Equivalent" to a 3 sigma detection and subsequently can specify: B > B_threshold_peak for a peak detection B < B_eclipse_threshold for an eclipse detection
Source code in exod/processing/bayesian_computations.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
get_cube_masks_peak_and_eclipse(cube_n, cube_mu, threshold_sigma)
Returns two cubes with booleans where the rate correspond to a peak or an eclipse.
Source code in exod/processing/bayesian_computations.py
108 109 110 111 112 113 114 | |
load_precomputed_bayes1000()
Loads & interpolates the precomputed values of Bayes factors at mu=1000
Source code in exod/processing/bayesian_computations.py
127 128 129 130 131 132 133 | |
load_precomputed_bayes_limits(threshold_sigma)
Loads the precomputed Bayes factor limit numbers, for a chosen threshold.
Source code in exod/processing/bayesian_computations.py
136 137 138 139 140 141 142 | |
n_eclipse_large_mu(mu, sigma)
Calculate the observed (n) value required for an eclipse at a specific expecation (mu) and significance (sigma) in the Gaussian regime.
Source code in exod/processing/bayesian_computations.py
38 39 40 | |
n_peak_large_mu(mu, sigma)
Calculate the observed (n) value required for a peak at a specific expectation (mu) and significance (sigma) in the Gaussian regime.
Source code in exod/processing/bayesian_computations.py
33 34 35 | |
precompute_bayes_1000()
Precomputes the Bayes factor at mu=1000 for a bunch of values of N. Will be interpolated to estimate the sigma
Source code in exod/processing/bayesian_computations.py
116 117 118 119 120 121 122 123 124 | |
precompute_bayes_limits(threshold_sigma)
Compute the minimum and maximum number of observed counts (n) required for an eclipse or peak for a given confidence threshold (threshold_sigma) and expectation (mu).
For counts > 1000, we use a Gaussian approximation. sigma = (N-mu) / (N+mu)^0.5
Solving for N gives: N = 2mu + sigma^2 + (8 mu sigma^2 + sigma^4)^0.5 N = 2mu + sigma^2 - (8 mu sigma^2 + sigma^4)^0.5
The resulting table looks like
i mu n_peak n_eclipse
46000 158.556483 219.0 106.0 46001 158.629519 219.0 107.0 46002 158.702589 219.0 107.0 46003 158.775693 219.0 107.0
Each data cell in the observed and data_cube cube is then compared to the values pre-calculated here to determine if is it a peak or an eclipse.
An example for 1 frame is given here.
(n_cube) (mu_cube) is_3_sig_peak? 0 2 1 0.03 1.98 0.87 F F F 0 5 0 1.01 1.10 1.00 F T F 3 2 1 2.30 2.14 0.98 F F F
The evaluation of each data cell of the cube against a threshold is made faster by precomputing the counts here.
Source code in exod/processing/bayesian_computations.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
sigma_equivalent(n, mu)
Find the equivalent sigma for a given observed (n) and expectation (mu).
For large counts (mu=1000), the required n to obtain a given sigma can be calculated assuming Gaussian statistics. This can be done using the functions: n_peak_large_mu(mu, sigma) and n_eclipse_large_mu(mu, sigma)
For small counts, we cannot use these functions, as we are in the Poisson regime, but we can calculate the Bayes factors for peaks and eclipses, using B_peak_log(n, mu) and B_eclipse_log(n, mu).
We can however for a given value of B, find out what the equivalent value of sigma would be. To do this we need to find the sigma that gives: B_peak(n, mu=1000) = B_peak(n=n_peak_large_mu(mu=1000, sigma), mu=1000)
This is done by finding the root of the function
B_peak(n, mu=1000) - B_peak(n=n_peak_large_mu(mu=1000, sigma), mu=1000) = 0
Source code in exod/processing/bayesian_computations.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | |
sigma_equivalent_B_eclipse(B_eclipse)
Find the equivalent sigma for a given Bayes factor for an eclipse. B_eclipse must be in log!
1.6 < B_eclipse < 42
0.00 < sigma < 9.94
Source code in exod/processing/bayesian_computations.py
215 216 217 218 219 220 221 222 223 224 225 226 227 | |
sigma_equivalent_B_peak(B_peak)
Find the equivalent sigma for a given Bayes factor for a peak. B_Peak must be in log!
1.61 < B_peak < 48.976
0.00 < sigma < 9.98
Source code in exod/processing/bayesian_computations.py
200 201 202 203 204 205 206 207 208 209 210 211 212 | |
bayesian_tests
This module contains functions to test the Bayesian computations in the exod package.
check_estimate_success()
If I remember correctly, it is to assess if the count-rate estimation worked, independently of the value of the quiescent state mu. So, for a range of mu, I add a peak of three different amplitudes, I generate poisson realisations of mu+peak (the crosses), and see the value we can estimate for the peak (the envelopes). You have the residuals at the bottom It might be an earlier version, and not work anymore. It was just to check the success of the rate estimate function
Source code in exod/processing/bayesian_tests.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
plot_B_eclipse()
Plot the eclipse Bayes factor for different observed (n) counts as a function of expecation (mu). Also plot the 3 and 5 sigma threshold values.
Source code in exod/processing/bayesian_tests.py
869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 | |
plot_B_peak()
Plot the peak Bayes factor for different observed (n) counts as a function of expectation (mu). Also plot the 3 and 5 sigma threshold values.
Source code in exod/processing/bayesian_tests.py
834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 | |
bti
Functions to calculate bad time intervals (BTI) for a given lightcurve.
BTIs are defined as time intervals where average count rate the 10.0-12.0 keV energy band exceeds a certain threshold. This threshold is usually set to 0.5 ct/s. However, when combining multiple lightcurves, the threshold can be set to 1.5 ct/s.
get_bti(time, data, threshold)
Get the bad time intervals for a given lightcurve.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time
|
array
|
Time Array. |
required |
data
|
array
|
Data Array. |
required |
threshold
|
float
|
Threshold for bad time intervals. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bti |
list
|
[{'START':500, 'STOP':600}, {'START':700, 'STOP':800}, ...] |
Source code in exod/processing/bti.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
get_bti_bin_idx(bti, bin_t)
Get the indexs corresponding to the bad time intervals for an array of time windows given a set of bad time intervals.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bti
|
list
|
[{'START':300, 'STOP':500}, {'START':600, 'STOP':800}, ...] |
required |
bin_t
|
array
|
Array of time bins. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bti_bin_idx |
array
|
array of indexs corresponding to BTIs. |
Source code in exod/processing/bti.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
get_bti_bin_idx_bool(bti_bin_idx, bin_t)
Get the boolean array mask corresponding to if a time window was a bad time interval or not.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bti_bin_idx
|
array
|
[1,4,6] |
required |
bin_t
|
array
|
[0, 1.5, 2.0, 3.5, 5.0, 6.5, 8.0] |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bti_bin_idx_bool |
array
|
[F,T,F,F,T,F,T,F] |
Source code in exod/processing/bti.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
coordinates
calc_df_regions(image, image_mask)
Return the region dataframe for a given image and mask.
Source code in exod/processing/coordinates.py
73 74 75 76 77 78 79 | |
correct_sky_position(skycoord, data_cube)
Correct the systematic offset due to the gridding.
The change we need needs to be positive in dec and negative in RA, which results in diagonal (UL/NW) position angle correction, corresponding to 360-45=315 degrees.
The angular separation is the diagonal distance from the corner to the center of a pixel thus
(2*(size_arcsec/2)^2)^0.5
Source code in exod/processing/coordinates.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
get_regions_sky_position(data_cube, df_regions, wcs)
Calculate the sky position of the detected regions.
Test coords: observation : 0803990501 1313 X-1 : 03 18 20.00 -66 29 10.9 1313 X-2 : 03 18 22.00 -66 36 04.3 SN 1978K : 03 17 38.62 -66 33 03.4 NGC1313 XMM4 : 03 18 18.46 -66 30 00.2 (lil guy next to x-1)
To calculate the EPIC X and Y coordinates of the variable sources, we use the final coordinates in the variability map, which are not integers. To know to which X and Y correspond to this, we interpolate the values of X and Y on the final coordinates. We divide by 80 because the WCS from the image is binned by x80 compared to X and Y values
Source code in exod/processing/coordinates.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
ra_dec_to_xyz(ra_deg, dec_deg)
Convert RA and DEC to points on the unit sphere.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dec_deg
|
Quantity
|
Declination in degrees. |
required |
ra_deg
|
Quantity
|
Right Ascension in degrees. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
xyz |
ndarray
|
The xyz positions of the points as a (N, 3) array. |
Source code in exod/processing/coordinates.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
rotate_XY(X, Y, angle, pivotXY=(25719, 25719))
Rotates the positions following the pointing angle of the observation, so that the coordinates are in an EPIC frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
array
|
The X sky coordinate from event list. |
required |
Y
|
array
|
The Y sky coordinate from event list. |
required |
angle
|
float
|
The pointing angle of the observation (PA_PNT). |
required |
pivotXY
|
tuple
|
The pivot point for the rotation. |
(25719, 25719)
|
Returns:
| Name | Type | Description |
|---|---|---|
X_EPIC |
array
|
The X sky coordinate in the EPIC frame. |
Y_EPIC |
array
|
The Y sky coordinate in the EPIC frame. |
Source code in exod/processing/coordinates.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
data_cube
DataCube
Class to represent a 3D data cube from XMM data.
Attributes:
| Name | Type | Description |
|---|---|---|
event_list |
EventList
|
EventList object. |
size_arcsec |
float
|
size of one side of a cell in the cube in arcseconds. |
time_interval |
float
|
time interval for each frame in seconds. |
extent |
int
|
Initial Cube Size. |
pixel_size |
float
|
size of one side of a cell in the cube in pixels. |
n_bins |
int
|
Spatial Bins (x,y). |
bin_x |
array
|
Bins for the x-axis. |
bin_y |
array
|
Bins for the y-axis. |
bin_t |
array
|
Bins for the t-axis. |
n_t_bins |
int
|
Number of time bins. |
bti_bin_idx |
array
|
Indexs of the bad time intervals (BTIs) |
bti_bin_idx_bool |
array
|
Boolean Mask of the bad time intervals that can be applied to bin_t |
n_bti_bin |
int
|
Number of bad time intervals bins. |
bti_frac |
float
|
Fraction of bad time intervals. |
gti_bin_idx |
array
|
Indexs of the good time intervals (GTIs) |
gti_bin_idx_bool |
array
|
Boolean Mask of the good time intervals that can be applied to bin_t |
n_gti_bin |
int
|
Number of good time intervals bins. |
gti_frac |
float
|
Fraction of good time intervals. |
bccd_bin_idx |
array
|
Indexs of frames marked as having irregular (bad) CCD exposures. |
bccd_frac |
float
|
Fraction of time frames marked as having bad CCD exposures. |
data |
array
|
3-D numpy array containing the data. |
bbox_img |
tuple
|
Bounding box of the image (single time slice). |
Source code in exod/processing/data_cube.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | |
calc_gti_bti_bins(bti)
Calculate the good and bad time interval indexes & masks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bti
|
dict
|
{['START':344.2, 'STOP':454.2], ...} |
required |
Source code in exod/processing/data_cube.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
copy()
Return a copy of the datacube.
Source code in exod/processing/data_cube.py
80 81 82 | |
crop_data_cube()
Crop the surrounding areas of the data_cube that are empty.
Source code in exod/processing/data_cube.py
101 102 103 104 105 106 107 108 109 110 | |
get_bad_ccd_mask(event_list, plot=False)
Get the mask for the frames corresponding with irregular CCD exposures.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_list
|
EventList
|
EventList object. |
required |
plot
|
bool
|
if True, then plot. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
bccd_bin_idx_bool |
array
|
Array of bools indicating the frames with irregular CCD exposures. |
Source code in exod/processing/data_cube.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | |
get_cube_bbox()
Get the Bounding Box corresponding to the cube's image plane.
Source code in exod/processing/data_cube.py
112 113 114 115 116 117 | |
mask_frames_with_partial_ccd_exposure(mask_frames=True, plot=False)
Remove the frames with irregular exposures between CCDs.
https://xmm-tools.cosmos.esa.int/external/xmm_user_support/documentation/uhb/pnchipgeom.html https://xmm-tools.cosmos.esa.int/external/xmm_user_support/documentation/uhb/moschipgeom.html
Test Cases: 0165560101, 0765080801, 0116700301, 0765080801, 0872390901, 0116700301 0201900201, 0724840301, 0743700201
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mask_frames
|
bool
|
If True mask the frames. |
True
|
plot
|
bool
|
If True plot diagnostics. |
False
|
Source code in exod/processing/data_cube.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
multiply_time_interval(n_factor)
Used to increase the time_interval by a factor of n_factor, in order to quickly scan different timescales.
Source code in exod/processing/data_cube.py
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | |
remove_bti_frames()
Return the cube without the masked nan frames.
Source code in exod/processing/data_cube.py
143 144 145 146 | |
video(savepath=None)
Play each frame of the datacube sequentially in a matplotlib figure.
Source code in exod/processing/data_cube.py
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | |
extract_lc(data_cube, xhi, xlo, yhi, ylo, dtype=np.int32)
Extract a lightcurve from a data cube by summing through a bounding box.
Source code in exod/processing/data_cube.py
329 330 331 332 333 | |
detector
Detector
Obsolete detector class that re-implements the method used in Inés Pastor-Marazuela (2020) See: https://arxiv.org/abs/2005.08673
Source code in exod/processing/detector.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | |
calc_extraction_threshold(sigma)
Calculate the extraction threshold for a given sigma value.
Source code in exod/processing/detector.py
85 86 87 88 | |
calc_image_var()
Calculate the variability image from a data cube.
Source code in exod/processing/detector.py
61 62 63 64 65 66 67 68 69 70 | |
conv_var_img(box_size=3)
Convolve the variability image with a box kernel.
Source code in exod/processing/detector.py
72 73 74 75 76 77 78 79 80 81 82 83 | |
extract_var_regions(sigma=5)
Use skimage to obtain the contiguous regions in the variability image.
We currently used the weighted centroid which calculates a centroid based on both the size of the bounding box and the values of the pixels themselves.
https://scikit-image.org/docs/stable/auto_examples/segmentation/index.html
Returns
df_regions : DataFrame of Detected Regions
Source code in exod/processing/detector.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
get_region_lightcurves()
Extract the lightcurves from the variable regions found. Returns
df_lc : DataFrame of Lightcurves
Source code in exod/processing/detector.py
148 149 150 151 152 153 154 155 156 | |
objective_function(sigma, image, n_target_regions)
Function used for optimising sigma detection threshold.
Source code in exod/processing/detector.py
118 119 120 121 122 123 124 125 126 | |
optimise_sigma(image, n_target_regions, sigma_bounds=(0.1, 20.0))
Find the optimal value of sigma to get n_target regions.
Source code in exod/processing/detector.py
128 129 130 131 132 | |
calc_ks_poission(lc)
Calculate the KS Probability assuming the lightcurve was created from a Poisson distribution with the mean of the lightcurve.
Source code in exod/processing/detector.py
281 282 283 284 285 286 287 288 289 290 291 292 293 | |
plot_image_with_regions(image, df_regions, cbar_label=None, savepath=None)
Plot the variability image with the bounding boxes of the detected regions.
Parameters
image : np.ndarray : Variability Image (or Likelihood Image) df_regions : pd.DataFrame : from extract_variability_regions cbar_label : string : Label for colorbar savepath : str : Path to save the figure to
Source code in exod/processing/detector.py
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
plot_region_lightcurve(df_lcs, i, savepath=None)
Plot the ith region lightcurve.
Source code in exod/processing/detector.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
pipeline
Pipeline
Pipeline to process a single XMM-Newton observation and find variable sources.
Attributes:
obsid (str): Observation ID.
size_arcsec (float): Size of the binned pixels in arcseconds.
time_interval (int): Time interval in seconds.
gti_only (bool): Use only Good Time Intervals.
remove_partial_ccd_frames (bool): Remove partial CCD frames.
min_energy (float): Minimum energy in keV.
max_energy (float): Maximum energy in keV.
clobber (bool): Overwrite existing files.
threshold_sigma (float): Sigma threshold for variability detection.
precomputed_bayes_limit (PrecomputeBayesLimits): Precomputed Bayes Limits object.
observation (Observation): Observation object.
runid (str): Unique identifier for the run.
event_list (EventList): EventList() object.
data_cube (XMMDataCube): XMMDataCube() object containing the number of photons in each cell.
subset_number (int): The subset number.
total_subsets (int): Total number of subsets.
gti_threshold (float): Threshold for Good Time Intervals.
n_regions (int): Number of regions detected.
savedir (Path): Directory to save results to.
Source code in exod/processing/pipeline.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | |
calculate_bti()
Calculate the bad time intervals (BTI) based upon the lightcurve from the eventlist and the threshold.
Source code in exod/processing/pipeline.py
170 171 172 173 174 175 | |
filter_events_from_significant_cells(df_alerts, event_list)
Extract the events in the events list for each significant cell.
Source code in exod/processing/pipeline.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
generate_runid()
Generate a unique runid of the form 0765080801_0_50_0.2_12.0
Source code in exod/processing/pipeline.py
77 78 79 80 81 | |
get_significant_cells(cube_mask_peaks, cube_mask_eclipses, cube_n)
Extract information for each pixel in the datacube that is associated with an alert.
Source code in exod/processing/pipeline.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | |
get_significant_pixels_from_cells(df_significant_cells)
Extract the unique x,y values (2D Pixels) from the significant (3D) cells.
Source code in exod/processing/pipeline.py
184 185 186 187 188 189 | |
load_results()
Load results for all observation subsets, returns a list of dictionaries.
Source code in exod/processing/pipeline.py
317 318 319 320 | |
load_subset_results(subset_number)
Load results for a single observation subset. returns a dictionary.
Source code in exod/processing/pipeline.py
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | |
pre_process()
Pre-process the data.
Source code in exod/processing/pipeline.py
90 91 92 93 94 95 96 97 98 | |
set_savedir()
Create the directory to save results to.
Source code in exod/processing/pipeline.py
83 84 85 86 87 88 | |
combine_results(obsids)
Get the results for each of the observations ids and combine them into joint dataframes and save them into their respective paths in exod.utils.path.data_combined.
Will raise an error if there are already files data_combined, to avoid accidentally deleting data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obsids
|
list
|
list of observation IDs |
required |
Source code in exod/processing/pipeline.py
548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | |
make_df_lc_idx(df_lc)
Calculate the start and end indexs of each of the lightcurves. This is done so that a specific runid + label combination can be quickly accessed.
Source code in exod/processing/pipeline.py
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 | |
parameter_grid(obsids)
usage: for params in parameter_grid(['0792180301', '0792180302', ...]: print(params) pipeline = Pipeline(**params)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obsids
|
list
|
list of obsids |
required |
Returns params (dict): parameters for a run.
Source code in exod/processing/pipeline.py
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 | |
plot_pixel_lc(cube_mu, cube_n, x, y, plot=True)
Plot the lightcurve for a specific pixel (x,y), shows the three and five sigma error regions.
Source code in exod/processing/pipeline.py
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | |
utils
path
check_file_exists(file_path, clobber=True)
Check if a file exists and raise FileExistsError if clobber is False.
Parameters: - file_path (str or Path): The path to the file. - clobber (bool): If True, overwrite the file if it exists.
Raises: - FileExistsError: If the file exists and clobber is False.
Source code in exod/utils/path.py
68 69 70 71 72 73 74 75 76 77 78 79 80 | |
create_all_paths()
Create all paths if they don't exist.
Source code in exod/utils/path.py
62 63 64 65 | |
read_observation_ids(file_path)
Read observation IDs from file. Each line should be a single observation.
Source code in exod/utils/path.py
83 84 85 86 87 88 89 90 | |
plotting
cmap_image()
Colormap used in production of images.
Source code in exod/utils/plotting.py
32 33 34 35 36 | |
compare_images(images, titles, log=False, plot=False)
Creates a slideshow of multiple 2D numpy arrays of the same size. Args: images (list of np.ndarray): list of numpy arrays titles (list): titles of images log (bool): use Log normalisation for image plots. plot (bool): switch to disable or enable plotting.
Source code in exod/utils/plotting.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
fig2data_url(fig)
Convert a matplotlib Figure() to a base64 png data url (for use in a html tag)
Source code in exod/utils/plotting.py
301 302 303 304 305 306 307 | |
get_image_limits(image)
Get the x and y limits of the non-zero pixels in an image.
Source code in exod/utils/plotting.py
265 266 267 268 269 270 271 272 273 274 275 | |
interactive_scatter_with_rectangles(x_data, y_data)
Plot x and y data, allowing the user to interactively select rectangles. Prints the (x, y, width, height) of the selected rectangle in the terminal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_data
|
array
|
the x coordinates of the scatter data. |
required |
y_data
|
array
|
the y coordinates of the scatter data. |
required |
Source code in exod/utils/plotting.py
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | |
plot_3d_image(image)
Plot an image as a 3D surface
Source code in exod/utils/plotting.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
plot_aitoff(ra_deg, dec_deg, savepath=None, color='grey', title=None)
Plot ra and dec coordinates on an aitoff plot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ra_deg
|
list
|
ras in degrees. |
required |
dec_deg
|
list
|
decs in degrees. |
required |
savepath
|
str or Path
|
savepath for plot. |
None
|
color
|
str
|
color for the marker points. |
'grey'
|
title
|
str
|
Title for the plot. |
None
|
Source code in exod/utils/plotting.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
plot_aitoff_density(ra_deg, dec_deg, savepath=None)
Plot ra and dec coordinates on an aitoff plot and color them by spatial density.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ra_deg
|
list
|
ras in degrees. |
required |
dec_deg
|
list
|
decs in degrees. |
required |
savepath
|
str or Path
|
savepath for plot. |
None
|
Source code in exod/utils/plotting.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | |
plot_cube_statistics(data)
Plot various first order functions for a 3-dimensional data cube.
Source code in exod/utils/plotting.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
plot_event_list_ccds(table)
Plot the images for each CCD for a given eventlist.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table
|
Table
|
Event List Table. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
fig |
Figure
|
Figure with each subplots containing the image for the specific CCD. |
Source code in exod/utils/plotting.py
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | |
plot_frame_masks(instrum, masks, labels, plot=False)
Helper function to view which frames were masked during processing making of the data cube.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instrum
|
str
|
Name of the instruement. |
required |
masks
|
list of np.arrays
|
list of masks (true/false arrays) corresponding |
required |
labels(list
|
of str
|
labels for each mask. |
required |
plot
|
bool
|
switch for turn on/off plotting |
False
|
Source code in exod/utils/plotting.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
plot_image(image_arr, title, log=False)
Plot a 2D numpy array as an image.
Source code in exod/utils/plotting.py
39 40 41 42 43 44 45 46 47 48 49 50 | |
set_latex_font()
Set matplotlib global font to STIX (same as latex).
Source code in exod/utils/plotting.py
26 27 28 29 | |
use_scienceplots()
Use the scienceplots module for matplotlib plots.
Source code in exod/utils/plotting.py
18 19 20 21 22 23 24 | |
synthetic_data
check_synthetic_peak_counts_diff(obsid)
Evaluate differences in peak counts for synthetic bursts added to XMM-Newton data cubes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obsid
|
str
|
XMM Observation ID |
required |
Source code in exod/utils/synthetic_data.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | |
create_fake_Nbins_burst(data_cube, x_pos, y_pos, time_peak_fractions, amplitude)
Create Many fake bursts in the data cube
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_cube
|
DataCube
|
DataCube() Object. |
required |
x_pos
|
int
|
x position of the burst. |
required |
y_pos
|
int
|
y position of the burst. |
required |
time_peak_fractions
|
list
|
list of time fractions where the bursts should be placed. |
required |
amplitude
|
int
|
Height of burst. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
peak_data |
array
|
Same size as data_cube with burst data. |
Source code in exod/utils/synthetic_data.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
create_fake_burst(data_cube, x_pos, y_pos, time_peak_fraction, width_time, amplitude)
Create a fake burst in the data_cube at position x_pos, y_pos, at time_peak_fraction of the time axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_cube
|
DataCube
|
DataCube() Object. |
required |
x_pos
|
int
|
x position of the burst. |
required |
y_pos
|
int
|
y position of the burst. |
required |
time_peak_fraction
|
float
|
0.0 - 1.0. |
required |
width_time
|
float
|
how long the burst lasts in seconds. |
required |
amplitude
|
int
|
Height of burst. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
peak_data |
array
|
Same size as data_cube with burst data. |
Source code in exod/utils/synthetic_data.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |
create_fake_eclipse(data_cube, x_pos, y_pos, time_peak_fraction, width_time, amplitude, constant_level)
Create a fake eclipse in the data_cube at position x_pos, y_pos, at time_peak_fraction of the time axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_cube
|
DataCube
|
DataCube() Object. |
required |
x_pos
|
int
|
x position of the burst. |
required |
y_pos
|
int
|
y position of the burst. |
required |
time_peak_fraction
|
float
|
0.0 - 1.0. |
required |
width_time
|
float
|
how long the Eclispe lasts in seconds. |
required |
amplitude
|
int
|
Amplitude of Eclipse |
required |
Returns:
| Name | Type | Description |
|---|---|---|
peak_data |
array
|
Same size as data_cube with Eclipse data. |
Source code in exod/utils/synthetic_data.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
create_fake_onebin_burst(data_cube, x_pos, y_pos, time_peak_fraction, amplitude)
Create a fake burst in the data_cube at position x_pos, y_pos, at time_peak_fraction of the time axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_cube
|
DataCube
|
DataCube() Object. |
required |
x_pos
|
int
|
x position of the burst. |
required |
y_pos
|
int
|
y position of the burst. |
required |
time_peak_fraction
|
float
|
0.0 - 1.0. |
required |
amplitude
|
int
|
Height of burst. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
peak_data |
array
|
Same size as data_cube with burst data. |
Source code in exod/utils/synthetic_data.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
create_multiple_fake_eclipses(data_cube, tab_x_pos, tab_y_pos, tab_time_peak_fraction, tab_width_time, tab_amplitude, tab_constant_level)
Create Many fake eclipses in the data cube
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_cube
|
DataCube
|
DataCube() Object. |
required |
tab_x_pos
|
list
|
list of x positions of the Eclipses. |
required |
tab_y_pos
|
list
|
list of y positions of the Eclipses. |
required |
tab_time_peak_fraction
|
list
|
list of time fractions where the Eclipses should be placed. |
required |
tab_width_time
|
list
|
list of how long the Eclipses lasts in seconds. |
required |
tab_amplitude
|
list
|
list of amplitudes of Eclipses |
required |
Returns:
| Name | Type | Description |
|---|---|---|
peak_data |
array
|
Same size as data_cube with Eclipse data. |
Source code in exod/utils/synthetic_data.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | |
util
save_result(key, value, runid, savedir)
Save a label/value pair to a .csv file.
Source code in exod/utils/util.py
38 39 40 41 42 43 44 45 46 47 48 49 50 | |
xmm
bad_obs
These observations are those that contained the most alerts using EXOD.
I have gone through them all and manually selected those that are a result of bad data, in a lot of cases, many spurious alerts are generated by the presence of extended sources, such as galaxy clusters or supernova remnants.
event_list
EventList
Class for handling EventList objects.
Attributes:
| Name | Type | Description |
|---|---|---|
path |
Path
|
Path to the event list file. |
filename |
str
|
Name of the event list file. |
data |
Table
|
Data from the event list file. |
is_read |
bool
|
Flag indicating if the event list file has been read. |
is_merged |
bool
|
Flag indicating if the event list is a merged one. |
Methods:
| Name | Description |
|---|---|
read |
Reads the event list file and extracts necessary information. |
from_event_lists |
Creates a merged EventList from a list of existing ones. |
filter_by_energy |
Filters the event list data by energy range. |
check_submode |
Checks if the submode of the event list is supported. |
is_supported_submode |
Returns if the submode of the event list is supported. |
remove_MOS_central_ccd |
Removes the central CCD of MOS if not in PrimeFullWindow. |
remove_bad_rows |
Removes bad PN rows as per Struder et al. 2001b. |
remove_borders |
Removes borders from the event list data. |
get_ccd_bins |
Gets the CCD bins for the instrument. |
unload_data |
Unloads the data from the event list to save memory. |
info |
Returns a dictionary containing information about the event list. |
Source code in exod/xmm/event_list.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
from_event_lists(event_lists)
classmethod
Create a merged event list from a list of existing ones. Args: event_lists (list): list of EventList() objects. Returns: event_list (EventList): New merged eventlist object.
Source code in exod/xmm/event_list.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
get_ccd_bins()
Get the CCD bins for the instrument. This is used in calculating the bad CCD bins.
Source code in exod/xmm/event_list.py
208 209 210 211 212 | |
remove_borders()
For PN the RAWY is the long axis. The removal of 1px from each side gets rid of the weird hot-spot that appears between two of the CCDs.
PrimeFullWindow PrimeLargeWindow PrimeSmallWindow & PrimeFullWindowExtended RAWY MAX: 200 RAWY MAX: 200 RAWY MAX: 200 RAWY MIN: 13 RAWY MIN: 102 RAWY MIN: 137 RAWX MAX: 64 RAWX MAX: 64 RAWX MAX: 64 RAWX MIN: 1 RAWX MIN: 1 RAWX MIN: 1
Source code in exod/xmm/event_list.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | |
remove_hot_pixels()
Remove hot pixels from the event list data.
Source code in exod/xmm/event_list.py
167 168 169 170 171 172 173 174 175 176 177 178 179 | |
observation
Observation
Class for handling XMM-Newton observations.
Attributes:
| Name | Type | Description |
|---|---|---|
obsid |
str
|
The observation ID. |
path_raw |
Path
|
Path to the raw data directory (unprocessed). |
path_processed |
Path
|
Path to the processed data directory (filtered). |
path_results |
Path
|
Path to the results directory. |
events_raw |
list
|
List of raw event lists. |
events_processed |
list
|
List of processed event lists. |
events_processed_pn |
list
|
List of processed PN event lists. |
events_processed_mos1 |
list
|
List of processed MOS1 event lists. |
events_processed_mos2 |
list
|
List of processed MOS2 event lists. |
events_overlapping_subsets |
list
|
List of overlapping event list subsets. |
images |
list
|
List of images. |
source_list |
list
|
List of source lists (OMSMLI files). |
Source code in exod/xmm/observation.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |
get_events_overlapping_subsets()
Get the overlapping eventlists for a given observation.
Returns the subsets as a list of lists [[001PI.fits, 001M1.fits, 001M2.fits], [002PI.fits, 002M1.fits, 002M2.fits]]
Source code in exod/xmm/observation.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
get_overlapping_eventlist_subsets(event_lists)
Return the overlapping eventlists for a given observation. Parameters: event_lists (list): list of EventList() objects that have been .read()
In most cases this will just return a list of 1 list like [[M1.fits, M2.fits, PN.fits'] with the event files. However, for some observations it will return multiple entires if there have been multiple seperate observations. This function will return all the overlapping subsets. e.g. for 2 subsets this will return: [[],[]]
Source code in exod/xmm/observation.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | |