photoz_mlz
- class txpipe.photoz_mlz.PZPDFMLZ(*args: Any, **kwargs: Any)[source]
Bases:
ceci.
- calculate_photozs(data, z, features, trees)[source]
Generate random photo-zs.
This is a mock method that instead of actually running any photo-z analysis just spits out some random PDFs.
This method is run on chunks of data, not the whole thing at once.
It does however generate outputs in the right format to be saved later, and generates point estimates, used for binning and assumed to be a mean or similar statistic from each bin, for each of the five metacalibrated variants of the magnitudes.
- Parameters
data (dict of arrays) – Chunk of input photometry catalog containing object magnitudes
z (array) – The redshift values at which to “compute” P(z) values
- Returns
pdfs (array of shape (n_chunk, n_z)) – The output PDF values
point_estimates (array of shape (5, n_chunk)) – Point-estimated photo-zs for each of the 5 metacalibrated variants
- prepare_output(nobj, z)[source]
Prepare the output HDF5 file for writing.
Note that this is done by all the processes if running in parallel; that is part of the design of HDF5.
- Parameters
nobj (int) – Number of objects in the catalog
z (array) – Points on the redshift axis that the PDF will be evaluated at.
- Returns
f – The output file, opened for writing.
- Return type
h5py.File object
- write_output(output_file, start, end, pdfs, point_estimates)[source]
Write out a chunk of the computed PZ data.
- Parameters
output_file (h5py.File) – The object we are writing out to
start (int) – The index into the full range of data that this chunk starts at
end (int) – The index into the full range of data that this chunk ends at
pdfs (array of shape (n_chunk, n_z)) – The output PDF values
point_estimates (array of shape (5, n_chunk)) – Point-estimated photo-zs for each of the 5 metacalibrated variants