opticam.analysis.differential_photometer ======================================== .. py:module:: opticam.analysis.differential_photometer Classes ------- .. autoapisummary:: opticam.analysis.differential_photometer.DifferentialPhotometer Functions --------- .. autoapisummary:: opticam.analysis.differential_photometer.filter_dataframes_to_common_time_column opticam.analysis.differential_photometer.transform_IDs Module Contents --------------- .. py:class:: DifferentialPhotometer(out_directory, show_plots = True) Helper class for creating relative light curves from OPTICAM data. .. py:attribute:: out_directory .. py:attribute:: show_plots :value: True .. py:attribute:: filters .. py:attribute:: t_ref .. py:attribute:: time_key :value: 'BMJD' .. py:attribute:: catalogs .. py:method:: 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 ---------- fltr : str The filter to compute the relative light curve for. target : int The catalog ID of the target source. comparisons : int | List[int] The catalog ID(s) of the comparison source(s). phot_label : str The photometry label, used for file reading and labelling. prefix : str, optional The prefix to use when saving the relative light curve (e.g., the target star's name), by default None. match_other_cameras : bool, 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_diagnostics : bool, optional Whether to show diagnostic plots, by default True. Returns ------- Analyzer An Analyzer object containing the relative light curve(s). .. py:method:: _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 ---------- fltr : str The filter to compute the relative light curve for. target : int The catalog ID of the target source. comparisons : List[int] The catalog ID(s) of the comparison source(s). prefix : str | None The prefix to use when saving the relative light curve (e.g., the target star's name), by default None. phot_label : str The photometry label, used for file reading and labelling. show_diagnostics : bool 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. .. py:method:: _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_curve : Lightcurve The relative light curve to plot. target : int The catalog ID of the target source. comparisons : List[int] The catalog ID(s) of the comparison source(s). prefix : str | None The prefix to use when saving the relative light curve (e.g., the target star's name), by default None. fltr : str The filter to plot the relative light curve for. phot_label : str The photometry label, used for file reading and labelling. ax : Axes, optional The axes to plot the relative light curve on, by default None. If None, a new figure and axes will be created. .. py:method:: _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 ---------- fltr : str The filter to compute the relative light curve. comparison1 : int The catalog ID of the first comparison source. comparison2 : int The catalog ID of the second comparison source. comparison1_df : pd.DataFrame The data frame of the first comparison source. comparison2_df : pd.DataFrame The data frame of the second comparison source. pho_label : str The photometry label. t_ref : float The time of the earliest observation (used for plotting the relative light curve in seconds from t_ref). show : bool Whether to show the diagnostic plot. .. py:function:: 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_df : pd.DataFrame The data frame of the target source. comp_dfs : List[pd.DataFrame] The list of data frames of the comparison sources. time_key : str, 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. .. py:function:: transform_IDs(out_directory, ref_coords, ref_target_coords, ref_comparison_coords, fltr)