From 4c0c2ee3e4725526e2f86855f7da674992e702ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20S=C3=B8gaard?= Date: Wed, 28 Feb 2024 15:53:01 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20graphnet?= =?UTF-8?q?-team/graphnet@e572efcccb0bc95d490f10965ae0c16c7b771e69=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _modules/graphnet/data/dataclasses.html | 15 +- _modules/graphnet/deployment/deployer.html | 497 +++++++++++++++ .../deployment/deployment_module.html | 459 ++++++++++++++ .../cleaning_module.html} | 279 +-------- .../deployment/icecube/inference_module.html | 568 ++++++++++++++++++ _modules/index.html | 5 +- ...t => graphnet.deployment.deployer.rst.txt} | 2 +- ...phnet.deployment.deployment_module.rst.txt | 8 + ...yment.i3modules.deprecated_methods.rst.txt | 8 + ...ployment.i3modules.graphnet_module.rst.txt | 8 - .../api/graphnet.deployment.i3modules.rst.txt | 3 +- ...deployment.icecube.cleaning_module.rst.txt | 8 + ...hnet.deployment.icecube.i3deployer.rst.txt | 8 + ...eployment.icecube.inference_module.rst.txt | 8 + .../api/graphnet.deployment.icecube.rst.txt | 38 ++ _sources/api/graphnet.deployment.rst.txt | 11 + api/graphnet.data.dataclasses.html | 91 +++ api/graphnet.data.html | 1 + api/graphnet.deployment.deployer.html | 551 +++++++++++++++++ ...graphnet.deployment.deployment_module.html | 518 ++++++++++++++++ api/graphnet.deployment.html | 43 +- ...loyment.i3modules.deprecated_methods.html} | 38 +- api/graphnet.deployment.i3modules.html | 34 +- ...t.deployment.icecube.cleaning_module.html} | 140 ++--- api/graphnet.deployment.icecube.html | 511 ++++++++++++++++ ...raphnet.deployment.icecube.i3deployer.html | 498 +++++++++++++++ ...t.deployment.icecube.inference_module.html | 549 +++++++++++++++++ api/graphnet.html | 3 + api/graphnet.models.html | 6 +- genindex.html | 67 ++- objects.inv | Bin 7379 -> 7529 bytes py-modindex.html | 17 +- searchindex.js | 2 +- sitemap.xml | 2 +- 34 files changed, 4591 insertions(+), 405 deletions(-) create mode 100644 _modules/graphnet/deployment/deployer.html create mode 100644 _modules/graphnet/deployment/deployment_module.html rename _modules/graphnet/deployment/{i3modules/graphnet_module.html => icecube/cleaning_module.html} (54%) create mode 100644 _modules/graphnet/deployment/icecube/inference_module.html rename _sources/api/{graphnet.deployment.i3modules.deployer.rst.txt => graphnet.deployment.deployer.rst.txt} (57%) create mode 100644 _sources/api/graphnet.deployment.deployment_module.rst.txt create mode 100644 _sources/api/graphnet.deployment.i3modules.deprecated_methods.rst.txt delete mode 100644 _sources/api/graphnet.deployment.i3modules.graphnet_module.rst.txt create mode 100644 _sources/api/graphnet.deployment.icecube.cleaning_module.rst.txt create mode 100644 _sources/api/graphnet.deployment.icecube.i3deployer.rst.txt create mode 100644 _sources/api/graphnet.deployment.icecube.inference_module.rst.txt create mode 100644 _sources/api/graphnet.deployment.icecube.rst.txt create mode 100644 api/graphnet.deployment.deployer.html create mode 100644 api/graphnet.deployment.deployment_module.html rename api/{graphnet.deployment.i3modules.deployer.html => graphnet.deployment.i3modules.deprecated_methods.html} (92%) rename api/{graphnet.deployment.i3modules.graphnet_module.html => graphnet.deployment.icecube.cleaning_module.html} (55%) create mode 100644 api/graphnet.deployment.icecube.html create mode 100644 api/graphnet.deployment.icecube.i3deployer.html create mode 100644 api/graphnet.deployment.icecube.inference_module.html diff --git a/_modules/graphnet/data/dataclasses.html b/_modules/graphnet/data/dataclasses.html index 20c423cf1..a93a3e455 100644 --- a/_modules/graphnet/data/dataclasses.html +++ b/_modules/graphnet/data/dataclasses.html @@ -324,7 +324,7 @@

