Selection
These stages deal with selection objects and assigning them to tomographic bins.
TXSourceSelectorBase
- Base stage for source selection using S/N, size, and flag cuts and tomographyTXSourceSelectorMetacal
- Source selection and tomography for metacal catalogsTXSourceSelectorMetadetect
- Source selection and tomography for metadetect catalogsTXSourceSelectorLensfit
- Source selection and tomography for lensfit catalogsTXSourceSelectorHSC
- Source selection and tomography for HSC catalogsTXBaseLensSelector
- Base class for lens object selection, using the BOSS Target Selection.TXTruthLensSelector
- Select lens objects based on true redshifts and BOSS criteriaTXMeanLensSelector
- Select lens objects based on mean redshifts and BOSS criteriaTXModeLensSelector
- Select lens objects based on best-fit redshifts and BOSS criteria
- class txpipe.source_selector.TXSourceSelectorBase(*args: Any, **kwargs: Any)[source]
Base stage for source selection using S/N, size, and flag cuts and tomography
The subclasses of this pipeline stage select objects to be used as the source sample for the shear-shear and shear-position calibrations.
Each subclass is specialised to a specific kind of catalog and calibration scheme. You cannot use this parent class.
All the versions apply some general cuts based on object flags, and size and S/N cuts based on the configuration file.
It also splits those objects into tomographic bins using either a random forest algorithm, with the training data in calibration_table, or according to the true shear (if present), according to the choice the user makes in the configuration.
Once these selections are made it constructs the quantities needed to calibrate each bin, generating a set of Calibrator objects.
- calculate_tomography(pz_data, shear_data, calculators)[source]
Select objects to go in each tomographic bin and their calibration.
- Parameters:
pz_data (table or dict of arrays) – A chunk of input photo-z data containing mean values for each object
shear_data (table or dict of arrays) – A chunk of input shear data with metacalibration variants.
- select(data, bin_index)[source]
Select which objects are to be chosen in this tomographic bin. We do this by calling out to the 2D selector, which does the cuts on size and SNR, and then combining this with a cut on tomographic bin.
Note that we don’t call this method directly in this class. Instead we pass it to the Calculator objects that call it, sometimes on different columns of data.
- setup_output()[source]
Set up the output data file.
Creates the data sets and groups to put module output in the shear_tomography_catalog output file.
- write_global_values(outfile, calculators, number_density_stats)[source]
Write out overall selection biases
- Parameters:
outfile (h5py.File) –
S (array of shape (nbin,2,2)) – Selection bias matrices
- write_tomography(outfile, start, end, source_bin, R)[source]
Write out a chunk of tomography and response.
- Parameters:
outfile (h5py.File) –
start (int) – The index into the output this chunk starts at
end (int) – The index into the output this chunk ends at
tomo_bin (array of shape (nrow,)) – The bin index for each output object
R (array of shape (nrow,2,2)) – Multiplicative bias calibration factor for each object
- class txpipe.source_selector.TXSourceSelectorMetacal(*args: Any, **kwargs: Any)[source]
Source selection and tomography for metacal catalogs
This selector subclass is designed for metacal-type catalogs like those used in Dark Energy Survey Y1 and Y3 data releases. In DESC they are superseded by MetaDetect, see below.
- compute_output_stats(calculator, mean, variance)[source]
Collect the per-bin response values, and the shear means and variances. These are calculated in a distributed way across different processes, so here we bring them together.
We collate these into a BinStats object for clarity.
- data_iterator()[source]
This iterator returns chunks of data in dictionaries one by one.
We call to a parent class method to do the main iteration; the work here is just choosing which columns to read.
- setup_output()[source]
Prepare the output columns for the response values generated by metacal. We save:
R_gamma: the per-object estimator response R_S: the per-bin selection response R_gamma_mean: the mean per-bin estimator response R_total: the complete per-bin response
and the 2D versions of the per-bin values.
- write_tomography(outfile, start, end, source_bin, R)[source]
Write out a chunk of tomography and response.
- Parameters:
outfile (h5py.File) –
start (int) – The index into the output this chunk starts at
end (int) – The index into the output this chunk ends at
tomo_bin (array of shape (nrow,)) – The bin index for each output object
R (array of shape (nrow,2,2)) – Multiplicative bias calibration factor for each object
- class txpipe.source_selector.TXSourceSelectorMetadetect(*args: Any, **kwargs: Any)[source]
Source selection and tomography for metadetect catalogs
This subclass selects for MetaDetect catalogs, which is expected to be used for Rubin data. It computes the selection bias due to object detection by repeating the detection process under different applied shears.
As a consequence the different calibration columns have different lengths, since different objects are detected in each case.
- class txpipe.source_selector.TXSourceSelectorLensfit(*args: Any, **kwargs: Any)[source]
Source selection and tomography for lensfit catalogs
This selector class is for Lensfit catalogs like those used in KIDS.
It is a simpler calibration scheme than the above two, and does not involve variant catalogs, just taking the mean of a value for one catalog.
- class txpipe.source_selector.TXSourceSelectorHSC(*args: Any, **kwargs: Any)[source]
Source selection and tomography for HSC catalogs
This subclass is for selecting objects on catalogs of the form made by HSC.
This scheme is quite similar to the one used by lensfit. The main difference is in the per-object response.
TODO: The HSC calibrator is currently broken, and will crash when it gets to compute_output_stats
- select_2d(data, calling_from_select=False)[source]
Add an additional cut to the parent class, if specified, on the max shear. HSM DP0.2 catalogs seem to contain occasional very large shears that skew peaks. This removes those. This is only really for testing.
- setup_output()[source]
Set up the output data file.
Creates the data sets and groups to put module output in the shear_tomography_catalog output file.
- write_tomography(outfile, start, end, source_bin, R)[source]
Write out a chunk of tomography and response.
- Parameters:
outfile (h5py.File) –
start (int) – The index into the output this chunk starts at
end (int) – The index into the output this chunk ends at
tomo_bin (array of shape (nrow,)) – The bin index for each output object
R (array of shape (nrow,2,2)) – Multiplicative bias calibration factor for each object
- class txpipe.lens_selector.TXBaseLensSelector(*args: Any, **kwargs: Any)[source]
Base class for lens object selection, using the BOSS Target Selection.
Subclasses of this pipeline stage select objects to be used as the lens sample for the galaxy clustering and shear-position calibrations.
The cut used here is simplistic and should be replaced.
- run()[source]
Run the analysis for this stage.
Collect the list of columns to read
Create iterators to read chunks of those columns
- Loop through chunks:
select objects for each bin
write them out
accumulate selection bias values
Average the selection biases
Write out biases and close the output
- select_lens_boss(phot_data)[source]
Photometry cuts based on the BOSS Galaxy Target Selection: http://www.sdss3.org/dr9/algorithms/boss_galaxy_ts.php
- setup_output()[source]
Set up the output data file.
Creates the data sets and groups to put module output in the tomography_catalog output file.
- write_global_values(outfile, number_density_stats)[source]
Write out overall selection biases
- Parameters:
outfile (h5py.File) –
- write_tomography(outfile, start, end, lens_bin)[source]
Write out a chunk of tomography and response.
- Parameters:
outfile (h5py.File) –
start (int) – The index into the output this chunk starts at
end (int) – The index into the output this chunk ends at
tomo_bin (array of shape (nrow,)) – The bin index for each output object
R (array of shape (nrow,2,2)) – Multiplicative bias calibration factor for each object
- class txpipe.lens_selector.TXTruthLensSelector(*args: Any, **kwargs: Any)[source]
Select lens objects based on true redshifts and BOSS criteria
This is useful for testing with idealised lens bins.