rail.plotting.data_extraction_funcs module

A set of utility functions to extract data for plotting from rail files

rail.plotting.data_extraction_funcs.extract_mag(filepath, colname='LSST_obs_i')[source]

Extract the i-mag from a file

Return type:

ndarray

Parameters:
  • filepath (str) – Path to file with tabular data

  • colname (str) – Name of the column with redshfits [‘redshift’]

Returns:

magnitude – Magnitude in question

Return type:

np.ndarray

Notes

This assumes the magnitude are in a file that can be read by tables_io

rail.plotting.data_extraction_funcs.extract_magnitudes(filepath, template, bands)[source]

Extract the magntidues from a file

Return type:

ndarray

Parameters:
  • filepath (str) – Path to file with tabular data

  • template (str) – Template to make the names

  • bands (list[str]) – List of the bands to apply to the template

Returns:

magnitudes – Magnitudes in question

Return type:

np.ndarray

Notes

This assumes the magnitude are in a file that can be read by tables_io

rail.plotting.data_extraction_funcs.extract_multiple_z_point(filepaths, colname='zmode')[source]

Extract the point estimates of redshifts from several files

Return type:

dict[str, ndarray]

Parameters:
  • filepaths (dict[str, str]) – Path to file with tabular data, keys will be associatd with the various extracted point estimates

  • colname (str) – Name of the column with point estimates [‘zmode’]

Returns:

z_estimates – Redshift estimates in question, key by the key from input argument

Return type:

dict[str, np.ndarray]

Notes

This assumes the point estimates are in a qp file

rail.plotting.data_extraction_funcs.extract_z_pdf(filepath)[source]

Extract the pdf estimates of redshifts from a file

Parameters:

filepath (str) – Path to file with tabular data

Returns:

z_pdf – Redshift pdf in question

Return type:

qp.ensemble

Notes

This assumes the point estimates are in a qp file

rail.plotting.data_extraction_funcs.extract_z_point(filepath, colname='zmode')[source]

Extract the point estimates of redshifts from a file

Return type:

ndarray

Parameters:
  • filepath (str) – Path to file with tabular data

  • colname (str) – Name of the column with point estimates [‘zmode’]

Returns:

z_estimates – Redshift estimates in question

Return type:

np.ndarray

Notes

This assumes the point estimates are in a qp file

rail.plotting.data_extraction_funcs.extract_z_true(filepath, colname='redshift')[source]

Extract the true redshifts from a file

Return type:

ndarray

Parameters:
  • filepath (str) – Path to file with tabular data

  • colname (str) – Name of the column with redshfits [‘redshift’]

Returns:

redshifts – Redshifts in question

Return type:

np.ndarray

Notes

This assumes the redshifts are in a file that can be read by tables_io

rail.plotting.data_extraction_funcs.get_multi_pz_point_estimate_data(point_estimate_infos)[source]

Get the true redshifts and point estimates

for several analysis variants

This checks that they all have the same redshifts Parameters :rtype: dict[str, Any] | None

Returns:

pz_data – Data in question or None

Return type:

dict[str, Any] | None

Parameters:

point_estimate_infos (dict[str, dict[str, Any]])

rail.plotting.data_extraction_funcs.get_pz_point_estimate_data(project, selection, flavor, tag, algo)[source]

Get the true redshifts and point estimates for a particualar analysis selection and flavor

Return type:

dict[str, ndarray] | None

Parameters:
  • project (RailProject) – Object with information about the structure of the current project

  • selection (str) – Data selection in question, e.g., ‘gold’, or ‘blended’

  • flavor (str) – Analysis flavor in question, e.g., ‘baseline’ or ‘zCosmos’

  • algo (str) – Algorithm we want the estimates for, e.g., ‘knn’, ‘bpz’], etc…

  • tag (str) – File tag, e.g., ‘test’ or ‘train’, or ‘train_zCosmos’

Returns:

pz_data – Data in question or None if a file is missing

Return type:

dict[str, np.ndarray] | None

rail.plotting.data_extraction_funcs.get_tomo_bins_nz_estimate_data(project, selection, flavor, algo, classifier, summarizer)[source]

Get the tomographic bin n(z) estimates

Return type:

Ensemble

Parameters:
  • project (RailProject) – Object with information about the structure of the current project

  • selection (str) – Data selection in question, e.g., ‘gold’, or ‘blended’

  • flavor (str) – Analysis flavor in question, e.g., ‘baseline’ or ‘zCosmos’

  • algo (str) – Algorithm we want the estimates for, e.g., ‘knn’, ‘bpz’], etc…

  • classifier (str) – Algorithm we use to make tomograpic bin

  • summarizer (str) – Algorithm we use to go from p(z) to n(z)

Returns:

nz_data – Tomographic bin n(z) data

Return type:

qp.Ensemble

rail.plotting.data_extraction_funcs.get_tomo_bins_true_nz_data(project, selection, flavor, algo, classifier)[source]

Get the tomographic bin true n(z)

Return type:

Ensemble

Parameters:
  • project (RailProject) – Object with information about the structure of the current project

  • selection (str) – Data selection in question, e.g., ‘gold’, or ‘blended’

  • flavor (str) – Analysis flavor in question, e.g., ‘baseline’ or ‘zCosmos’

  • algo (str) – Algorithm we want the estimates for, e.g., ‘knn’, ‘bpz’], etc…

  • classifier (str) – Algorithm we use to make tomograpic bin

Returns:

nz_data – Tomographic bin n(z) data

Return type:

qp.Ensemble

rail.plotting.data_extraction_funcs.get_ztrue_and_magntidues(project, selection, flavor, tag)[source]

Get the true redshifts and observed magntidues for a particualar analysis selection and flavor

Return type:

dict[str, ndarray] | None

Parameters:
  • project (RailProject) – Object with information about the structure of the current project

  • selection (str) – Data selection in question, e.g., ‘gold’, or ‘blended’

  • flavor (str) – Analysis flavor in question, e.g., ‘baseline’ or ‘zCosmos’

  • tag (str) – File tag, e.g., ‘test’ or ‘train’, or ‘train_zCosmos’

Returns:

out_data – Data in question or None if a file is missing

Return type:

dict[str, np.ndarray] | None

rail.plotting.data_extraction_funcs.make_z_true_multi_z_point_dict(z_true, z_estimates)[source]

Build a single dictionary with true redshifts and several point_estimates

Return type:

dict[str, Any]

Parameters:
  • z_true (np.ndarray) – True Redshifts

  • z_estimates (dict[str, np.ndarray]) – Point estimates

Returns:

out_dict – Dictionary with true redshift and all the point estimate of the redshift

Return type:

dict[str, Any]

rail.plotting.data_extraction_funcs.make_z_true_z_point_dict(z_true, z_estimate, mags)[source]

Build a dictionary with true redshifts and a point_estimates

Return type:

dict[str, ndarray]

Parameters:
  • z_true (ndarray) – True Redshifts

  • z_estimate (ndarray) – Point estimates

  • mags (ndarray) – Magnitdues

Returns:

out_dict – Dictionary with true redshift and a point estimate of the redshift

Return type:

dict[str, np.ndarray]