Source code for graphnet.data.dataclasses

 """Module containing experiment-specific dataclasses."""
 
-
+from typing import List, Any
 from dataclasses import dataclass
 
 
@@ -335,6 +335,19 @@ 

Source code for graphnet.d i3_file: str gcd_file: str

+ + +
+[docs] +@dataclass +class Settings: + """Dataclass for workers in I3Deployer.""" + + i3_files: List[str] + gcd_file: str + output_folder: str + modules: List[Any]
+ diff --git a/_modules/graphnet/deployment/deployer.html b/_modules/graphnet/deployment/deployer.html new file mode 100644 index 000000000..ea737ce89 --- /dev/null +++ b/_modules/graphnet/deployment/deployer.html @@ -0,0 +1,497 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + graphnet.deployment.deployer — graphnet documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Skip to content +
+ +
+ + +
+ + + + +
+
+ +
+
+
+ +
+
+
+
+
+
+ + +
+
+
+ +
+
+ +

Source code for graphnet.deployment.deployer

+"""Contains the graphnet deployment module."""
+import random
+from abc import abstractmethod, ABC
+import multiprocessing
+from typing import TYPE_CHECKING, List, Union, Sequence, Any
+import time
+
+from graphnet.utilities.imports import has_torch_package
+from .deployment_module import DeploymentModule
+from graphnet.utilities.logging import Logger
+
+if has_torch_package or TYPE_CHECKING:
+    import torch
+
+
+
+[docs] +class Deployer(ABC, Logger): + """A generic baseclass for applying `DeploymentModules` to analysis files. + + Modules are applied in the order that they appear in `modules`. + """ + + @abstractmethod + def _process_files( + self, + settings: Any, + ) -> None: + """Process a single file. + + If n_workers > 1, this function is run in parallel n_worker times. Each + worker will loop over an allocated set of files. + """ + raise NotImplementedError + + @abstractmethod + def _prepare_settings( + self, input_files: List[str], output_folder: str + ) -> List[Any]: + """Produce a list of inputs for each worker. + + This function must produce and return a list of arguments to each + worker. + """ + raise NotImplementedError + + def __init__( + self, + modules: Union[DeploymentModule, Sequence[DeploymentModule]], + n_workers: int = 1, + ) -> None: + """Initialize `Deployer`. + + Will apply `DeploymentModules` to files in the order in which they + appear in `modules`. Each module is run independently. + + Args: + modules: List of `DeploymentModules`. + Order of appearence in the list determines order + of deployment. + n_workers: Number of workers. The deployer will divide the number + of input files across workers. Defaults to 1. + """ + super().__init__(name=__name__, class_name=self.__class__.__name__) + # This makes sure that one worker cannot access more + # than 1 core's worth of compute. + + if torch.get_num_interop_threads() > 1: + torch.set_num_interop_threads(1) + if torch.get_num_threads() > 1: + torch.set_num_threads(1) + + # Check + if isinstance(modules, list): + self._modules = modules + else: + self._modules = [modules] + + # Member Variables + self._n_workers = n_workers + + def _launch_jobs(self, settings: List[Any]) -> None: + """Will launch jobs in parallel if n_workers > 1, else run on main.""" + if self._n_workers > 1: + processes = [] + for i in range(self._n_workers): + processes.append( + multiprocessing.Process( + target=self._process_files, + args=[settings[i]], # type: ignore + ) + ) + + for process in processes: + process.start() + + for process in processes: + process.join() + else: + self._process_files(settings[0]) + +
+[docs] + def run( + self, + input_files: Union[List[str], str], + output_folder: str, + ) -> None: + """Apply `modules` to input files. + + Args: + input_files: Path(s) to i3 file(s) that you wish to + apply the graphnet modules to. + output_folder: The output folder to which the i3 files are written. + """ + start_time = time.time() + if isinstance(input_files, list): + random.shuffle(input_files) + else: + input_files = [input_files] + settings = self._prepare_settings( + input_files=input_files, output_folder=output_folder + ) + + assert len(settings) == self._n_workers + + self.info( + f"""processing {len(input_files)} files \n + using {self._n_workers} workers""" + ) + self._launch_jobs(settings) + self.info( + f"""Processing {len(input_files)} files was completed in \n + {time.time() - start_time} seconds using {self._n_workers} cores.""" + )
+
+ +
+ +
+
+
+
+
+ + + + + \ No newline at end of file diff --git a/_modules/graphnet/deployment/deployment_module.html b/_modules/graphnet/deployment/deployment_module.html new file mode 100644 index 000000000..812e10b3c --- /dev/null +++ b/_modules/graphnet/deployment/deployment_module.html @@ -0,0 +1,459 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + graphnet.deployment.deployment_module — graphnet documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Skip to content +
+ +
+ + +
+ + + + +
+
+ +
+
+
+ +
+
+
+
+
+
+ + +
+
+
+ +
+
+ +

