image_representation

Image CNN input pipeline: pulses → pixels → grids / tensors.

class graphnet.models.data_representation.images.image_representation.ImageRepresentation(*args, **kwargs)[source]

Bases: DataRepresentation

Compose a pixel definition with a detector grid for CNN inputs.

A NodeDefinition acts as pixel definition: pulses X are aggregated into unordered pixel rows P (the same abstraction as graph nodes, without requiring graph terminology for CNN users).

A GridDefinition defines detector-bound orthonormal grid shape(s) and lookup table(s); its forward() scatters P into image tensor(s).

The Detector is taken from grid_definition.detector so the grid matches the preprocessing geometry.

Construct ImageRepresentation.

Parameters:
  • pixel_definition (NodeDefinition) – Pulse-level features → one row per pixel/DOM.

  • grid_definition (GridDefinition) – Pixel keys + voxel indices + scatter into images.

  • input_feature_names (Optional[List[str]], default: None) – Column names in raw pulse tables. If omitted, the detector’s feature list is used.

  • dtype (Optional[dtype], default: torch.float32) – Feature dtype (e.g. torch.float).

  • perturbation_dict (Optional[Dict[str, float]], default: None) – Optional feature noise (see DataRepresentation).

  • seed (Union[int, Generator, None], default: None) – RNG for perturbations.

  • add_inactive_sensors (bool, default: False) – Pad inactive sensors when True.

  • sensor_mask (Optional[List[int]], default: None) – Drop these sensor IDs.

  • string_mask (Optional[List[int]], default: None) – Drop these string IDs.

  • args (Any)

  • kwargs (Any)

Return type:

object

Note

pixel_definition output columns must match what grid_definition expects (including key fields in GridDefinition.map_pixels_by).

property shape: List[List[int]]

Channel-spatial layout per image tensor (see GridDefinition).

forward(input_features, input_feature_names, truth_dicts, custom_label_functions, loss_weight_column, loss_weight, loss_weight_default_value, data_path)[source]

Build a Data object with image tensor(s) on x.

Return type:

Data

Parameters:
  • input_features (ndarray)

  • input_feature_names (List[str])

  • truth_dicts (List[Dict[str, Any]] | None)

  • custom_label_functions (Dict[str, Callable[[...], Any]] | None)

  • loss_weight_column (str | None)

  • loss_weight (float | None)

  • loss_weight_default_value (float | None)

  • data_path (str | None)