arrakis.makecat =============== .. py:module:: arrakis.makecat .. autoapi-nested-parse:: Make an Arrakis catalogue .. !! processed by numpydoc !! Attributes ---------- .. autoapisummary:: arrakis.makecat.TQDM_OUT Classes ------- .. autoapisummary:: arrakis.makecat.SpectralIndices Functions --------- .. autoapisummary:: arrakis.makecat.add_metadata arrakis.makecat.cat_parser arrakis.makecat.cli arrakis.makecat.combine arrakis.makecat.compute_local_rm_flag arrakis.makecat.cuts_and_flags arrakis.makecat.fix_blank_units arrakis.makecat.flag_blended_components arrakis.makecat.get_alpha arrakis.makecat.get_fit_func arrakis.makecat.get_integration_time arrakis.makecat.is_leakage arrakis.makecat.lognorm_from_percentiles arrakis.makecat.main arrakis.makecat.replace_nans arrakis.makecat.sigma_add_fix arrakis.makecat.update_tile_separations arrakis.makecat.write_votable Module Contents --------------- .. py:class:: SpectralIndices Bases: :py:obj:`NamedTuple` .. py:attribute:: alphas :type: numpy.ndarray .. py:attribute:: alphas_err :type: numpy.ndarray .. py:attribute:: betas :type: numpy.ndarray .. py:attribute:: betas_err :type: numpy.ndarray .. py:function:: add_metadata(vo_table: astropy.io.votable.tree.VOTableFile, filename: str) Add metadata to VO Table for CASDA :Parameters: **vo_table** (*vot*) -- VO Table object :returns: VO Table object with metadata :rtype: vot .. !! processed by numpydoc !! .. py:function:: cat_parser(parent_parser: bool = False) -> argparse.ArgumentParser .. py:function:: cli() Command-line interface .. !! processed by numpydoc !! .. py:function:: combine(data: arrakis.utils.typing.ArrayLike) -> tuple[arrakis.utils.typing.ArrayLike, arrakis.utils.typing.ArrayLike] Return all combinations of data with itself :Parameters: **data** (*ArrayLike*) -- Data to combine. :returns: Data_1 matched with Data_2 :rtype: Tuple[ArrayLike, ArrayLike] .. !! processed by numpydoc !! .. py:function:: compute_local_rm_flag(good_cat: astropy.table.Table, big_cat: astropy.table.Table) -> astropy.table.Table Compute the local RM flag :Parameters: * **good_cat** (*Table*) -- Table with just good RMs * **big_cat** (*Table*) -- Overall table :returns: Table with local RM flag :rtype: Table .. !! processed by numpydoc !! .. py:function:: cuts_and_flags(cat: arrakis.utils.typing.TableLike, leakage_degree: int = 4, leakage_bins: int = 16, leakage_snr: float = 30.0) -> arrakis.utils.typing.TableLike Cut out bad sources, and add flag columns A flag of 'True' means the source is bad. :Parameters: **cat** (*rmt*) -- Catalogue to cut and flag .. !! processed by numpydoc !! .. py:function:: fix_blank_units(rmtab: arrakis.utils.typing.TableLike) -> arrakis.utils.typing.TableLike Fix blank units in table :Parameters: **rmtab** (*TableLike*) -- TableLike .. !! processed by numpydoc !! .. py:function:: flag_blended_components(cat: arrakis.utils.typing.TableLike) -> arrakis.utils.typing.TableLike Identify blended components in a catalogue and flag them. :Parameters: **cat** (*TableLike*) -- Input catalogue :returns: Output catalogue with minor components flagged :rtype: TableLike .. !! processed by numpydoc !! .. py:function:: get_alpha(cat: arrakis.utils.typing.TableLike) -> SpectralIndices .. py:function:: get_fit_func(tab: arrakis.utils.typing.TableLike, nbins: int = 21, offset: float = 0.002, degree: int = 2, do_plot: bool = False, high_snr_cut: float = 30.0) -> tuple[Callable, matplotlib.pyplot.Figure] Fit an envelope to define leakage sources :Parameters: * **tab** (*TableLike*) -- Catalogue to fit * **nbins** (*int, optional*) -- Number of bins along separation axis. Defaults to 21. :returns: 3rd order polynomial fit. :rtype: Callable .. !! processed by numpydoc !! .. py:function:: get_integration_time(cat: rmtable.RMTable, field_col: pymongo.collection.Collection, sbid: int | None = None) .. py:function:: is_leakage(frac: float, sep: float, fit: Callable) -> bool Determine if a source is leakage :Parameters: * **frac** (*float*) -- Polarised fraction * **sep** (*float*) -- Separation from tile centre * **fit** (*function*) -- Fitting function :returns: True if source is leakage :rtype: bool .. !! processed by numpydoc !! .. py:function:: lognorm_from_percentiles(x1, p1, x2, p2) Return a log-normal distribution X parametrized by: P(X < p1) = x1 P(X < p2) = x2 .. !! processed by numpydoc !! .. py:function:: main(field: str, host: str, epoch: int, sbid: int | None = None, leakage_degree: int = 4, leakage_bins: int = 16, leakage_snr: float = 30.0, username: str | None = None, password: str | None = None, outfile: str | None = None) -> None Make a catalogue from the Arrakis database flow :Parameters: * **field** (*str*) -- RACS field name * **host** (*str*) -- MongoDB host IP * **username** (*str, optional*) -- Mongo username. Defaults to None. * **password** (*str, optional*) -- Mongo password. Defaults to None. * **outfile** (*str, optional*) -- Output file name. Defaults to None. * **cat_format** (*str, optional*) -- Type of catalogue .e.g. fits. Defaults to None. .. !! processed by numpydoc !! .. py:function:: replace_nans(filename: str) Replace NaNs in a XML table with a string :Parameters: **filename** (*str*) -- File name .. !! processed by numpydoc !! .. py:function:: sigma_add_fix(tab: arrakis.utils.typing.TableLike) -> arrakis.utils.typing.TableLike .. py:function:: update_tile_separations(rmtab: arrakis.utils.typing.TableLike, field_col: pymongo.collection.Collection) -> arrakis.utils.typing.TableLike Update the tile separations in the catalogue :Parameters: * **rmtab** (*TableLike*) -- Table to update * **field_col** (*Collection*) -- Field collection :returns: Updated table :rtype: TableLike .. !! processed by numpydoc !! .. py:function:: write_votable(rmtab: arrakis.utils.typing.TableLike, outfile: str) -> None .. py:data:: TQDM_OUT