Source code for graphnet.deployment.deployment_module

+"""Class(es) for deploying GraphNeT models in icetray as I3Modules."""
+from abc import abstractmethod
+from typing import Any, List, Union, Dict
+
+import numpy as np
+from torch import Tensor
+from torch_geometric.data import Data, Batch
+
+from graphnet.models import Model
+from graphnet.utilities.config import ModelConfig
+from graphnet.utilities.logging import Logger
+
+
+
+[docs] +class DeploymentModule(Logger): + """Base DeploymentModule for GraphNeT. + + Contains standard methods for loading models doing inference with them. + Experiment-specific implementations may overwrite methods and should define + `__call__`. + """ + + def __init__( + self, + model_config: Union[ModelConfig, str], + state_dict: Union[Dict[str, Tensor], str], + device: str = "cpu", + prediction_columns: Union[List[str], None] = None, + ): + """Construct DeploymentModule. + + Arguments: + model_config: A model configuration file. + state_dict: A state dict for the model. + device: The computational device to use. Defaults to "cpu". + prediction_columns: Column names for each column in model output. + """ + super().__init__(name=__name__, class_name=self.__class__.__name__) + # Set Member Variables + self.model = self._load_model( + model_config=model_config, state_dict=state_dict + ) + + self.prediction_columns = self._resolve_prediction_columns( + prediction_columns + ) + + # Set model to inference mode. + self.model.inference() + + # Move model to device + self.model.to(device) + + @abstractmethod + def __call__(self, input_data: Any) -> Any: + """Define here how the module acts on a file/data stream.""" + + def _load_model( + self, + model_config: Union[ModelConfig, str], + state_dict: Union[Dict[str, Tensor], str], + ) -> Model: + """Load `Model` from config and insert learned weights.""" + model = Model.from_config(model_config, trust=True) + model.load_state_dict(state_dict) + return model + + def _resolve_prediction_columns( + self, prediction_columns: Union[List[str], None] + ) -> List[str]: + if prediction_columns is not None: + if isinstance(prediction_columns, str): + prediction_columns = [prediction_columns] + else: + prediction_columns = prediction_columns + else: + prediction_columns = self.model.prediction_labels + return prediction_columns + + def _inference(self, data: Union[Data, Batch]) -> List[np.ndarray]: + """Apply model to a single event or batch of events `data`. + + Args: + data: A `Data` or ``Batch` object - + either a single output of a `GraphDefinition` or a batch of + them. + + Returns: + A List of numpy arrays, each representing the output from the + `Task`s that the model contains. + """ + # Perform inference + output = self.model(data=data) + # Loop over tasks in model and transform to numpy + for k in range(len(output)): + output[k] = output[k].detach().numpy() + return output
+ +
+ +
+
+
+
+
+ + + + + \ No newline at end of file diff --git a/_modules/graphnet/deployment/i3modules/graphnet_module.html b/_modules/graphnet/deployment/icecube/cleaning_module.html similarity index 54% rename from _modules/graphnet/deployment/i3modules/graphnet_module.html rename to _modules/graphnet/deployment/icecube/cleaning_module.html index 5bb5c0a0e..90cb9682f 100644 --- a/_modules/graphnet/deployment/i3modules/graphnet_module.html +++ b/_modules/graphnet/deployment/icecube/cleaning_module.html @@ -60,7 +60,7 @@ - graphnet.deployment.i3modules.graphnet_module — graphnet documentation + graphnet.deployment.icecube.cleaning_module — graphnet documentation + + + + + + + + + + + + + + + + graphnet.deployment.icecube.inference_module — graphnet documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Skip to content +
+ +
+ + +
+ + + + +
+
+ +
+
+
+ +
+
+
+
+
+
+ + +
+
+
+ +
+
+ +

