예제 #1
0
 def get_array(self,
               run_id: ty.Union[str, tuple, list],
               targets,
               save=tuple(),
               max_workers=None,
               **kwargs) -> np.ndarray:
     """Compute target for run_id and return as numpy array
     {get_docs}
     """
     run_ids = strax.to_str_tuple(run_id)
     if len(run_ids) > 1:
         results = strax.multi_run(self.get_array,
                                   run_ids,
                                   targets=targets,
                                   save=save,
                                   max_workers=max_workers,
                                   **kwargs)
     else:
         results = list(
             self.get_iter(run_ids[0],
                           targets,
                           save=save,
                           max_workers=max_workers,
                           **kwargs))
     if len(results):
         return np.concatenate(results)
     raise ValueError("No results returned?")
예제 #2
0
 def get_array(self,
               run_id: ty.Union[str, tuple, list],
               targets,
               save=tuple(),
               max_workers=None,
               **kwargs) -> np.ndarray:
     """Compute target for run_id and return as numpy array
     {get_docs}
     """
     run_ids = strax.to_str_tuple(run_id)
     if len(run_ids) > 1:
         results = strax.multi_run(self.get_array,
                                   run_ids,
                                   targets=targets,
                                   save=save,
                                   max_workers=max_workers,
                                   **kwargs)
     else:
         source = self.get_iter(run_ids[0],
                                targets,
                                save=save,
                                max_workers=max_workers,
                                **kwargs)
         results = [x.data for x in source]
     return np.concatenate(results)
예제 #3
0
    def make(self,
             run_id: ty.Union[str, tuple, list],
             targets,
             save=tuple(),
             max_workers=None,
             **kwargs) -> None:
        """Compute target for run_id. Returns nothing (None).
        {get_docs}
        """
        # Multi-run support
        run_ids = strax.to_str_tuple(run_id)
        if len(run_ids) > 1:
            return strax.multi_run(self.make,
                                   run_ids,
                                   targets=targets,
                                   save=save,
                                   max_workers=max_workers,
                                   **kwargs)

        for _ in self.get_iter(run_ids[0],
                               targets,
                               save=save,
                               max_workers=max_workers,
                               **kwargs):
            pass
예제 #4
0
    def make(self,
             run_id: ty.Union[str, tuple, list],
             targets,
             save=tuple(),
             max_workers=None,
             _skip_if_built=True,
             **kwargs) -> None:
        """Compute target for run_id. Returns nothing (None).
        {get_docs}
        """
        # Multi-run support
        run_ids = strax.to_str_tuple(run_id)
        if len(run_ids) == 0:
            raise ValueError("Cannot build empty list of runs")
        if len(run_ids) > 1:
            return strax.multi_run(self.get_array,
                                   run_ids,
                                   targets=targets,
                                   throw_away_result=True,
                                   save=save,
                                   max_workers=max_workers,
                                   **kwargs)

        if _skip_if_built and self.is_stored(run_id, targets):
            return

        for _ in self.get_iter(run_ids[0],
                               targets,
                               save=save,
                               max_workers=max_workers,
                               **kwargs):
            pass