n2j.trainval_data.graphs.cosmodc2_graph#

Training input graph X created from the postprocessed CosmoDC2 catalog

Module Contents#

Classes#

CosmoDC2Graph

Concatenation of multiple CosmoDC2GraphHealpix instances,

CosmoDC2GraphHealpix

Set of graphs representing a single healpix of the CosmoDC2 field

class n2j.trainval_data.graphs.cosmodc2_graph.CosmoDC2Graph(in_dir, healpixes, raytracing_out_dirs, aperture_size, n_data, features, subsample_pdf_func=None, n_subsample=None, subsample_with_replacement=True, stop_mean_std_early=False, n_cores=20, num_workers=4, out_dir=None, seed=123)[source]#

Bases: torch.utils.data.dataset.ConcatDataset

Concatenation of multiple CosmoDC2GraphHealpix instances, with an added data transformation functionality

data_stats()[source]#

Statistics of the X, Y data used for standardizing

data_stats_valtest()[source]#

Statistics of the X, Y data on validation set used for resampling to mimic training dist. Mean, std computation skipped.

__getitem__(idx)[source]#
class n2j.trainval_data.graphs.cosmodc2_graph.CosmoDC2GraphHealpix(healpix, in_dir, raytracing_out_dir, aperture_size, n_data, features, n_cores=20, out_dir=None, debug=False)[source]#

Bases: n2j.trainval_data.graphs.base_graph.BaseGraph

Set of graphs representing a single healpix of the CosmoDC2 field

property n_features[source]#
property raw_dir: str[source]#
property raw_file_name[source]#
property raw_file_names[source]#
property processed_file_fmt[source]#
property processed_file_path_fmt[source]#
property processed_file_names[source]#

A list of files relative to self.processed_dir which needs to be found in order to skip the processing

columns = ['ra', 'dec', 'galaxy_id', 'redshift'][source]#
get_los_node()[source]#

Properties of the sightline galaxy, with unobservable features (everything other than position) appropriately masked out.

Parameters#

ra_los : ra of sightline, in arcmin dec_los : dec of sightline, in arcmin

download()[source]#

Called when raw_file_names aren’t found

get_gals_iterator(healpix, columns, chunksize=100000)[source]#

Get an iterator over the galaxy catalog defining the line-of-sight galaxies

get_edges(ra_dec)[source]#

Get the edge indices from the node positions

Parameters#

ra_decnp.ndarray

ra and dec of nodes, of shape [n_nodes, 2]

Returns#

torch.LongTensor

edge indices, of shape [2, n_edges]

_save_graph_to_disk(i)[source]#
_get_y_class(y)[source]#
process_single(i)[source]#

Process a single sightline indexed i

process()[source]#

Process multiple sightline in parallel

len()[source]#
get(idx)[source]#