:py:mod:`gnn_tracking.preprocessing.point_cloud_builder`
========================================================

.. py:module:: gnn_tracking.preprocessing.point_cloud_builder

.. autoapi-nested-parse::

   Build point clouds from the input data files.



Module Contents
---------------

Classes
~~~~~~~

.. autoapisummary::

   gnn_tracking.preprocessing.point_cloud_builder.PointCloudBuilder



Functions
~~~~~~~~~

.. autoapisummary::

   gnn_tracking.preprocessing.point_cloud_builder.get_truth_edge_index



Attributes
~~~~~~~~~~

.. autoapisummary::

   gnn_tracking.preprocessing.point_cloud_builder.DEFAULT_FEATURES
   gnn_tracking.preprocessing.point_cloud_builder._DEFAULT_FEATURE_SCALE


.. py:function:: get_truth_edge_index(pids: numpy.ndarray) -> numpy.ndarray

   Get edge index for all edges, connecting hits of the same `particle_id`.
   To save space, only edges in one direction are returned.


.. py:data:: DEFAULT_FEATURES
   :value: ('r', 'phi', 'z', 'eta_rz', 'u', 'v', 'charge_frac', 'leta', 'lphi', 'lx', 'ly', 'lz', 'geta', 'gphi')

   

.. py:data:: _DEFAULT_FEATURE_SCALE

   

.. py:class:: PointCloudBuilder(*, outdir: str | pathlib.PurePath, indir: str | pathlib.PurePath, detector_config: pathlib.PurePath, n_sectors: int, redo: bool = True, pixel_only: bool = True, sector_di: float = 0.0001, sector_ds: float = 1.1, measurement_mode: bool = False, thld: float = 0.5, remove_noise: bool = False, write_output: bool = True, log_level=logging.INFO, collect_data: bool = True, feature_names: tuple = DEFAULT_FEATURES, feature_scale: tuple = _DEFAULT_FEATURE_SCALE, add_true_edges: bool = False)


   Build point clouds, that is, read the input data files and convert them
   to pytorch geometric data objects (without any edges yet).

   :param outdir: Directory for the output files
   :param indir: Directory for the input files
   :param detector_config: Path to the detector configuration file
   :param n_sectors: Total number of sectors
   :param redo: Re-compute the point cloud even if it is found
   :param pixel_only: Construct tracks only from pixel layers
   :param sector_di: The intercept offset for the extended sector
   :param sector_ds: The slope offset for the extended sector
   :param measurement_mode: Produce statistics about the sectorization
   :param thld: Threshold pt for measurements
   :param remove_noise: Remove hits with particle_id==0
   :param write_output: Store the point clouds in a torch .pt file
   :param log_level: Specify INFO (0) or DEBUG (>0)
   :param collect_data: Collect data in memory
   :param feature_names: Names of features to add
   :param feature_scale: Scale of features
   :param add_true_edges: Add true edges to the point cloud

   .. py:method:: calc_eta(r: numpy.ndarray, z: numpy.ndarray) -> numpy.ndarray

      Compute pseudorapidity (spatial).


   .. py:method:: restrict_to_subdetectors(hits: pandas.DataFrame, cells: pandas.DataFrame) -> tuple[pandas.DataFrame, pandas.DataFrame]

      Rename (volume, layer) pairs with an integer label.


   .. py:method:: append_features(hits: pandas.DataFrame, particles: pandas.DataFrame, truth: pandas.DataFrame, cells: pandas.DataFrame) -> pandas.DataFrame

      Add additional features to the hits dataframe and return it.


   .. py:method:: sector_hits(hits: pandas.DataFrame, sector_id: int, particle_id_counts: dict[int, int]) -> pandas.DataFrame

      Break an event into (optionally) extended sectors.


   .. py:method:: _get_edge_index(particle_id: numpy.ndarray) -> torch.Tensor


   .. py:method:: to_pyg_data(hits: pandas.DataFrame) -> torch_geometric.data.Data

      Build the output data structure


   .. py:method:: get_measurements() -> dict[str, float]


   .. py:method:: process(start: int | None = None, stop: int | None = None, ignore_loading_errors=False)

      Process input files from self.input_files and write output files to
      self.output_files

      :param start: index of first file to process
      :param stop: index of last file to process (or None). Can be higher than total
                   number of files.
      :param ignore_loading_errors: if True, ignore errors when loading event

      Returns:




