csv_to_npy

macauff.csv_to_npy(input_filename, astro_cols, photo_cols, bestindex_col, chunk_overlap_col, snr_cols=None, header=False, process_uncerts=False, astro_sig_fits_filepath=None, cat_in_radec=None, mn_in_radec=None, pm_cols=None, pm_ref_epoch=None, pm_move_to_epoch=None)[source]

Convert a .csv file representation of a photometric catalogue into the appropriate .npy binary files used in the cross-matching process.

Parameters:
input_filenamestring

Location on disk, including extension, where the catalogue .csv file is stored that is to be converted into numpy arrays.

astro_colslist or numpy.array of integers

List of zero-indexed columns in the input catalogue representing the three required astrometric parameters, two orthogonal sky axis coordinates and a single, circular astrometric precision. The first two columns of astro_cols must match in order the first two columns of the output astrometry binary file. For cases where process_uncerts is True, the last N columns must either be a single astrometric uncertainty, for when catalogue-given astrometric uncertainties are available and were used to parameterise the position-residuals in the catalogue, or a list of N photometric uncertainty bands, in which case there will be N band-based parameterisations of the astrometry and the bestindex_col flags will be used to determine which parameterisation to use for each source individually.

photo_colslist or numpy.ndarray of integers

List of zero-indexed columns in the input catalogue representing the magnitudes of each photometric source to be used in the cross-matching.

bestindex_colinteger

Zero-indexed column of the flag indicating which of the available photometric brightnesses (represented by photo_cols) is the preferred choice – usually the most precise and highest quality detection.

chunk_overlap_colinteger

Zero-indexed column in the .csv file containing an integer representation of the boolean representation of whether sources are in the “halo” (1 in the .csv) or “core” (0) of the region. If None then all objects are assumed to be in the core.

snr_colslist or numpy.ndarray of integers

List of zero-indexed columns in the input catalogue representing the signal-to-noise ratios of each detection corresponding to those same magnitudes in photo_cols.

headerboolean, optional

Flag indicating whether the .csv file has a first line with the names of the columns in it, or whether the first line of the file is the first line of the dataset.

process_uncertsboolean, optional

Determines whether uncertainties are re-processed in light of astrometric fitting on large scales.

astro_sig_fits_filepathstring, optional

Location on disk of the two saved files that contain the parameters that describe best-fit astrometric precision as a function of quoted astrometric precision. Must be provided if process_uncerts is True.

cat_in_radecboolean, optional

If process_uncerts is True, must be provided, and either be True or False, indicating whether the catalogue being processed is in RA-Dec coordinates or not. If True, coordinates of mid-points for derivations of m and n for quoted-fit uncertainty relations will be converted from Galactic Longitude and Latitude to Right Ascension and Declination for the purposes of nearest-neighbour use, if mn_in_radec is False (and m-n coordinates are in l/b).

mn_in_radecboolean, optional

If process_uncerts is True, must be provided, and similar to cat_in_radec is a flag indcating whether the coordinates used to compute m-n scaling relations are in RA/Dec or not. If mn_in_radec disagrees with cat_in_radec then m-n coordinates will be converted to the coordinate system of the catalogue.

pm_colslist or numpy.ndarray of integers, optional

If given, must contain the two orthogonal sky-axis proper motions’ indices for the given dataset, to be loaded along with positions, SNRs, photometry, etc. Depending on whether pm_ref_epoch is also given, must additionally contain the index into the column in the data holding the individial sources’ date of observation as the final of three elements. Must be None, as per the default value, to force skipping of element loading.

pm_ref_epochstring, optional

If pm_cols is of length two then this must be given, but if pm_cols is three elements must not be given. If provided, must be a single string, valid for loading into astropy’s Time function. Otherwise, pm_cols index must contain astropy Time-valid strings in its dataset column.

pm_move_to_epochstring, optional

If pm_cols is provided, regardless of its length, this must be given, and must always contain a single, astropy Time valid, string.

Returns:
astronumpy.ndarray

Three-elements per source, shape (N, 3), longitude, latitude, and (circular) astrometric uncertainty for every object in the catalogue.

photonumpy.ndarray

Photometry of all objects in the catalogue, also length N in its first axis and then M photometric bands per object.

best_indexnumpy.ndarray

Indices, 0-M-1, indicating which of the M detections is the preferred band for every object.

chunk_overlapnumpy.ndarray

Boolean flag, indicating whether an object is in the “chunk” or whether it has been included in a halo around the primary chunk objects for match purposes, but is a primary detection in a different chunk of this catalogue.

snrsnumpy.ndarray, optional

If snr_cols are provided, also returns the signal-to-noise ratios for each photo detection for each source.