opticam.analysis.differential_photometer

Classes

DifferentialPhotometer

Helper class for creating relative light curves from OPTICAM data.

Functions

filter_dataframes_to_common_time_column(target_df, ...)

Get the matching times between a target data frame (light curve) and a list of comparison data frames (light

transform_IDs(out_directory, ref_coords, ...)

Module Contents

class opticam.analysis.differential_photometer.DifferentialPhotometer(out_directory, show_plots=True)

Helper class for creating relative light curves from OPTICAM data.

Parameters:
  • out_directory (str)

  • show_plots (bool)

out_directory
show_plots = True
filters
t_ref
time_key = 'BMJD'
catalogs
get_relative_light_curve(fltr, target, comparisons, phot_label, prefix=None, match_other_cameras=False, show_diagnostics=True)

Compute the relative light curve for a target source with respect to one or more comparison sources. By default, the relative light curve is computed for a single filter. The relative light curve is saved to out_directory/relative_light_curves. To automatically match the target and comparison sources across the other two filters, set match_other_cameras to True. Note that this can incorrectly match sources, so it is recommended to manually check the results.

Parameters

fltrstr

The filter to compute the relative light curve for.

targetint

The catalog ID of the target source.

comparisonsint | List[int]

The catalog ID(s) of the comparison source(s).

phot_labelstr

The photometry label, used for file reading and labelling.

prefixstr, optional

The prefix to use when saving the relative light curve (e.g., the target star’s name), by default None.

match_other_camerasbool, optional

Whether to match the target and comparison(s) IDs to the remaining catalog filters, by default False. If True, astroalign must be installed.

show_diagnosticsbool, optional

Whether to show diagnostic plots, by default True.

Returns

Analyzer

An Analyzer object containing the relative light curve(s).

Parameters:
  • fltr (str)

  • target (int)

  • comparisons (int | List[int])

  • phot_label (str)

  • prefix (str | None)

  • match_other_cameras (bool)

  • show_diagnostics (bool)

Return type:

opticam.analysis.analyzer.Analyzer

_compute_relative_light_curve(fltr, target, comparisons, prefix, phot_label, show_diagnostics)

Compute the relative light curve for a target source with respect to one or more comparison sources for a given filter.

Parameters

fltrstr

The filter to compute the relative light curve for.

targetint

The catalog ID of the target source.

comparisonsList[int]

The catalog ID(s) of the comparison source(s).

prefixstr | None

The prefix to use when saving the relative light curve (e.g., the target star’s name), by default None.

phot_labelstr

The photometry label, used for file reading and labelling.

show_diagnosticsbool

Whether to show diagnostic plots, by default True.

Returns

Lightcurve | None

The relative light curve for the target source with respect to the comparison sources, or None if the light curve could not be computed.

Parameters:
  • fltr (str)

  • target (int)

  • comparisons (List[int])

  • prefix (str | None)

  • phot_label (str)

  • show_diagnostics (bool)

Return type:

stingray.Lightcurve | None

_plot_relative_light_curve(relative_light_curve, target, comparisons, prefix, fltr, phot_label, ax=None)

Plot the relative light curve for a target source with respect to one or more comparison sources for a given filter.

Parameters

relative_light_curveLightcurve

The relative light curve to plot.

targetint

The catalog ID of the target source.

comparisonsList[int]

The catalog ID(s) of the comparison source(s).

prefixstr | None

The prefix to use when saving the relative light curve (e.g., the target star’s name), by default None.

fltrstr

The filter to plot the relative light curve for.

phot_labelstr

The photometry label, used for file reading and labelling.

axAxes, optional

The axes to plot the relative light curve on, by default None. If None, a new figure and axes will be created.

Parameters:
  • relative_light_curve (stingray.Lightcurve)

  • target (int)

  • comparisons (List[int])

  • prefix (str | None)

  • fltr (str)

  • phot_label (str)

  • ax (matplotlib.axes.Axes | None)

Return type:

None

_plot_diag(fltr, comparison1, comparison2, comparison1_df, comparison2_df, phot_label, show)

Plot the relative diagnostic light curve for two comparison sources for a given filter.

Parameters

fltrstr

The filter to compute the relative light curve.

comparison1int

The catalog ID of the first comparison source.

comparison2int

The catalog ID of the second comparison source.

comparison1_dfpd.DataFrame

The data frame of the first comparison source.

comparison2_dfpd.DataFrame

The data frame of the second comparison source.

pho_labelstr

The photometry label.

t_reffloat

The time of the earliest observation (used for plotting the relative light curve in seconds from t_ref).

showbool

Whether to show the diagnostic plot.

Parameters:
  • fltr (str)

  • comparison1 (int)

  • comparison2 (int)

  • comparison1_df (pandas.DataFrame)

  • comparison2_df (pandas.DataFrame)

  • phot_label (str)

  • show (bool)

Return type:

None

opticam.analysis.differential_photometer.filter_dataframes_to_common_time_column(target_df, comp_dfs, time_key)

Get the matching times between a target data frame (light curve) and a list of comparison data frames (light curves).

Parameters

target_dfpd.DataFrame

The data frame of the target source.

comp_dfsList[pd.DataFrame]

The list of data frames of the comparison sources.

time_keystr,

The time key (either BMJD or MJD depending on whether Barycentric corrections were applied).

Returns

Tuple[pd.DataFrame, List[pd.DataFrame]]

The filtered target data frame and the list of filtered comparison data frames.

Parameters:
  • target_df (pandas.DataFrame)

  • comp_dfs (List[pandas.DataFrame])

  • time_key (str)

Return type:

Tuple[pandas.DataFrame, List[pandas.DataFrame]]

opticam.analysis.differential_photometer.transform_IDs(out_directory, ref_coords, ref_target_coords, ref_comparison_coords, fltr)
Parameters:
  • out_directory (str)

  • ref_coords (numpy.typing.NDArray)

  • ref_target_coords (numpy.typing.NDArray)

  • ref_comparison_coords (List[numpy.typing.NDArray])

  • fltr (str)

Return type:

Tuple[int, List[int]]