def infer_dtype(self): dtype = strax.merged_dtype( [self.deps[d].dtype_for(d) for d in self.depends_on]) dtype += [ ('x', np.float32, 'Reconstructed S2 X position (cm), uncorrected'), ('y', np.float32, 'Reconstructed S2 Y position (cm), uncorrected') ] return dtype
def infer_dtype(self): deps_by_kind = self.dependencies_by_kind() if len(deps_by_kind) != 1: raise ValueError("MergeOnlyPlugins can only merge data " "of the same kind, but got multiple kinds: " + str(deps_by_kind)) return strax.merged_dtype( [self.deps[d].dtype for d in self.depends_on])
def infer_dtype(self): deps_by_kind = self.dependencies_by_kind() if len(deps_by_kind) != 1: raise ValueError("MergeOnlyPlugins can only merge data " "of the same kind, but got multiple kinds: " + str(deps_by_kind)) return strax.merged_dtype([ self.deps[d].dtype_for(d) # Sorting is needed here to match what strax.Chunk does in merging for d in sorted(self.depends_on)])
def merge(cls, chunks, data_type='<UNKNOWN>'): """Create chunk by merging columns of chunks of same data kind :param chunks: Chunks to merge. None is allowed and will be ignored. :param data_type: data_type name of new created chunk. Set to <UNKNOWN> if not provided. """ chunks = [c for c in chunks if c is not None] if not chunks: raise ValueError("Need at least one chunk to merge") if len(chunks) == 1: return chunks[0] data_kinds = [c.data_kind for c in chunks] if len(set(data_kinds)) != 1: raise ValueError(f"Cannot merge chunks {chunks} of different" f" data kinds: {data_kinds}") data_kind = data_kinds[0] run_ids = [c.run_id for c in chunks] if len(set(run_ids)) != 1: raise ValueError( f"Cannot merge chunks of different run_ids: {chunks}") run_id = run_ids[0] if len(set([len(c) for c in chunks])) != 1: raise ValueError( f"Cannot merge chunks with different number of items: {chunks}") tranges = [(c.start, c.end) for c in chunks] if len(set(tranges)) != 1: raise ValueError("Cannot merge chunks with different time " f"ranges: {tranges}") start, end = tranges[0] data = strax.merge_arrs( [c.data for c in chunks], # Make sure dtype field order is consistent, regardless of the # order in which chunks are passed to merge: dtype=strax.merged_dtype( [c.dtype for c in sorted(chunks, key=lambda x: x.data_type)])) return cls( start=start, end=end, dtype=data.dtype, data_type=data_type, data_kind=data_kind, run_id=run_id, data=data, target_size_mb=max([c.target_size_mb for c in chunks]))
def infer_dtype(self): dtype = [self.deps[d].dtype_for(d) for d in self.depends_on] dtype = strax.merged_dtype(dtype) return dtype
def infer_dtype(self): return strax.merged_dtype( [self.deps[d].dtype_for(d) for d in self.depends_on])