arrakis.init_database
Create the Arrakis database
Attributes
Functions
|
Insert beams into the database |
|
Get the beam information |
|
Find the separations between sources in the master catalogue and the RACS beams |
|
Command-line interface |
|
Reset and load the field database |
|
Get beams from the master catalogue |
|
Get the RACS catalogue for a given epoch |
|
Main script |
|
Find the N-dimensional array of indices of the unique values in x |
|
Read the RACS database from CSVs or postgresql |
|
Find RACS beams that contain a given source position |
|
Insert sources into the database |
Module Contents
- arrakis.init_database.beam_database(database_path: pathlib.Path, islandcat: astropy.table.Table, host: str, epoch: int, username: str | None = None, password: str | None = None) pymongo.results.InsertManyResult [source]
Insert beams into the database
- Parameters:
islandcat (Table) – Island catalogue table.
host (str) – MongoDB host IP.
username (str, optional) – Mongo username. Defaults to None.
password (str, optional) – Mongo host. Defaults to None.
epoch (int, optional) – RACS epoch to use. Defaults to 0.
- Returns:
Result of the insert.
- Return type:
InsertManyResult
- arrakis.init_database.beam_inf(database: astropy.table.Table, survey_dir: pathlib.Path, host: str, epoch: int, username: str | None = None, password: str | None = None) pymongo.results.InsertManyResult [source]
Get the beam information
- arrakis.init_database.cat2beams(mastercat: astropy.table.Table, database: astropy.table.Table, max_sep: float = 1) Tuple[numpy.ndarray, numpy.ndarray, astropy.coordinates.Angle] [source]
Find the separations between sources in the master catalogue and the RACS beams
- Parameters:
mastercat (Table) – Master catalogue table.
database (Table) – RACS database table.
max_sep (float, optional) – Maxium source separation in degrees. Defaults to 1.
- Returns:
Output of astropy.coordinates.search_around_sky
- Return type:
Tuple[np.ndarray, np.ndarray, Angle]
- arrakis.init_database.field_database(survey_dir: pathlib.Path, host: str, epoch: int, username: str | None = None, password: str | None = None) Tuple[pymongo.results.InsertManyResult, pymongo.results.InsertManyResult] [source]
Reset and load the field database
- Parameters:
survey_dir (Path) – Path to RACS database (i.e. ‘askap_surveys/racs’ repo).
host (str) – Mongo host
epoch (int, optional) – RACS epoch number.
username (Union[str, None]) – Mongo username
password (Union[str, None]) – Mongo password
- Returns:
Field and beam info insert object.
- Return type:
Tuple[InsertManyResult, InsertManyResult]
- arrakis.init_database.get_beams(mastercat: astropy.table.Table, database: astropy.table.Table, epoch: int = 0) List[Dict] [source]
Get beams from the master catalogue
- Parameters:
mastercat (Table) – Master catalogue table.
database (Table) – RACS database table.
- Returns:
List of beam dictionaries.
- Return type:
List[Dict]
- arrakis.init_database.get_catalogue(survey_dir: pathlib.Path, epoch: int = 0) astropy.table.Table [source]
Get the RACS catalogue for a given epoch
- Parameters:
epoch (int, optional) – Epoch number. Defaults to 0.
- Returns:
RACS catalogue table.
- Return type:
Table
- arrakis.init_database.main(load: bool = False, islandcat: str | None = None, compcat: str | None = None, database_path: pathlib.Path | None = None, host: str = 'localhost', username: str | None = None, password: str | None = None, field: bool = False, epochs: List[int] = 0, force: bool = False) None [source]
Main script
- Parameters:
load (bool, optional) – Load the database. Defaults to False.
islandcat (Union[str, None], optional) – Island catalogue. Defaults to None.
compcat (Union[str, None], optional) – Component catalogue. Defaults to None.
host (str, optional) – Mongo host. Defaults to “localhost”.
username (Union[str, None], optional) – Mongo username. Defaults to None.
password (Union[str, None], optional) – Mongo password. Defaults to None.
field (bool, optional) – Load the field database. Defaults to False.
epochs (List[int], optional) – Epochs to load. Defaults to [0].
force (bool, optional) – Force overwrite of database. Defaults to False.
- Raises:
ValueError – If load is True and islandcat or compcat are None.
- arrakis.init_database.ndix_unique(x: numpy.ndarray) Tuple[numpy.ndarray, List[numpy.ndarray]] [source]
Find the N-dimensional array of indices of the unique values in x From https://stackoverflow.com/questions/54734545/indices-of-unique-values-in-array
- Parameters:
x (np.ndarray) – Array of values.
- Returns:
1D-array of sorted unique values
Array of arrays. Each array contains the indices where a given value in x is found
- Return type:
Tuple[np.ndarray, np.ndarray]
- arrakis.init_database.read_racs_database(survey_dir: pathlib.Path, epoch: int, table: str) astropy.table.Table [source]
Read the RACS database from CSVs or postgresql
- Parameters:
survey_dir (Path) – Path to RACS database (i.e. ‘askap_surveys/racs’ repo).
epoch (int) – RACS epoch number.
table (str) – Table name.
- Returns:
RACS database table.
- Return type:
Table
- arrakis.init_database.source2beams(ra: float, dec: float, database: astropy.table.Table, max_sep: float = 1) astropy.table.Table [source]
Find RACS beams that contain a given source position
- Parameters:
ra (float) – RA of source in degrees.
dec (float) – DEC of source in degrees.
database (dict) – RACS database table.
max_sep (float, optional) – Maximum seperation of source to beam centre in degrees. Defaults to 1.
- Returns:
Subset of RACS databsae table containing beams that contain the source.
- Return type:
Table
- arrakis.init_database.source_database(islandcat: astropy.table.Table, compcat: astropy.table.Table, host: str, epoch: int, username: str | None = None, password: str | None = None) Tuple[pymongo.results.InsertManyResult, pymongo.results.InsertManyResult] [source]
Insert sources into the database
Following https://medium.com/analytics-vidhya/how-to-upload-a-pandas-dataframe-to-mongodb-ffa18c0953c1
- Parameters:
islandcat (Table) – Island catalogue table.
compcat (Table) – Component catalogue table.
host (str) – MongoDB host IP.
username (str, optional) – Mongo username. Defaults to None.
password (str, optional) – Mongo host. Defaults to None.
- Returns:
Results for the islands and components inserts.
- Return type:
Tuple[InsertManyResult, InsertManyResult]