calpit.datasets

Classes

TuningFork

RandomDataset

A custom dataset class to randomly select a data point.

PhotometryDataset

An abstract class representing a Dataset.

Module Contents

class TuningFork(dims=3, lam=3, seed=299792458)[source]
dims = 3[source]
lam = 3[source]
seed = 299792458[source]
generate_data(size, seed=None)[source]
class RandomDataset(x_data, y_data, oversample=1)[source]

Bases: torch.utils.data.Dataset

A custom dataset class to randomly select a data point. The data point is prepended with a random value between 0 and 1 from a Uniform distribution (coverage parameter). The target value is 0 if Y value is less than or equal to the coverage parameter and 1 otherwise. The data set can be oversampled by a given factor.

Parameters:
  • X (list or array-like) – The input features.

  • Y (list or array-like) – The target values.

  • oversample (float, optional) – The oversampling factor. Defaults to 1.

Returns:

A tuple containing the input feature and target value.

Return type:

tuple

x_data[source]
y_data[source]
len_x[source]
oversample = 1[source]
__len__()[source]
__getitem__(idx)[source]
class PhotometryDataset(file_path=None, pit=None, scaler=None)[source]

Bases: torch.utils.data.Dataset

An abstract class representing a Dataset.

All datasets that represent a map from keys to data samples should subclass it. All subclasses should overwrite __getitem__(), supporting fetching a data sample for a given key. Subclasses could also optionally overwrite __len__(), which is expected to return the size of the dataset by many Sampler implementations and the default options of DataLoader. Subclasses could also optionally implement __getitems__(), for speedup batched samples loading. This method accepts list of indices of samples of batch and returns list of samples.

Note

DataLoader by default constructs an index sampler that yields integral indices. To make it work with a map-style dataset with non-integral indices/keys, a custom sampler must be provided.

pit = None[source]
scaler = None[source]
__len__()[source]
__getitem__(idx)[source]