Source code for graphnet.deployment.icecube.inference_module

+"""IceCube I3InferenceModule.
+
+Contains functionality for writing model predictions to i3 files.
+"""
+from typing import List, Union, Optional, TYPE_CHECKING, Dict, Any
+
+import numpy as np
+from torch_geometric.data import Data, Batch
+
+from graphnet.utilities.config import ModelConfig
+from graphnet.deployment import DeploymentModule
+from graphnet.data.extractors.icecube import I3FeatureExtractor
+from graphnet.utilities.imports import has_icecube_package
+
+if has_icecube_package() or TYPE_CHECKING:
+    from icecube.icetray import (
+        I3Frame,
+    )  # pyright: reportMissingImports=false
+    from icecube.dataclasses import (
+        I3Double,
+    )  # pyright: reportMissingImports=false
+
+
+
+[docs] +class I3InferenceModule(DeploymentModule): + """General class for inference on i3 frames.""" + + def __init__( + self, + pulsemap_extractor: Union[ + List[I3FeatureExtractor], I3FeatureExtractor + ], + model_config: Union[ModelConfig, str], + state_dict: str, + model_name: str, + gcd_file: str, + features: Optional[List[str]] = None, + prediction_columns: Optional[Union[List[str], None]] = None, + pulsemap: Optional[str] = None, + ): + """General class for inference on I3Frames (physics). + + Arguments: + pulsemap_extractor: The extractor used to extract the pulsemap. + model_config: The ModelConfig (or path to it) that summarizes the + model used for inference. + state_dict: Path to state_dict containing the learned weights. + model_name: The name used for the model. Will help define the + named entry in the I3Frame. E.g. "dynedge". + gcd_file: path to associated gcd file. + features: the features of the pulsemap that the model is expecting. + prediction_columns: column names for the predictions of the model. + Will help define the named entry in the I3Frame. + E.g. ['energy_reco']. Optional. + pulsemap: the pulsmap that the model is expecting as input. + """ + super().__init__( + model_config=model_config, + state_dict=state_dict, + prediction_columns=prediction_columns, + ) + # Checks + assert isinstance(gcd_file, str), "gcd_file must be string" + + # Set Member Variables + if isinstance(pulsemap_extractor, list): + self._i3_extractors = pulsemap_extractor + else: + self._i3_extractors = [pulsemap_extractor] + if features is None: + features = self.model._graph_definition._input_feature_names + self._graph_definition = self.model._graph_definition + self._pulsemap = pulsemap + self._gcd_file = gcd_file + self.model_name = model_name + self._features = features + + # Set GCD file for pulsemap extractor + for i3_extractor in self._i3_extractors: + i3_extractor.set_gcd(i3_file="", gcd_file=self._gcd_file) + + def __call__(self, frame: I3Frame) -> bool: + """Write predictions from model to frame.""" + # inference + data = self._create_data_representation(frame=frame) + predictions = self._apply_model(data=data) + + # Check dimensions of predictions and prediction columns + dim = self._check_dimensions(predictions=predictions) + + # Build Dictionary from predictions + data = self._create_dictionary(dim=dim, predictions=predictions) + + # Submit Dictionary to frame + frame = self._add_to_frame(frame=frame, data=data) + return True + + def _check_dimensions(self, predictions: np.ndarray) -> int: + if len(predictions.shape) > 1: + dim = predictions.shape[1] + else: + dim = len(predictions) + try: + assert dim == len(self.prediction_columns) + except AssertionError as e: + self.error( + f"predictions have shape {dim} but" + f"prediction columns have [{self.prediction_columns}]" + ) + raise e + + assert predictions.shape[0] == 1 + return dim + + def _create_dictionary( + self, dim: int, predictions: np.ndarray + ) -> Dict[str, Any]: + """Transform predictions into a dictionary.""" + data = {} + for i in range(dim): + try: + assert len(predictions[:, i]) == 1 + data[ + self.model_name + "_" + self.prediction_columns[i] + ] = I3Double(float(predictions[:, i][0])) + except IndexError: + data[ + self.model_name + "_" + self.prediction_columns[i] + ] = I3Double(predictions[0]) + return data + + def _apply_model(self, data: Data) -> np.ndarray: + """Apply model to `Data` and case-handling.""" + if data is not None: + predictions = self._inference(data) + if isinstance(predictions, list): + predictions = predictions[0] + self.warning( + f"{self.__class__.__name__} assumes one Task " + f"but got {len(predictions)}. Only the first will" + " be used." + ) + else: + self.warning( + "At least one event has no pulses " + " - padding {self.prediction_columns} with NaN." + ) + predictions = np.repeat( + [np.nan], len(self.prediction_columns) + ).reshape(-1, len(self.prediction_columns)) + return predictions + + def _create_data_representation(self, frame: I3Frame) -> Data: + """Process Physics I3Frame into graph.""" + # Extract features + input_features = self._extract_feature_array_from_frame(frame) + # Prepare graph data + if len(input_features) > 0: + data = self._graph_definition( + input_features=input_features, + input_feature_names=self._features, + ) + return Batch.from_data_list([data]) + else: + return None + + def _extract_feature_array_from_frame(self, frame: I3Frame) -> np.array: + """Apply the I3FeatureExtractors to the I3Frame. + + Arguments: + frame: Physics I3Frame (PFrame) + + Returns: + array with pulsemap + """ + features = None + for i3extractor in self._i3_extractors: + feature_dict = i3extractor(frame) + features_pulsemap = np.array( + [feature_dict[key] for key in self._features] + ).T + if features is None: + features = features_pulsemap + else: + features = np.concatenate( + (features, features_pulsemap), axis=0 + ) + return features + + def _add_to_frame(self, frame: I3Frame, data: Dict[str, Any]) -> I3Frame: + """Add every field in data to I3Frame. + + Arguments: + frame: I3Frame (physics) + data: Dictionary containing content that will be written to frame. + + Returns: + frame: Same I3Frame as input, but with the new entries + """ + assert isinstance( + data, dict + ), f"data must be of type dict. Got {type(data)}" + for key in data.keys(): + if key not in frame: + frame.Put(key, data[key]) + return frame
+ +
+ +
+
+
+
+
+ + + + + \ No newline at end of file diff --git a/_modules/index.html b/_modules/index.html index c89560423..a12dd2724 100644 --- a/_modules/index.html +++ b/_modules/index.html @@ -359,7 +359,10 @@

