sp_validation.assembly.specz_merge

Give shape objects their spectroscopic redshift: the spec-z extension of the v2 collection.

The input is PhotoPipe’s match of DR6 objects to spectra on every tile, one FITS table (UNIONS_DR6_ugriz_specz.cat): one row per match, holding the object’s PhotoPipe columns and the spectrum’s (ALPHA_J2000_spec, DELTA_J2000_spec, z_spec_spec, z_spec_err_spec), and the redshift compilation the match used, one UNIONS.<tile>_redshifts-<date>.asc per tile (ra dec zspec zspec_err wspec ref), which names each spectrum’s survey (ref) and confidence (wspec).

The table has no tile column, and its SeqNr renumbers the rows; the object’s DR6 number in its tile is Pair_0_spec. A row is a PhotoPipe row, so it is found in the collection’s PhotoPipe extension by that number and its exact position (PHOTOPIPE_SEQNR, ALPHA_J2000, DELTA_J2000), which gives its OBJECT_ID and pixel. A row that pairs several DR6 objects (N_0 > 1) or several spectra (N_1 > 1) averages their positions, photometry or redshifts, and is left out. Rows whose object is not a shape row have no place in the collection. A spectrum is found in the compilation by its exact position; one the compilation does not list has no survey or confidence.

The output, COLLECTION/specz/specz, is a HATS catalogue on the shapes’ pixels with one row for each shape object that has a spectrum, in the shapes’ row order: _healpix_29, OBJECT_ID, the shape coordinates, Z_SPEC, Z_SPEC_ERR, Z_SPEC_CONFIDENCE (wspec), Z_SPEC_SURVEY (ref), and the spectrum’s position Z_SPEC_RA, Z_SPEC_DEC, which identifies it: a spectrum matched to several objects is on each of them. It is the data of the collection’s specz extension, joined to the shapes on OBJECT_ID; pixels without a spectrum have no file.

MATCH_COLUMNS = ['Pair_0_spec', 'ALPHA_J2000', 'DELTA_J2000', 'N_0', 'N_1', 'ALPHA_J2000_spec', 'DELTA_J2000_spec', 'z_spec_spec', 'z_spec_err_spec']

Columns of the matched table that identify the object and give the spectrum.

_read_compilation_file(path)[source]
read_spectra(matches, compilation, workers=1)[source]

Return the matched table’s one-object, one-spectrum rows, and how many it has of the others.

matches is the FITS table and compilation the directory of *_redshifts-*.asc files, which gives each spectrum its survey and confidence (null where it does not list it). Rows are sorted by object right ascension, for match_pixel.

match_pixel(photo, spectra)[source]

Return (photo rows, spectrum rows) of the spectra whose object is in photo.

photo holds one PhotoPipe pixel file’s PHOTOPIPE_SEQNR, ALPHA_J2000 and DELTA_J2000; spectra is read_spectra’s table. An object matches when its DR6 number and position are those of the spectrum’s row exactly.

merge_pixel(photo_path, output_path)[source]

Write one pixel’s spec-z rows; return its pixel, their count and spectrum rows.

_merge_worker(arguments)[source]
merge(collection, matches, compilation, workers=1)[source]

Write COLLECTION/specz: the catalogue specz and its BUILD.json.

Needs the collection’s PhotoPipe extension, COLLECTION/photopipe.