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_colsmust match in order the first two columns of the output astrometry binary file. For cases whereprocess_uncertsisTrue, the lastNcolumns 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 ofNphotometric uncertainty bands, in which case there will beNband-based parameterisations of the astrometry and thebestindex_colflags 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” (
1in the .csv) or “core” (0) of the region. IfNonethen 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_uncertsisTrue.- cat_in_radecboolean, optional
If
process_uncertsisTrue, must be provided, and either beTrueorFalse, indicating whether the catalogue being processed is in RA-Dec coordinates or not. IfTrue, coordinates of mid-points for derivations ofmandnfor quoted-fit uncertainty relations will be converted from Galactic Longitude and Latitude to Right Ascension and Declination for the purposes of nearest-neighbour use, ifmn_in_radecisFalse(and m-n coordinates are in l/b).- mn_in_radecboolean, optional
If
process_uncertsisTrue, must be provided, and similar tocat_in_radecis a flag indcating whether the coordinates used to compute m-n scaling relations are in RA/Dec or not. Ifmn_in_radecdisagrees withcat_in_radecthen 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_epochis 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 beNone, as per the default value, to force skipping of element loading.- pm_ref_epochstring, optional
If
pm_colsis of length two then this must be given, but ifpm_colsis three elements must not be given. If provided, must be a single string, valid for loading into astropy’s Time function. Otherwise,pm_colsindex must contain astropy Time-valid strings in its dataset column.- pm_move_to_epochstring, optional
If
pm_colsis 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
Nin its first axis and thenMphotometric bands per object.- best_indexnumpy.ndarray
Indices,
0-M-1, indicating which of theMdetections 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_colsare provided, also returns the signal-to-noise ratios for eachphotodetection for each source.