All modules for which code is available

  • graphnet.data.writers.graphnet_writer
  • graphnet.data.writers.parquet_writer
  • graphnet.data.writers.sqlite_writer
  • -
  • graphnet.deployment.i3modules.graphnet_module
  • +
  • graphnet.deployment.deployer
  • +
  • graphnet.deployment.deployment_module
  • +
  • graphnet.deployment.icecube.cleaning_module
  • +
  • graphnet.deployment.icecube.inference_module
  • graphnet.models.coarsening
  • graphnet.models.components.embedding
  • graphnet.models.components.layers
  • diff --git a/_sources/api/graphnet.deployment.i3modules.deployer.rst.txt b/_sources/api/graphnet.deployment.deployer.rst.txt similarity index 57% rename from _sources/api/graphnet.deployment.i3modules.deployer.rst.txt rename to _sources/api/graphnet.deployment.deployer.rst.txt index e5266caa3..518251334 100644 --- a/_sources/api/graphnet.deployment.i3modules.deployer.rst.txt +++ b/_sources/api/graphnet.deployment.deployer.rst.txt @@ -2,7 +2,7 @@ deployer ======== -.. automodule:: graphnet.deployment.i3modules.deployer +.. automodule:: graphnet.deployment.deployer :members: :undoc-members: :show-inheritance: diff --git a/_sources/api/graphnet.deployment.deployment_module.rst.txt b/_sources/api/graphnet.deployment.deployment_module.rst.txt new file mode 100644 index 000000000..8b0692591 --- /dev/null +++ b/_sources/api/graphnet.deployment.deployment_module.rst.txt @@ -0,0 +1,8 @@ + +deployment\_module +================== + +.. automodule:: graphnet.deployment.deployment_module + :members: + :undoc-members: + :show-inheritance: diff --git a/_sources/api/graphnet.deployment.i3modules.deprecated_methods.rst.txt b/_sources/api/graphnet.deployment.i3modules.deprecated_methods.rst.txt new file mode 100644 index 000000000..064f4af69 --- /dev/null +++ b/_sources/api/graphnet.deployment.i3modules.deprecated_methods.rst.txt @@ -0,0 +1,8 @@ + +deprecated\_methods +=================== + +.. automodule:: graphnet.deployment.i3modules.deprecated_methods + :members: + :undoc-members: + :show-inheritance: diff --git a/_sources/api/graphnet.deployment.i3modules.graphnet_module.rst.txt b/_sources/api/graphnet.deployment.i3modules.graphnet_module.rst.txt deleted file mode 100644 index 45e2e93f3..000000000 --- a/_sources/api/graphnet.deployment.i3modules.graphnet_module.rst.txt +++ /dev/null @@ -1,8 +0,0 @@ - -graphnet\_module -================ - -.. automodule:: graphnet.deployment.i3modules.graphnet_module - :members: - :undoc-members: - :show-inheritance: diff --git a/_sources/api/graphnet.deployment.i3modules.rst.txt b/_sources/api/graphnet.deployment.i3modules.rst.txt index e7e2c8f33..11d13bcb3 100644 --- a/_sources/api/graphnet.deployment.i3modules.rst.txt +++ b/_sources/api/graphnet.deployment.i3modules.rst.txt @@ -15,8 +15,7 @@ i3modules .. toctree:: :maxdepth: 2 - graphnet.deployment.i3modules.deployer - graphnet.deployment.i3modules.graphnet_module + graphnet.deployment.i3modules.deprecated_methods diff --git a/_sources/api/graphnet.deployment.icecube.cleaning_module.rst.txt b/_sources/api/graphnet.deployment.icecube.cleaning_module.rst.txt new file mode 100644 index 000000000..f86925081 --- /dev/null +++ b/_sources/api/graphnet.deployment.icecube.cleaning_module.rst.txt @@ -0,0 +1,8 @@ + +cleaning\_module +================ + +.. automodule:: graphnet.deployment.icecube.cleaning_module + :members: + :undoc-members: + :show-inheritance: diff --git a/_sources/api/graphnet.deployment.icecube.i3deployer.rst.txt b/_sources/api/graphnet.deployment.icecube.i3deployer.rst.txt new file mode 100644 index 000000000..d7a08b69d --- /dev/null +++ b/_sources/api/graphnet.deployment.icecube.i3deployer.rst.txt @@ -0,0 +1,8 @@ + +i3deployer +========== + +.. automodule:: graphnet.deployment.icecube.i3deployer + :members: + :undoc-members: + :show-inheritance: diff --git a/_sources/api/graphnet.deployment.icecube.inference_module.rst.txt b/_sources/api/graphnet.deployment.icecube.inference_module.rst.txt new file mode 100644 index 000000000..cc8948488 --- /dev/null +++ b/_sources/api/graphnet.deployment.icecube.inference_module.rst.txt @@ -0,0 +1,8 @@ + +inference\_module +================= + +.. automodule:: graphnet.deployment.icecube.inference_module + :members: + :undoc-members: + :show-inheritance: diff --git a/_sources/api/graphnet.deployment.icecube.rst.txt b/_sources/api/graphnet.deployment.icecube.rst.txt new file mode 100644 index 000000000..cd2519bf2 --- /dev/null +++ b/_sources/api/graphnet.deployment.icecube.rst.txt @@ -0,0 +1,38 @@ + +icecube +======= + + +.. automodule:: graphnet.deployment.icecube + :members: + :undoc-members: + :show-inheritance: + + +|start-h2| Submodules |end-h2| + + +.. toctree:: + :maxdepth: 2 + + graphnet.deployment.icecube.cleaning_module + graphnet.deployment.icecube.i3deployer + graphnet.deployment.icecube.inference_module + + + +.. |start-h2| raw:: html + +

    + +.. |end-h2| raw:: html + +

    + +.. |start-h3| raw:: html + +

    + +.. |end-h3| raw:: html + +

    \ No newline at end of file diff --git a/_sources/api/graphnet.deployment.rst.txt b/_sources/api/graphnet.deployment.rst.txt index ed0dbc80e..7f3273ef4 100644 --- a/_sources/api/graphnet.deployment.rst.txt +++ b/_sources/api/graphnet.deployment.rst.txt @@ -15,6 +15,17 @@ deployment :maxdepth: 2 graphnet.deployment.i3modules + graphnet.deployment.icecube + +|start-h2| Submodules |end-h2| + + +.. toctree:: + :maxdepth: 2 + + graphnet.deployment.deployer + graphnet.deployment.deployment_module + .. |start-h2| raw:: html diff --git a/api/graphnet.data.dataclasses.html b/api/graphnet.data.dataclasses.html index 522ebf923..9a0ff4708 100644 --- a/api/graphnet.data.dataclasses.html +++ b/api/graphnet.data.dataclasses.html @@ -388,6 +388,18 @@
  • i3_file
  • gcd_file +
  • + + +
  • Settings
  • @@ -414,6 +426,41 @@ gcd_file + + + +
  • + + + Settings +
  • @@ -514,6 +561,18 @@
  • i3_file
  • gcd_file +
  • + + +
  • Settings
  • @@ -552,6 +611,38 @@ gcd_file: str
    +
    +
    +class graphnet.data.dataclasses.Settings(i3_files, gcd_file, output_folder, modules)[source]
    +

    Bases: object

    +

    Dataclass for workers in I3Deployer.

    +
    +
    Parameters:
    +
      +
    • i3_files (List[str]) –

    • +
    • gcd_file (str) –

    • +
    • output_folder (str) –

    • +
    • modules (List[Any]) –

    • +
    +
    +
    +
    +
    +i3_files: List[str]
    +
    +
    +
    +gcd_file: str
    +
    +
    +
    +output_folder: str
    +
    +
    +
    +modules: List[Any]
    +
    +
    diff --git a/api/graphnet.data.html b/api/graphnet.data.html index 2f19625ef..ea5ca2d92 100644 --- a/api/graphnet.data.html +++ b/api/graphnet.data.html @@ -541,6 +541,7 @@
  • dataclasses
  • dataconverter
  • @@ -398,8 +419,26 @@
    +
    +

    Submodules

    +
    + diff --git a/api/graphnet.deployment.i3modules.deployer.html b/api/graphnet.deployment.i3modules.deprecated_methods.html similarity index 92% rename from api/graphnet.deployment.i3modules.deployer.html rename to api/graphnet.deployment.i3modules.deprecated_methods.html index 9ebe17073..e4a56ae6a 100644 --- a/api/graphnet.deployment.i3modules.deployer.html +++ b/api/graphnet.deployment.i3modules.deprecated_methods.html @@ -61,7 +61,7 @@ - deployer — graphnet documentation + deprecated_methods — graphnet documentation + + + + + + + + + + + + + + + + icecube — graphnet documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Skip to content +
    + +
    + + +
    + + + + +
    +
    + +
    +
    +
    + +
    +
    +
    +
    +
    +
    + + +
    +
    +
    + +
    + +
    +
    +
    +
    + + + + + \ No newline at end of file diff --git a/api/graphnet.deployment.icecube.i3deployer.html b/api/graphnet.deployment.icecube.i3deployer.html new file mode 100644 index 000000000..ef9795a2c --- /dev/null +++ b/api/graphnet.deployment.icecube.i3deployer.html @@ -0,0 +1,498 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + i3deployer — graphnet documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Skip to content +
    + +
    + + +
    + + + + +
    +
    + +
    +
    +
    + +
    +
    +
    +
    +
    +
    + + +
    +
    +
    + +
    +
    + +
    +

    i3deployer

    +
    + + +
    +
    +
    +
    +
    + + + + + \ No newline at end of file diff --git a/api/graphnet.deployment.icecube.inference_module.html b/api/graphnet.deployment.icecube.inference_module.html new file mode 100644 index 000000000..b9937cf35 --- /dev/null +++ b/api/graphnet.deployment.icecube.inference_module.html @@ -0,0 +1,549 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + inference_module — graphnet documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Skip to content +
    + +
    + + +
    + + + + +
    +
    + +
    +
    +
    + +
    +
    +
    +
    +
    +
    + + +
    +
    +
    + +
    +
    + +
    +

    inference_module

    +

    IceCube I3InferenceModule.

    +

    Contains functionality for writing model predictions to i3 files.

    +
    +
    +class graphnet.deployment.icecube.inference_module.I3InferenceModule(pulsemap_extractor, model_config, state_dict, model_name, gcd_file, features, prediction_columns, pulsemap)[source]
    +

    Bases: DeploymentModule

    +

    General class for inference on i3 frames.

    +

    General class for inference on I3Frames (physics).

    +
    +
    Parameters:
    +
      +
    • pulsemap_extractor (Union[List[I3FeatureExtractor], I3FeatureExtractor]) – The extractor used to extract the pulsemap.

    • +
    • model_config (Union[ModelConfig, str]) – The ModelConfig (or path to it) that summarizes the +model used for inference.

    • +
    • state_dict (str) – Path to state_dict containing the learned weights.

    • +
    • model_name (str) – The name used for the model. Will help define the +named entry in the I3Frame. E.g. “dynedge”.

    • +
    • gcd_file (str) – path to associated gcd file.

    • +
    • features (Optional[List[str]], default: None) – the features of the pulsemap that the model is expecting.

    • +
    • prediction_columns (Optional[List[str]], default: None) –

      column names for the predictions of the model. +Will help define the named entry in the I3Frame.

      +
      +

      E.g. [‘energy_reco’]. Optional.

      +
      +

    • +
    • pulsemap (Optional[str], default: None) – the pulsmap that the model is expecting as input.

    • +
    +
    +
    +
    +
    + + +
    +
    +
    +
    +
    + + + + + \ No newline at end of file diff --git a/api/graphnet.html b/api/graphnet.html index f7cc7c801..44d85abf5 100644 --- a/api/graphnet.html +++ b/api/graphnet.html @@ -433,6 +433,9 @@
  • deployment
  • models
  • - - + @@ -2389,6 +2432,8 @@

    S

  • set_verbose_print_recursively() (graphnet.models.model.Model method)
  • setLevel() (graphnet.utilities.logging.Logger method) +
  • +
  • Settings (class in graphnet.data.dataclasses)