core
The core directory includes infrastructural components of the software: file IO, python bindings, basic containers for plain data, the definition of G3Pipeline, etc.
API Documentation
Frame Objects
Serializable objects that may be stored as entries in G3Frame
objects.
- class spt3g.core.G3Bool(arg: G3Bool)
- class spt3g.core.G3Bool(arg: bool)
Bases:
G3FrameObject
Serializable boolean type
Signature 1: Copy constructor
- Description() str
Long-form human-readable description of the object
- Summary() str
Short (one-line) description of the object
- property value: bool
- class spt3g.core.G3Double(arg: G3Double)
- class spt3g.core.G3Double(arg: float)
Bases:
G3FrameObject
Serializable double
Signature 1: Copy constructor
- Description() str
Long-form human-readable description of the object
- Summary() str
Short (one-line) description of the object
- property value: float
- class spt3g.core.G3FrameObject
Base class for objects that can be added to a frame. All such must inherit from G3FrameObject in C++. Pickle hooks are overridden to use the fast internal serialization
- Description() str
Long-form human-readable description of the object
- Summary() str
Short (one-line) description of the object
- property hash: bytes
Return the serialized representation of the object
- class spt3g.core.G3Int(arg: G3Int)
- class spt3g.core.G3Int(arg: int)
Bases:
G3FrameObject
Serializable integer type
Signature 1: Copy constructor
- Description() str
Long-form human-readable description of the object
- Summary() str
Short (one-line) description of the object
- property value: int
- class spt3g.core.G3MapDouble()
- class spt3g.core.G3MapDouble(arg: G3MapDouble)
- class spt3g.core.G3MapDouble(arg: Iterable)
Bases:
_G3MapDoubleBaseMap
,G3FrameObject
Mapping from strings to floats
Signature 2: Copy constructor
Signature 3: Iterable constructor
- clear()
Remove all items from the mapping.
- copy() G3MapDouble
Return a shallow copy of the mapping.
- get(key: str, default: object = None) object
Return the value for key if key is in the mapping, else default.
- pop(key: str) float
- pop(key: str, default: object) object
Signature 1: Remove specified key and return the corresponding value. If the key is not found, raise a KeyError
Signature 2: Remove specified key and return the corresponding value. If the key is not found, return the default
- update(items: Iterable = [], **kwargs)
Update mapping from iterable/mapping.
- values() ValuesView
Return an object providing a view on the mappings’s values.
- class spt3g.core.G3MapFrameObject()
- class spt3g.core.G3MapFrameObject(arg: G3MapFrameObject)
- class spt3g.core.G3MapFrameObject(arg: Iterable)
Bases:
_G3MapFrameObjectBaseMap
,G3FrameObject
Mapping strings to generic frame objects. Can lead to a variety of paradoxes; please avoid general use of this class.
Signature 2: Copy constructor
Signature 3: Iterable constructor
- clear()
Remove all items from the mapping.
- copy() G3MapFrameObject
Return a shallow copy of the mapping.
- get(key: str, default: object = None) object
Return the value for key if key is in the mapping, else default.
- pop(key: str) G3FrameObject
- pop(key: str, default: object) object
Signature 1: Remove specified key and return the corresponding value. If the key is not found, raise a KeyError
Signature 2: Remove specified key and return the corresponding value. If the key is not found, return the default
- update(items: Iterable = [], **kwargs)
Update mapping from iterable/mapping.
- values() ValuesView
Return an object providing a view on the mappings’s values.
- class spt3g.core.G3MapInt()
- class spt3g.core.G3MapInt(arg: G3MapInt)
- class spt3g.core.G3MapInt(arg: Iterable)
Bases:
_G3MapIntBaseMap
,G3FrameObject
Mapping from strings to ints.
Signature 2: Copy constructor
Signature 3: Iterable constructor
- clear()
Remove all items from the mapping.
- get(key: str, default: object = None) object
Return the value for key if key is in the mapping, else default.
- pop(key: str) int
- pop(key: str, default: object) object
Signature 1: Remove specified key and return the corresponding value. If the key is not found, raise a KeyError
Signature 2: Remove specified key and return the corresponding value. If the key is not found, return the default
- update(items: Iterable = [], **kwargs)
Update mapping from iterable/mapping.
- values() ValuesView
Return an object providing a view on the mappings’s values.
- class spt3g.core.G3MapMapDouble()
- class spt3g.core.G3MapMapDouble(arg: G3MapMapDouble)
- class spt3g.core.G3MapMapDouble(arg: Iterable)
Bases:
_G3MapMapDoubleBaseMap
,G3FrameObject
Mapping from strings to maps of strings to floats. For example, m[‘Det1’][‘Det2’] = 5.3
Signature 2: Copy constructor
Signature 3: Iterable constructor
- clear()
Remove all items from the mapping.
- copy() G3MapMapDouble
Return a shallow copy of the mapping.
- get(key: str, default: object = None) object
Return the value for key if key is in the mapping, else default.
- pop(key: str) G3MapDouble
- pop(key: str, default: object) object
Signature 1: Remove specified key and return the corresponding value. If the key is not found, raise a KeyError
Signature 2: Remove specified key and return the corresponding value. If the key is not found, return the default
- update(items: Iterable = [], **kwargs)
Update mapping from iterable/mapping.
- values() ValuesView
Return an object providing a view on the mappings’s values.
- class spt3g.core.G3MapQuat()
- class spt3g.core.G3MapQuat(arg: G3MapQuat)
- class spt3g.core.G3MapQuat(arg: Iterable)
Bases:
_G3MapQuatBaseMap
,G3FrameObject
Mapping from strings to quaternions.
Signature 2: Copy constructor
Signature 3: Iterable constructor
- clear()
Remove all items from the mapping.
- get(key: str, default: object = None) object
Return the value for key if key is in the mapping, else default.
- pop(key: str) Quat
- pop(key: str, default: object) object
Signature 1: Remove specified key and return the corresponding value. If the key is not found, raise a KeyError
Signature 2: Remove specified key and return the corresponding value. If the key is not found, return the default
- update(items: Iterable = [], **kwargs)
Update mapping from iterable/mapping.
- values() ValuesView
Return an object providing a view on the mappings’s values.
- class spt3g.core.G3MapString()
- class spt3g.core.G3MapString(arg: G3MapString)
- class spt3g.core.G3MapString(arg: Iterable)
Bases:
_G3MapStringBaseMap
,G3FrameObject
Mapping from strings to strings.
Signature 2: Copy constructor
Signature 3: Iterable constructor
- clear()
Remove all items from the mapping.
- copy() G3MapString
Return a shallow copy of the mapping.
- get(key: str, default: object = None) object
Return the value for key if key is in the mapping, else default.
- pop(key: str) str
- pop(key: str, default: object) object
Signature 1: Remove specified key and return the corresponding value. If the key is not found, raise a KeyError
Signature 2: Remove specified key and return the corresponding value. If the key is not found, return the default
- update(items: Iterable = [], **kwargs)
Update mapping from iterable/mapping.
- values() ValuesView
Return an object providing a view on the mappings’s values.
- class spt3g.core.G3MapTime()
- class spt3g.core.G3MapTime(arg: G3MapTime)
- class spt3g.core.G3MapTime(arg: Iterable)
Bases:
_G3MapTimeBaseMap
,G3FrameObject
Mapping from strings to G3Times.
Signature 2: Copy constructor
Signature 3: Iterable constructor
- clear()
Remove all items from the mapping.
- get(key: str, default: object = None) object
Return the value for key if key is in the mapping, else default.
- pop(key: str) G3Time
- pop(key: str, default: object) object
Signature 1: Remove specified key and return the corresponding value. If the key is not found, raise a KeyError
Signature 2: Remove specified key and return the corresponding value. If the key is not found, return the default
- update(items: Iterable = [], **kwargs)
Update mapping from iterable/mapping.
- values() ValuesView
Return an object providing a view on the mappings’s values.
- class spt3g.core.G3MapVectorBool()
- class spt3g.core.G3MapVectorBool(arg: G3MapVectorBool)
- class spt3g.core.G3MapVectorBool(arg: Iterable)
Bases:
_G3MapVectorBoolBaseMap
,G3FrameObject
Mapping from strings to arrays of booleans.
Signature 2: Copy constructor
Signature 3: Iterable constructor
- clear()
Remove all items from the mapping.
- copy() G3MapVectorBool
Return a shallow copy of the mapping.
- get(key: str, default: object = None) object
Return the value for key if key is in the mapping, else default.
- pop(key: str) BoolVector
- pop(key: str, default: object) object
Signature 1: Remove specified key and return the corresponding value. If the key is not found, raise a KeyError
Signature 2: Remove specified key and return the corresponding value. If the key is not found, return the default
- update(items: Iterable = [], **kwargs)
Update mapping from iterable/mapping.
- values() ValuesView
Return an object providing a view on the mappings’s values.
- class spt3g.core.G3MapVectorComplexDouble()
- class spt3g.core.G3MapVectorComplexDouble(arg: G3MapVectorComplexDouble)
- class spt3g.core.G3MapVectorComplexDouble(arg: Iterable)
Bases:
_G3MapVectorComplexDoubleBaseMap
,G3FrameObject
Mapping from strings to arrays of complex numbers.
Signature 2: Copy constructor
Signature 3: Iterable constructor
- clear()
Remove all items from the mapping.
- copy() G3MapVectorComplexDouble
Return a shallow copy of the mapping.
- get(key: str, default: object = None) object
Return the value for key if key is in the mapping, else default.
- pop(key: str) ComplexDoubleVector
- pop(key: str, default: object) object
Signature 1: Remove specified key and return the corresponding value. If the key is not found, raise a KeyError
Signature 2: Remove specified key and return the corresponding value. If the key is not found, return the default
- update(items: Iterable = [], **kwargs)
Update mapping from iterable/mapping.
- values() ValuesView
Return an object providing a view on the mappings’s values.
- class spt3g.core.G3MapVectorDouble()
- class spt3g.core.G3MapVectorDouble(arg: G3MapVectorDouble)
- class spt3g.core.G3MapVectorDouble(arg: Iterable)
Bases:
_G3MapVectorDoubleBaseMap
,G3FrameObject
Mapping from strings to arrays of floats.
Signature 2: Copy constructor
Signature 3: Iterable constructor
- clear()
Remove all items from the mapping.
- copy() G3MapVectorDouble
Return a shallow copy of the mapping.
- get(key: str, default: object = None) object
Return the value for key if key is in the mapping, else default.
- pop(key: str) DoubleVector
- pop(key: str, default: object) object
Signature 1: Remove specified key and return the corresponding value. If the key is not found, raise a KeyError
Signature 2: Remove specified key and return the corresponding value. If the key is not found, return the default
- update(items: Iterable = [], **kwargs)
Update mapping from iterable/mapping.
- values() ValuesView
Return an object providing a view on the mappings’s values.
- class spt3g.core.G3MapVectorInt()
- class spt3g.core.G3MapVectorInt(arg: G3MapVectorInt)
- class spt3g.core.G3MapVectorInt(arg: Iterable)
Bases:
_G3MapVectorIntBaseMap
,G3FrameObject
Mapping from strings to arrays of integers.
Signature 2: Copy constructor
Signature 3: Iterable constructor
- clear()
Remove all items from the mapping.
- copy() G3MapVectorInt
Return a shallow copy of the mapping.
- get(key: str, default: object = None) object
Return the value for key if key is in the mapping, else default.
- pop(key: str) Int64Vector
- pop(key: str, default: object) object
Signature 1: Remove specified key and return the corresponding value. If the key is not found, raise a KeyError
Signature 2: Remove specified key and return the corresponding value. If the key is not found, return the default
- update(items: Iterable = [], **kwargs)
Update mapping from iterable/mapping.
- values() ValuesView
Return an object providing a view on the mappings’s values.
- class spt3g.core.G3MapVectorQuat()
- class spt3g.core.G3MapVectorQuat(arg: G3MapVectorQuat)
- class spt3g.core.G3MapVectorQuat(arg: Iterable)
Bases:
_G3MapVectorQuatBaseMap
,G3FrameObject
Mapping from strings to lists of quaternions.
Signature 2: Copy constructor
Signature 3: Iterable constructor
- clear()
Remove all items from the mapping.
- copy() G3MapVectorQuat
Return a shallow copy of the mapping.
- get(key: str, default: object = None) object
Return the value for key if key is in the mapping, else default.
- pop(key: str) G3VectorQuat
- pop(key: str, default: object) object
Signature 1: Remove specified key and return the corresponding value. If the key is not found, raise a KeyError
Signature 2: Remove specified key and return the corresponding value. If the key is not found, return the default
- update(items: Iterable = [], **kwargs)
Update mapping from iterable/mapping.
- values() ValuesView
Return an object providing a view on the mappings’s values.
- class spt3g.core.G3MapVectorString()
- class spt3g.core.G3MapVectorString(arg: G3MapVectorString)
- class spt3g.core.G3MapVectorString(arg: Iterable)
Bases:
_G3MapVectorStringBaseMap
,G3FrameObject
Mapping from strings to lists of strings.
Signature 2: Copy constructor
Signature 3: Iterable constructor
- clear()
Remove all items from the mapping.
- copy() G3MapVectorString
Return a shallow copy of the mapping.
- get(key: str, default: object = None) object
Return the value for key if key is in the mapping, else default.
- pop(key: str) StringVector
- pop(key: str, default: object) object
Signature 1: Remove specified key and return the corresponding value. If the key is not found, raise a KeyError
Signature 2: Remove specified key and return the corresponding value. If the key is not found, return the default
- update(items: Iterable = [], **kwargs)
Update mapping from iterable/mapping.
- values() ValuesView
Return an object providing a view on the mappings’s values.
- class spt3g.core.G3MapVectorTime()
- class spt3g.core.G3MapVectorTime(arg: G3MapVectorTime)
- class spt3g.core.G3MapVectorTime(arg: Iterable)
Bases:
_G3MapVectorTimeBaseMap
,G3FrameObject
Mapping from strings to lists of G3 time objects.
Signature 2: Copy constructor
Signature 3: Iterable constructor
- clear()
Remove all items from the mapping.
- copy() G3MapVectorTime
Return a shallow copy of the mapping.
- get(key: str, default: object = None) object
Return the value for key if key is in the mapping, else default.
- pop(key: str) G3VectorTime
- pop(key: str, default: object) object
Signature 1: Remove specified key and return the corresponding value. If the key is not found, raise a KeyError
Signature 2: Remove specified key and return the corresponding value. If the key is not found, return the default
- update(items: Iterable = [], **kwargs)
Update mapping from iterable/mapping.
- values() ValuesView
Return an object providing a view on the mappings’s values.
- class spt3g.core.G3MapVectorVectorString()
- class spt3g.core.G3MapVectorVectorString(arg: G3MapVectorVectorString)
- class spt3g.core.G3MapVectorVectorString(arg: Iterable)
Bases:
_G3MapVectorVectorStringBaseMap
,G3FrameObject
Mapping from strings to lists of lists of strings.
Signature 2: Copy constructor
Signature 3: Iterable constructor
- clear()
Remove all items from the mapping.
- copy() G3MapVectorVectorString
Return a shallow copy of the mapping.
- get(key: str, default: object = None) object
Return the value for key if key is in the mapping, else default.
- pop(key: str) G3VectorVectorString
- pop(key: str, default: object) object
Signature 1: Remove specified key and return the corresponding value. If the key is not found, raise a KeyError
Signature 2: Remove specified key and return the corresponding value. If the key is not found, return the default
- update(items: Iterable = [], **kwargs)
Update mapping from iterable/mapping.
- values() ValuesView
Return an object providing a view on the mappings’s values.
- class spt3g.core.G3ModuleConfig(arg: G3ModuleConfig)
- class spt3g.core.G3ModuleConfig()
Bases:
G3FrameObject
Stored configuration of a pipeline module or segment
Signature 1: Copy constructor
- Description() str
Long-form human-readable description of the object
- Summary() str
Short (one-line) description of the object
- keys() list
- values() list
- property instancename: str
- property modname: str
- class spt3g.core.G3PipelineInfo(arg: G3PipelineInfo)
- class spt3g.core.G3PipelineInfo()
Bases:
G3FrameObject
Stored configuration of a pipeline, including software version information
Signature 1: Copy constructor
- Description() str
Long-form human-readable description of the object
- Run()
- Summary() str
Short (one-line) description of the object
- property hostname: str
- property modules: ModuleConfigVector
- property user: str
- property vcs_branch: str
- property vcs_fullversion: str
- property vcs_githash: str
- property vcs_localdiffs: bool
- property vcs_revision: str
- property vcs_url: str
- property vcs_versionname: str
- class spt3g.core.G3Quat(arg: G3Quat)
- class spt3g.core.G3Quat(arg: Quat)
Bases:
G3FrameObject
Serializable quaternion
Signature 1: Copy constructor
- Description() str
Long-form human-readable description of the object
- Summary() str
Short (one-line) description of the object
- class spt3g.core.G3String(arg: G3String)
- class spt3g.core.G3String(arg: str)
Bases:
G3FrameObject
Serializable string
Signature 1: Copy constructor
- Description() str
Long-form human-readable description of the object
- Summary() str
Short (one-line) description of the object
- property value: str
- class spt3g.core.G3Time(arg: G3Time)
- class spt3g.core.G3Time()
- class spt3g.core.G3Time(y: int, d: int, h: int, m: int, s: int, ss: int)
- class spt3g.core.G3Time(arg: str)
- class spt3g.core.G3Time(timestamp: int)
- class spt3g.core.G3Time(timestamp: float)
Bases:
G3FrameObject
UTC Time
Signature 1: Copy constructor
Signature 3: Create a timestamp object from IRIG B code
Signature 4: Create a time object from a string representation. Supported formats are: YYYYMMDD_HHMMSS, YYMMDD_HHMMSS, YYMMDD HH:MM:SS, DD-Mon-YYYY:HH:MM:SS, YYYY-MM-DDTHH:MM:SS[+TZ] (ISO 8601). All can have a fraction of second field after a dot.
Signature 5: Create a G3Time from an integer timestamp
Signature 6: Create a G3Time from a floating point timestamp
- Description() str
Long-form human-readable description of the object
- GetFileFormatString() str
Get a string corresponding to how SPTpol and GCP name files for this time
- Summary() str
Short (one-line) description of the object
- isoformat() str
Return the ISO 8601 formatted timestamp string
- property mjd: float
Time in MJD
- property time: int
Time relative to the UNIX epoch
- class spt3g.core.G3TimesampleMap()
- class spt3g.core.G3TimesampleMap(arg: G3TimesampleMap)
- class spt3g.core.G3TimesampleMap(arg: Iterable)
Bases:
_G3MapFrameObjectBaseMap
,G3FrameObject
Mapping from string to vectors of data, with an associated vector of timestamps. This object is for storing multiple co-sampled vectors with a single set of (irregular) timestamps.
Signature 2: Copy constructor
Signature 3: Iterable constructor
- check() bool
Check for internal consistency. Raises ValueError if there are problems.
- clear()
Remove all items from the mapping.
- concatenate(
- arg: G3TimesampleMap,
Concatenate two compatible G3TimesampleMap.
- copy() G3TimesampleMap
Return a shallow copy of the mapping.
- get(key: str, default: object = None) object
Return the value for key if key is in the mapping, else default.
- pop(key: str) G3FrameObject
- pop(key: str, default: object) object
Signature 1: Remove specified key and return the corresponding value. If the key is not found, raise a KeyError
Signature 2: Remove specified key and return the corresponding value. If the key is not found, return the default
- sort()
Sort all element vectors by time, in-place.
- update(items: Iterable = [], **kwargs)
Update mapping from iterable/mapping.
- values() ValuesView
Return an object providing a view on the mappings’s values.
- property times: G3VectorTime
Times vector. Setting this stores a copy, but getting returns a reference.
- class spt3g.core.G3Timestream(arg: G3Timestream)
- class spt3g.core.G3Timestream()
- class spt3g.core.G3Timestream(data: Buffer, units: G3TimestreamUnits = None)
- class spt3g.core.G3Timestream(data: Iterable, units: G3TimestreamUnits = None)
Bases:
G3FrameObject
Detector timestream. Includes a units field and start and stop times. Can otherwise be treated as a numpy array with a float64 dtype. Conversions to and from such arrays (e.g. with numpy.asarray) are fast. Note that a numpy array constructed from a timestream will share a memory buffer: changes to the array affect the timestream and vice versa. Most binary timestream arithmetic operations (+, -) check that the units and start/stop times are congruent.
Signature 1: Copy constructor
Signature 3: Create a timestream from a numpy array
Signature 4: Create a timestream from a numeric python iterable
- classmethod concatenate(ts_lst, ts_rounding_error=0.6, ts_interp_threshold=0)
Concatenate G3Timestream objects together.
- Parameters:
ts_lst (list) – list of G3Timestream objects.
ts_rounding_error (float) – allowed error in timestream separation such that timestreams are contiguous, as a fraction of the sample rate. This should be 0 by default, but is 0.5 to allow for downsampler shifting, and then bumpted again to 0.6 to allow for floating-point errors in what 0.5 is.
ts_interp_threshold (float) – allowed timestream separation below which gaps between timestreams are interpolated to be made continuous
- Returns:
ts – The concatenation of the input list of G3Timestream objects
- Return type:
G3Timestream instance
- Description() str
Long-form human-readable description of the object
- SetFLACBitDepth(arg: int)
Change the bit depth for FLAC compression, may be 24 or 32 (default, requires version 1.4+).
- SetFLACCompression(arg: int)
Pass True to turn on FLAC compression when serialized. FLAC compression only works if the timestream is in units of counts.
- Summary() str
Short (one-line) description of the object
- all(axis=None, out=None, keepdims=False, *, where=True)
Returns True if all elements evaluate to True.
Refer to numpy.all for full documentation.
See also
numpy.all
equivalent function
- any(axis=None, out=None, keepdims=False, *, where=True)
Returns True if any of the elements of a evaluate to True.
Refer to numpy.any for full documentation.
See also
numpy.any
equivalent function
- argmax(axis=None, out=None, *, keepdims=False)
Return indices of the maximum values along the given axis.
Refer to numpy.argmax for full documentation.
See also
numpy.argmax
equivalent function
- argmin(axis=None, out=None, *, keepdims=False)
Return indices of the minimum values along the given axis.
Refer to numpy.argmin for detailed documentation.
See also
numpy.argmin
equivalent function
- astype(dtype)
Convert timestream to a different data type. See numpy.array.astype()
- max(axis=None, out=None, keepdims=False, initial=<no value>, where=True)
Return the maximum along a given axis.
Refer to numpy.amax for full documentation.
See also
numpy.amax
equivalent function
- mean(axis=None, dtype=None, out=None, keepdims=False, *, where=True)
Returns the average of the array elements along given axis.
Refer to numpy.mean for full documentation.
See also
numpy.mean
equivalent function
- min(axis=None, out=None, keepdims=False, initial=<no value>, where=True)
Return the minimum along a given axis.
Refer to numpy.amin for full documentation.
See also
numpy.amin
equivalent function
- std(
- axis=None,
- dtype=None,
- out=None,
- ddof=0,
- keepdims=False,
- *,
- where=True,
Returns the standard deviation of the array elements along given axis.
Refer to numpy.std for full documentation.
See also
numpy.std
equivalent function
- sum(
- axis=None,
- dtype=None,
- out=None,
- keepdims=False,
- initial=0,
- where=True,
Return the sum of the array elements over the given axis.
Refer to numpy.sum for full documentation.
See also
numpy.sum
equivalent function
- var(
- axis=None,
- dtype=None,
- out=None,
- ddof=0,
- keepdims=False,
- *,
- where=True,
Returns the variance of the array elements, along given axis.
Refer to numpy.var for full documentation.
See also
numpy.var
equivalent function
- property bit_depth: int
Bit depth of FLAC compression used for this timestream.
- property compression_level: int
Level of FLAC compression used for this timestream. This can only be non-zero if the timestream is in units of counts.
- property dtype
Numpy data type of stored data.
- property elapsed: G3VectorInt
Compute elapsed time array for samples
- property n_samples: int
Number of samples in the timestream. Equivalent to len(ts)
- property ndim: int
Numpy-compatible number of dimensions
- property sample_rate: float
Computed sample rate of the timestream.
- property shape: tuple
Numpy-compatible shape of this timestream
- property times: G3VectorTime
Compute time vector for samples
- property units: G3TimestreamUnits
Units of the data in the timestream, stored as one of the members of core.G3TimestreamUnits.
- class spt3g.core.G3TimestreamMap()
- class spt3g.core.G3TimestreamMap(arg: G3TimestreamMap)
- class spt3g.core.G3TimestreamMap(arg: Iterable)
- class spt3g.core.G3TimestreamMap(
- keys: Iterable,
- data: Buffer,
- start: G3Time = spt3g.core.G3Time(0),
- stop: G3Time = spt3g.core.G3Time(0),
- units: G3TimestreamUnits = None,
- compression_level: int = 0,
- copy_data: bool = True,
- bit_depth: int = 32,
- class spt3g.core.G3TimestreamMap(
- keys: Iterable,
- data: Iterable,
- start: G3Time = spt3g.core.G3Time(0),
- stop: G3Time = spt3g.core.G3Time(0),
- units: G3TimestreamUnits = None,
- compression_level: int = 0,
- bit_depth: int = 32,
Bases:
G3FrameObject
Collection of timestreams indexed by logical detector ID
Signature 2: Copy constructor
Signature 3: Iterable constructor
Signature 4: Create a timestream map from a numpy array. Each row of the 2D input array will correspond to a single timestream, with the key set to the correspondingly-indexed entry of <keys>. If <copy_data> is True (default), the data will be copied into the output data structure. If False, the timestream map will provide a view into the given numpy array.
Signature 5: Create a timestream map from a numeric python iterable. Each row of the 2D input array will correspond to a single timestream, with the key set to the correspondingly-indexed entry of <keys>.
- classmethod concatenate(
- ts_map_lst,
- ts_rounding_error=0.6,
- ts_interp_threshold=0,
- skip_missing=False,
Concatenate G3TimestreamMap objects together.
- Parameters:
ts_map_lst (list) – list of G3TimestreamMap objects.
ts_rounding_error (float) – allowed error in timestream separation such that timestreams are contiguous, as a fraction of the sample rate. This should be 0 by default, but is 0.5 to allow for downsampler shifting, and then bumpted again to 0.6 to allow for floating-point errors in what 0.5 is.
ts_interp_threshold (float) – allowed timestream separation below which gaps between timestreams are interpolated to be made continuous
skip_missing (bool) – If True, include only the channels that are present in all of the input G3TimestreamMap object. Otherwise, raises an error if any map does not have the same keys.
- Returns:
tsm – The concatenation of the input list of G3TimestreamMap objects
- Return type:
G3TimestreamMap instance
- CheckAlignment() bool
- Compactify()
If member timestreams are stored non-contiguously, repack all data into a contiguous block. Requires timestreams be aligned and the same data type. Done implicitly by numpy.asarray().
- SetFLACBitDepth(arg: int)
Change the bit depth for FLAC compression, may be 24 or 32 (default, requires version 1.4+).
- SetFLACCompression(arg: int)
Pass True to turn on FLAC compression when serialized. FLAC compression only works if the timestreams are in units of counts.
- astype(dtype)
Convert timestream map to a different data type. See numpy.array.astype()
- clear()
Remove all items from the mapping.
- copy() G3TimestreamMap
Return a shallow copy of the mapping.
- get(key: str, default: object = None) object
Return the value for key if key is in the mapping, else default.
- pop(key: str) G3Timestream
- pop(key: str, default: object) object
Signature 1: Remove specified key and return the corresponding value. If the key is not found, raise a KeyError
Signature 2: Remove specified key and return the corresponding value. If the key is not found, return the default
- std(
- axis=None,
- dtype=None,
- out=None,
- ddof=0,
- keepdims=False,
- *,
- where=True,
Returns the standard deviation of the array elements along given axis.
Refer to numpy.std for full documentation.
See also
numpy.std
equivalent function
- update(items: Iterable = [], **kwargs)
Update mapping from iterable/mapping.
- values() ValuesView
Return an object providing a view on the mappings’s values.
- var(
- axis=None,
- dtype=None,
- out=None,
- ddof=0,
- keepdims=False,
- *,
- where=True,
Returns the variance of the array elements, along given axis.
Refer to numpy.var for full documentation.
See also
numpy.var
equivalent function
- property bit_depth: int
Bit depth of FLAC compression used for this timestream map.
- property compression_level: int
Level of FLAC compression used for this timestream map. This can only be non-zero if the timestream is in units of counts.
- property data
Return a numpy array view into the underlying 2D array of the timestream map
- property dtype
Numpy data type of stored data.
- property elapsed: G3VectorInt
Compute elapsed time array for samples
- property n_samples: int
Number of samples in the timestream. Equivalent to the length of one of the timestreams.
- property names
Get timestream map channel names.
- property sample_rate: float
Computed sample rate of the timestream.
- property times: G3VectorTime
Compute time vector for samples
- property units: G3TimestreamUnits
Units of the data in the timestream, stored as one of the members of core.G3TimestreamUnits.
- class spt3g.core.G3TimestreamQuat(arg: Buffer)
- class spt3g.core.G3TimestreamQuat()
- class spt3g.core.G3TimestreamQuat(arg: G3TimestreamQuat)
- class spt3g.core.G3TimestreamQuat(arg: Iterable)
Bases:
G3VectorQuat
,QuatVector
,G3FrameObject
Timestream of quaternions. Identical to a G3VectorQuat except for the addition of start and stop times.
Signature 1: Constructor from numpy array
Signature 3: Copy constructor
- abs() G3Timestream
Return the Euclidean norm of each quaternion
- clear()
Clear the contents
- cross3(arg: Quat) G3TimestreamQuat
Cross product of last three entries of each quaternion with the input
- dot3(arg: Quat) G3Timestream
Dot product of last three entries of each quaternion with the input
- extend(L: G3TimestreamQuat)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- norm() G3Timestream
Return the Cayley norm of each quaternion
- pop() Quat
- pop(i: int) Quat
Signature 1: Remove and return the last item
Signature 2: Remove and return the item at index
i
- remove(x: Quat)
Remove the first item from the list whose value is x. It is an error if there is no such item.
- vnorm() G3Timestream
Return the Cayley norm of the unreal (vector) part of each quaternion
- property n_samples: int
Number of samples in the timestream. Equivalent to len(ts)
- property real: G3Timestream
Return the real (scalar) part of each quaternion
- property sample_rate: float
Computed sample rate of the timestream.
- class spt3g.core.G3VectorBool()
- class spt3g.core.G3VectorBool(arg: G3VectorBool)
- class spt3g.core.G3VectorBool(arg: Iterable)
Bases:
BoolVector
,G3FrameObject
List of booleans.
Signature 2: Copy constructor
- all(axis=None, out=None, keepdims=False, *, where=True)
Returns True if all elements evaluate to True.
Refer to numpy.all for full documentation.
See also
numpy.all
equivalent function
- any(axis=None, out=None, keepdims=False, *, where=True)
Returns True if any of the elements of a evaluate to True.
Refer to numpy.any for full documentation.
See also
numpy.any
equivalent function
- append(x: bool)
Add an item to the end of the list
- argmax(axis=None, out=None, *, keepdims=False)
Return indices of the maximum values along the given axis.
Refer to numpy.argmax for full documentation.
See also
numpy.argmax
equivalent function
- argmin(axis=None, out=None, *, keepdims=False)
Return indices of the minimum values along the given axis.
Refer to numpy.argmin for detailed documentation.
See also
numpy.argmin
equivalent function
- clear()
Clear the contents
- count(x: bool) int
Return the number of times
x
appears in the list
- extend(L: G3VectorBool)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- insert(i: int, x: bool)
Insert an item at a given position.
- max(axis=None, out=None, keepdims=False, initial=<no value>, where=True)
Return the maximum along a given axis.
Refer to numpy.amax for full documentation.
See also
numpy.amax
equivalent function
- mean(axis=None, dtype=None, out=None, keepdims=False, *, where=True)
Returns the average of the array elements along given axis.
Refer to numpy.mean for full documentation.
See also
numpy.mean
equivalent function
- min(axis=None, out=None, keepdims=False, initial=<no value>, where=True)
Return the minimum along a given axis.
Refer to numpy.amin for full documentation.
See also
numpy.amin
equivalent function
- pop() bool
- pop(i: int) bool
Signature 1: Remove and return the last item
Signature 2: Remove and return the item at index
i
- remove(x: bool)
Remove the first item from the list whose value is x. It is an error if there is no such item.
- std(
- axis=None,
- dtype=None,
- out=None,
- ddof=0,
- keepdims=False,
- *,
- where=True,
Returns the standard deviation of the array elements along given axis.
Refer to numpy.std for full documentation.
See also
numpy.std
equivalent function
- sum(
- axis=None,
- dtype=None,
- out=None,
- keepdims=False,
- initial=0,
- where=True,
Return the sum of the array elements over the given axis.
Refer to numpy.sum for full documentation.
See also
numpy.sum
equivalent function
- var(
- axis=None,
- dtype=None,
- out=None,
- ddof=0,
- keepdims=False,
- *,
- where=True,
Returns the variance of the array elements, along given axis.
Refer to numpy.var for full documentation.
See also
numpy.var
equivalent function
- class spt3g.core.G3VectorComplexDouble(arg: numpy.ndarray)
- class spt3g.core.G3VectorComplexDouble()
- class spt3g.core.G3VectorComplexDouble(arg: G3VectorComplexDouble)
- class spt3g.core.G3VectorComplexDouble(arg: Iterable)
Bases:
ComplexDoubleVector
,G3FrameObject
Array of complex floats. Treat as a serializable version of numpy.array(dtype=complex128). Can be efficiently cast to and from numpy arrays.
Signature 1: Constructor from numpy array
Signature 3: Copy constructor
- all(axis=None, out=None, keepdims=False, *, where=True)
Returns True if all elements evaluate to True.
Refer to numpy.all for full documentation.
See also
numpy.all
equivalent function
- any(axis=None, out=None, keepdims=False, *, where=True)
Returns True if any of the elements of a evaluate to True.
Refer to numpy.any for full documentation.
See also
numpy.any
equivalent function
- append(x: complex)
Add an item to the end of the list
- argmax(axis=None, out=None, *, keepdims=False)
Return indices of the maximum values along the given axis.
Refer to numpy.argmax for full documentation.
See also
numpy.argmax
equivalent function
- argmin(axis=None, out=None, *, keepdims=False)
Return indices of the minimum values along the given axis.
Refer to numpy.argmin for detailed documentation.
See also
numpy.argmin
equivalent function
- clear()
Clear the contents
- count(x: complex) int
Return the number of times
x
appears in the list
- extend(L: G3VectorComplexDouble)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- insert(i: int, x: complex)
Insert an item at a given position.
- max(
- axis=None,
- out=None,
- keepdims=False,
- initial=<no value>,
- where=True,
Return the maximum along a given axis.
Refer to numpy.amax for full documentation.
See also
numpy.amax
equivalent function
- mean(
- axis=None,
- dtype=None,
- out=None,
- keepdims=False,
- *,
- where=True,
Returns the average of the array elements along given axis.
Refer to numpy.mean for full documentation.
See also
numpy.mean
equivalent function
- min(
- axis=None,
- out=None,
- keepdims=False,
- initial=<no value>,
- where=True,
Return the minimum along a given axis.
Refer to numpy.amin for full documentation.
See also
numpy.amin
equivalent function
- pop() complex
- pop(i: int) complex
Signature 1: Remove and return the last item
Signature 2: Remove and return the item at index
i
- remove(x: complex)
Remove the first item from the list whose value is x. It is an error if there is no such item.
- std(
- axis=None,
- dtype=None,
- out=None,
- ddof=0,
- keepdims=False,
- *,
- where=True,
Returns the standard deviation of the array elements along given axis.
Refer to numpy.std for full documentation.
See also
numpy.std
equivalent function
- sum(
- axis=None,
- dtype=None,
- out=None,
- keepdims=False,
- initial=0,
- where=True,
Return the sum of the array elements over the given axis.
Refer to numpy.sum for full documentation.
See also
numpy.sum
equivalent function
- var(
- axis=None,
- dtype=None,
- out=None,
- ddof=0,
- keepdims=False,
- *,
- where=True,
Returns the variance of the array elements, along given axis.
Refer to numpy.var for full documentation.
See also
numpy.var
equivalent function
- class spt3g.core.G3VectorDouble(arg: numpy.ndarray)
- class spt3g.core.G3VectorDouble()
- class spt3g.core.G3VectorDouble(arg: G3VectorDouble)
- class spt3g.core.G3VectorDouble(arg: Iterable)
Bases:
DoubleVector
,G3FrameObject
Array of floats. Treat as a serializable version of numpy.array(dtype=float64). Can be efficiently cast to and from numpy arrays.
Signature 1: Constructor from numpy array
Signature 3: Copy constructor
- all(axis=None, out=None, keepdims=False, *, where=True)
Returns True if all elements evaluate to True.
Refer to numpy.all for full documentation.
See also
numpy.all
equivalent function
- any(axis=None, out=None, keepdims=False, *, where=True)
Returns True if any of the elements of a evaluate to True.
Refer to numpy.any for full documentation.
See also
numpy.any
equivalent function
- append(x: float)
Add an item to the end of the list
- argmax(axis=None, out=None, *, keepdims=False)
Return indices of the maximum values along the given axis.
Refer to numpy.argmax for full documentation.
See also
numpy.argmax
equivalent function
- argmin(axis=None, out=None, *, keepdims=False)
Return indices of the minimum values along the given axis.
Refer to numpy.argmin for detailed documentation.
See also
numpy.argmin
equivalent function
- clear()
Clear the contents
- count(x: float) int
Return the number of times
x
appears in the list
- extend(L: G3VectorDouble)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- insert(i: int, x: float)
Insert an item at a given position.
- max(
- axis=None,
- out=None,
- keepdims=False,
- initial=<no value>,
- where=True,
Return the maximum along a given axis.
Refer to numpy.amax for full documentation.
See also
numpy.amax
equivalent function
- mean(axis=None, dtype=None, out=None, keepdims=False, *, where=True)
Returns the average of the array elements along given axis.
Refer to numpy.mean for full documentation.
See also
numpy.mean
equivalent function
- min(
- axis=None,
- out=None,
- keepdims=False,
- initial=<no value>,
- where=True,
Return the minimum along a given axis.
Refer to numpy.amin for full documentation.
See also
numpy.amin
equivalent function
- pop() float
- pop(i: int) float
Signature 1: Remove and return the last item
Signature 2: Remove and return the item at index
i
- remove(x: float)
Remove the first item from the list whose value is x. It is an error if there is no such item.
- std(
- axis=None,
- dtype=None,
- out=None,
- ddof=0,
- keepdims=False,
- *,
- where=True,
Returns the standard deviation of the array elements along given axis.
Refer to numpy.std for full documentation.
See also
numpy.std
equivalent function
- sum(
- axis=None,
- dtype=None,
- out=None,
- keepdims=False,
- initial=0,
- where=True,
Return the sum of the array elements over the given axis.
Refer to numpy.sum for full documentation.
See also
numpy.sum
equivalent function
- var(
- axis=None,
- dtype=None,
- out=None,
- ddof=0,
- keepdims=False,
- *,
- where=True,
Returns the variance of the array elements, along given axis.
Refer to numpy.var for full documentation.
See also
numpy.var
equivalent function
- class spt3g.core.G3VectorFrameObject()
- class spt3g.core.G3VectorFrameObject(arg: G3VectorFrameObject)
- class spt3g.core.G3VectorFrameObject(arg: Iterable)
Bases:
FrameObjectVector
,G3FrameObject
List of generic frame objects. Can lead to paradoxes; avoid use of this class unless you are sure you need it.
Signature 2: Copy constructor
- append(x: G3FrameObject)
Add an item to the end of the list
- clear()
Clear the contents
- count(x: G3FrameObject) int
Return the number of times
x
appears in the list
- extend(L: G3VectorFrameObject)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- insert(i: int, x: G3FrameObject)
Insert an item at a given position.
- pop() G3FrameObject
- pop(i: int) G3FrameObject
Signature 1: Remove and return the last item
Signature 2: Remove and return the item at index
i
- remove(x: G3FrameObject)
Remove the first item from the list whose value is x. It is an error if there is no such item.
- class spt3g.core.G3VectorInt(arg: numpy.ndarray)
- class spt3g.core.G3VectorInt()
- class spt3g.core.G3VectorInt(arg: G3VectorInt)
- class spt3g.core.G3VectorInt(arg: Iterable)
Bases:
Int64Vector
,G3FrameObject
Array of integers. Treat as a serializable version of numpy.array(dtype=int64). Can be efficiently cast to and from numpy arrays.
Signature 1: Constructor from numpy array
Signature 3: Copy constructor
- all(axis=None, out=None, keepdims=False, *, where=True)
Returns True if all elements evaluate to True.
Refer to numpy.all for full documentation.
See also
numpy.all
equivalent function
- any(axis=None, out=None, keepdims=False, *, where=True)
Returns True if any of the elements of a evaluate to True.
Refer to numpy.any for full documentation.
See also
numpy.any
equivalent function
- append(x: int)
Add an item to the end of the list
- argmax(axis=None, out=None, *, keepdims=False)
Return indices of the maximum values along the given axis.
Refer to numpy.argmax for full documentation.
See also
numpy.argmax
equivalent function
- argmin(axis=None, out=None, *, keepdims=False)
Return indices of the minimum values along the given axis.
Refer to numpy.argmin for detailed documentation.
See also
numpy.argmin
equivalent function
- clear()
Clear the contents
- count(x: int) int
Return the number of times
x
appears in the list
- extend(L: G3VectorInt)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- insert(i: int, x: int)
Insert an item at a given position.
- max(axis=None, out=None, keepdims=False, initial=<no value>, where=True)
Return the maximum along a given axis.
Refer to numpy.amax for full documentation.
See also
numpy.amax
equivalent function
- mean(axis=None, dtype=None, out=None, keepdims=False, *, where=True)
Returns the average of the array elements along given axis.
Refer to numpy.mean for full documentation.
See also
numpy.mean
equivalent function
- min(axis=None, out=None, keepdims=False, initial=<no value>, where=True)
Return the minimum along a given axis.
Refer to numpy.amin for full documentation.
See also
numpy.amin
equivalent function
- pop() int
- pop(i: int) int
Signature 1: Remove and return the last item
Signature 2: Remove and return the item at index
i
- remove(x: int)
Remove the first item from the list whose value is x. It is an error if there is no such item.
- std(
- axis=None,
- dtype=None,
- out=None,
- ddof=0,
- keepdims=False,
- *,
- where=True,
Returns the standard deviation of the array elements along given axis.
Refer to numpy.std for full documentation.
See also
numpy.std
equivalent function
- sum(
- axis=None,
- dtype=None,
- out=None,
- keepdims=False,
- initial=0,
- where=True,
Return the sum of the array elements over the given axis.
Refer to numpy.sum for full documentation.
See also
numpy.sum
equivalent function
- var(
- axis=None,
- dtype=None,
- out=None,
- ddof=0,
- keepdims=False,
- *,
- where=True,
Returns the variance of the array elements, along given axis.
Refer to numpy.var for full documentation.
See also
numpy.var
equivalent function
- class spt3g.core.G3VectorQuat(arg: Buffer)
- class spt3g.core.G3VectorQuat()
- class spt3g.core.G3VectorQuat(arg: G3VectorQuat)
- class spt3g.core.G3VectorQuat(arg: Iterable)
Bases:
QuatVector
,G3FrameObject
List of quaternions. Convertible to a 4xN numpy array. Arithmetic operations on this object are fast and provide results given proper quaternion math rather than element-by-element numpy-ish results.
Signature 1: Constructor from numpy array
Signature 3: Copy constructor
- abs() G3VectorDouble
Return the Euclidean norm of each quaternion
- clear()
Clear the contents
- cross3(arg: Quat) G3VectorQuat
Cross product of last three entries of each quaternion with the input
- dot3(arg: Quat) G3VectorDouble
Dot product of last three entries of each quaternion with the input
- extend(L: G3VectorQuat)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- norm() G3VectorDouble
Return the Cayley norm of each quaternion
- pop() Quat
- pop(i: int) Quat
Signature 1: Remove and return the last item
Signature 2: Remove and return the item at index
i
- remove(x: Quat)
Remove the first item from the list whose value is x. It is an error if there is no such item.
- vnorm() G3VectorDouble
Return the Cayley norm of the unreal (vector) part of each quaternion
- property real: G3VectorDouble
Return the real (scalar) part of each quaternion
- class spt3g.core.G3VectorString()
- class spt3g.core.G3VectorString(arg: G3VectorString)
- class spt3g.core.G3VectorString(arg: Iterable)
Bases:
StringVector
,G3FrameObject
List of strings.
Signature 2: Copy constructor
- append(x: str)
Add an item to the end of the list
- clear()
Clear the contents
- count(x: str) int
Return the number of times
x
appears in the list
- extend(L: G3VectorString)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- insert(i: int, x: str)
Insert an item at a given position.
- pop() str
- pop(i: int) str
Signature 1: Remove and return the last item
Signature 2: Remove and return the item at index
i
- remove(x: str)
Remove the first item from the list whose value is x. It is an error if there is no such item.
- class spt3g.core.G3VectorTime(arg: numpy.ndarray)
- class spt3g.core.G3VectorTime()
- class spt3g.core.G3VectorTime(arg: G3VectorTime)
- class spt3g.core.G3VectorTime(arg: Iterable)
Bases:
G3TimeVector
,G3FrameObject
List of times.
Signature 1: Constructor from numpy array
Signature 3: Copy constructor
- clear()
Clear the contents
- extend(L: G3VectorTime)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- class spt3g.core.G3VectorUnsignedChar()
- class spt3g.core.G3VectorUnsignedChar(arg: G3VectorUnsignedChar)
- class spt3g.core.G3VectorUnsignedChar(arg: Iterable)
Bases:
UnsignedCharVector
,G3FrameObject
List of 8-bit integers
Signature 2: Copy constructor
- append(x: int)
Add an item to the end of the list
- clear()
Clear the contents
- count(x: int) int
Return the number of times
x
appears in the list
- extend(L: G3VectorUnsignedChar)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- insert(i: int, x: int)
Insert an item at a given position.
- pop() int
- pop(i: int) int
Signature 1: Remove and return the last item
Signature 2: Remove and return the item at index
i
- remove(x: int)
Remove the first item from the list whose value is x. It is an error if there is no such item.
- class spt3g.core.G3VectorVectorString()
- class spt3g.core.G3VectorVectorString(arg: G3VectorVectorString)
- class spt3g.core.G3VectorVectorString(arg: Iterable)
Bases:
G3VectorStringVector
,G3FrameObject
List of lists of strings.
Signature 2: Copy constructor
- append(x: G3VectorString)
Add an item to the end of the list
- clear()
Clear the contents
- count(x: G3VectorString) int
Return the number of times
x
appears in the list
- extend(L: G3VectorVectorString)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- insert(i: int, x: G3VectorString)
Insert an item at a given position.
- pop() G3VectorString
- pop(i: int) G3VectorString
Signature 1: Remove and return the last item
Signature 2: Remove and return the item at index
i
- remove(x: G3VectorString)
Remove the first item from the list whose value is x. It is an error if there is no such item.
Class-like Pipeline Modules
Classes that can be added to G3Pipeline
instances, either written as callable objects in Python (see
Callable Objects as Functions) or as G3Module
-derived
classes in C++ (see Writing a module in C++). Aside from adding these into
pipelines using the standard Add()
method, such objects may also be
instantiated outside of pipelines to make use of additional features.
One typical use case is to extract some kind of data from a series of frames:
class ExtractData:
def __init__(self, key="RawTimestreams"):
self.key = key
self.data = []
def __call__(self, frame):
if self.key in frame:
self.data.append(frame[self.key])
# instantiate caching class
extractor = ExtractData()
# use instance in a pipeline
pipe = core.G3Pipeline()
pipe.Add(core.G3Reader, filename="file.g3")
pipe.Add(extractor)
pipe.Run()
# use extracted data in later processing
print(extractor.data)
Another use case may be to call additional methods of a class. For
example, the G3Writer
class can be used as a
context manager, and also report the position of the file pointer after
each frame is written:
with core.G3Writer("file.g3") as writer:
for frame in frames:
writer(frame)
print("Bytes written:", writer.tell())
Class-like modules permit a variety of additional features beyond their standard usage in pipelines.
- class spt3g.core.G3InfiniteSource()
- class spt3g.core.G3InfiniteSource(
- type: G3FrameType = spt3g.core.G3FrameType.none,
- n: int = -1,
Bases:
G3Module
Emits infinite frames, up to an optional maximum number n
- class spt3g.core.G3Module()
Base class for functors that can be added to a G3Pipeline.
- class spt3g.core.G3MultiFileWriter(
- filename: object,
- size_limit: int,
- divide_on: object = None,
- buffersize: int = 1048576,
Bases:
G3Module
Writes frames to disk into a sequence of files. Once a file exceeds the number of bytes specified in size_limit, it will start a new file. Files are named based on filename. If passed a string for filename with a printf-style specifier, that specifier will be replaced by a zero-indexed sequence number. For example, outfile-%03u.g3.gz would produce a sequence of files named outfile-000.g3.gz, outfile-001.g3.gz, etc. Alternatively, you can pass a callable that is passed the first frame in the new file and the sequence number and returns a path to the new file. Any frames besides Timepoint and Scan frames have the most recent frame of each type prepended to all new files.
More complex behavior can be obtained with the optional divide_on argument. This can be an iterable of frame types (e.g. [core.G3FrameType.Observation]) or a callable. In the iterable case, the presence of any frame with a type in the list will cause the creation of a new file even if the file size threshold has not yet been met. This is useful to create files based on, for example, observation boundaries. For more flexibility, you can also pass a python callable as divide_on. This callable will be passed each frame in turn. If it returns True (or something with positive truth-value), a new file will be started at that frame.
- property current_file: str
Path to the output file to which the next input frame will be written
- class spt3g.core.G3NetworkSender(
- hostname: str,
- port: int,
- max_queue_size: int = 0,
- n_serializers: int = 0,
Bases:
G3Module
Writes frames to a network socket. If hostname is set to ‘*’, will listen on the given port, on all interfaces, instead of connecting to the given port on a remote host. In listen mode, metadata frames (Calibration, Wiring, etc. – everything but Scan and Timepoint) will be accumulated and the most recent of each will be sent to new clients on connect. Scan and Timepoint frames will be broadcast live to all connected clients. If max_queue_size is set to a non-zero value, Scan and Timepoint frames may be dropped if more than max_queue_size frames are queued for transmission. If n_serializers is set to a non-zero value, the task of serializing frames to be sent will be distributed across that many background threads, which is useful when high throughput of large frames is required, but is otherwise typically not necessary.
- Close()
- class spt3g.core.G3Reader(
- filename: str,
- n_frames_to_read: int = 0,
- timeout: float = -1.0,
- track_filename: bool = False,
- buffersize: int = 1048576,
- class spt3g.core.G3Reader(
- filename: StringVector,
- n_frames_to_read: int = 0,
- timeout: float = -1.0,
- track_filename: bool = False,
- buffersize: int = 1048576,
Bases:
G3Module
Read frames from disk. Takes either the path to a file to read or an iterable of files to be read in sequence. If n_frames_to_read is greater than zero, will stop after n_frames_to_read frames rather than at the end of the file[s]. The timeout parameter can used to enable socket timeout for tcp streams, resulting in EOF behavior on expiry; unfortunately this cannot be used for polling, you have to close the connection. Use the tell and seek methods to record the position of and seek to the beginning of a particular frame in the file. Set track_filename to True to record the filename for each frame in the ._filename attribute (fragile).
- seek(arg: int) int
Position the stream read pointer at specific byte offset. Note that once EOF is reached, seek does not work anymore.
- tell() int
Return the current byte offset from start of stream.
- class spt3g.core.G3Writer(
- filename: str,
- streams: FrameTypeVector = spt3g.core.FrameTypeVector([]),
- append: bool = False,
- buffersize: int = 1048576,
Bases:
G3Module
Writes frames to disk. Frames will be written to the file specified by filename. If filename ends in .gz, output will be compressed using gzip. To write only some types of frames, pass a list of the desired frame types to the second optional argument (streams). If no streams argument is given, writes all types of frames. If append is set to True, will append frames to its output file rather than overwriting it.
- flush()
Flush all pending writes to file
- tell() int
Return the current byte offset from the start of the output stream
- class spt3g.core.util.AbortAfterNFrames(type, n_frames)[source]
Stops processing after n_frames frames go by
- class spt3g.core.util.DeduplicateMetadata(
- dataframetype=[spt3g.core.G3FrameType.Timepoint, spt3g.core.G3FrameType.Scan],
Drop metadata frames (e.g. Calibration, Wiring) for which the previous metadata frame of the same type is byte-for-byte identical. This can be handy when, for example, reading in many files from the G3MultiFileWriter, which copies metadata frames to the beginning of each file. Considers all frames not in <dataframetypes> to be metadata (by default, everything except Timepoint and Scan frames).
- class spt3g.core.util.DropOrphanMetadata(
- dataframetype=[spt3g.core.G3FrameType.Timepoint, spt3g.core.G3FrameType.Scan],
Remove metadata frames (e.g. Calibration, Wiring) without intervening data frames (e.g. Timepoint, Scan, specified by the <dataframetype> argument to the constructor). The metadata frames that do show up will be the most recent of each type and appear in their original order.
- class spt3g.core.util.G3ThrottledNetworkSender(
- hostname='*',
- port=5978,
- frame_decimation={spt3g.core.G3FrameType.Timepoint: 10},
- max_queue_size=0,
Send every Nth frame of certain types using a wrapped G3NetworkSender. All instances of frames not in the dictionary frame_decimation will be sent at their full rate.
Function-like Pipeline Modules
Python functions that can be added to G3Pipeline
instances. Such functions may also be called directly with a G3Frame
object as the first argument, and do not necessarily need to be used in a pipeline. See Python Modules as Functions for more detail.
- spt3g.core.util.Delete(frame, keys=[], type=None)[source]
Deletes specified keys from frame. If optional type specified, only acts on frames of the given type.
- spt3g.core.util.Dump(frame, type=None, added_message=None)[source]
Prints frames to console. If optional type specified, only acts on frames of the given type.
Pipeline Segments
Python functions that combine a sequence of pipeline modules, and can be added to G3Pipeline
instances. See Pipeline Segments for more detail.
- spt3g.core.util.G3NetworkReceiver(pipe, hostname='localhost', port=5978)
Emulation of old G3NetworkReceiver class. Equivalent to pointing G3Reader at a TCP URL.
Equivalent to
pipe.Add(spt3g.core.G3Reader, filename='tcp://localhost:5978')
Useful Classes
Various Python and C++ classes that are part of the public API.
- class spt3g.core.BoolVector()
- class spt3g.core.BoolVector(arg: BoolVector)
- class spt3g.core.BoolVector(arg: Iterable)
Signature 2: Copy constructor
- all(axis=None, out=None, keepdims=False, *, where=True)
Returns True if all elements evaluate to True.
Refer to numpy.all for full documentation.
See also
numpy.all
equivalent function
- any(axis=None, out=None, keepdims=False, *, where=True)
Returns True if any of the elements of a evaluate to True.
Refer to numpy.any for full documentation.
See also
numpy.any
equivalent function
- append(x: bool)
Add an item to the end of the list
- argmax(axis=None, out=None, *, keepdims=False)
Return indices of the maximum values along the given axis.
Refer to numpy.argmax for full documentation.
See also
numpy.argmax
equivalent function
- argmin(axis=None, out=None, *, keepdims=False)
Return indices of the minimum values along the given axis.
Refer to numpy.argmin for detailed documentation.
See also
numpy.argmin
equivalent function
- clear()
Clear the contents
- count(x: bool) int
Return the number of times
x
appears in the list
- extend(L: BoolVector)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- insert(i: int, x: bool)
Insert an item at a given position.
- max(axis=None, out=None, keepdims=False, initial=<no value>, where=True)
Return the maximum along a given axis.
Refer to numpy.amax for full documentation.
See also
numpy.amax
equivalent function
- mean(axis=None, dtype=None, out=None, keepdims=False, *, where=True)
Returns the average of the array elements along given axis.
Refer to numpy.mean for full documentation.
See also
numpy.mean
equivalent function
- min(axis=None, out=None, keepdims=False, initial=<no value>, where=True)
Return the minimum along a given axis.
Refer to numpy.amin for full documentation.
See also
numpy.amin
equivalent function
- pop() bool
- pop(i: int) bool
Signature 1: Remove and return the last item
Signature 2: Remove and return the item at index
i
- remove(x: bool)
Remove the first item from the list whose value is x. It is an error if there is no such item.
- std(
- axis=None,
- dtype=None,
- out=None,
- ddof=0,
- keepdims=False,
- *,
- where=True,
Returns the standard deviation of the array elements along given axis.
Refer to numpy.std for full documentation.
See also
numpy.std
equivalent function
- sum(
- axis=None,
- dtype=None,
- out=None,
- keepdims=False,
- initial=0,
- where=True,
Return the sum of the array elements over the given axis.
Refer to numpy.sum for full documentation.
See also
numpy.sum
equivalent function
- var(
- axis=None,
- dtype=None,
- out=None,
- ddof=0,
- keepdims=False,
- *,
- where=True,
Returns the variance of the array elements, along given axis.
Refer to numpy.var for full documentation.
See also
numpy.var
equivalent function
- class spt3g.core.ComplexDoubleVector(arg: numpy.ndarray)
- class spt3g.core.ComplexDoubleVector()
- class spt3g.core.ComplexDoubleVector(arg: ComplexDoubleVector)
- class spt3g.core.ComplexDoubleVector(arg: Iterable)
Signature 1: Constructor from numpy array
Signature 3: Copy constructor
- all(axis=None, out=None, keepdims=False, *, where=True)
Returns True if all elements evaluate to True.
Refer to numpy.all for full documentation.
See also
numpy.all
equivalent function
- any(axis=None, out=None, keepdims=False, *, where=True)
Returns True if any of the elements of a evaluate to True.
Refer to numpy.any for full documentation.
See also
numpy.any
equivalent function
- append(x: complex)
Add an item to the end of the list
- argmax(axis=None, out=None, *, keepdims=False)
Return indices of the maximum values along the given axis.
Refer to numpy.argmax for full documentation.
See also
numpy.argmax
equivalent function
- argmin(axis=None, out=None, *, keepdims=False)
Return indices of the minimum values along the given axis.
Refer to numpy.argmin for detailed documentation.
See also
numpy.argmin
equivalent function
- clear()
Clear the contents
- count(x: complex) int
Return the number of times
x
appears in the list
- extend(L: ComplexDoubleVector)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- insert(i: int, x: complex)
Insert an item at a given position.
- max(
- axis=None,
- out=None,
- keepdims=False,
- initial=<no value>,
- where=True,
Return the maximum along a given axis.
Refer to numpy.amax for full documentation.
See also
numpy.amax
equivalent function
- mean(
- axis=None,
- dtype=None,
- out=None,
- keepdims=False,
- *,
- where=True,
Returns the average of the array elements along given axis.
Refer to numpy.mean for full documentation.
See also
numpy.mean
equivalent function
- min(
- axis=None,
- out=None,
- keepdims=False,
- initial=<no value>,
- where=True,
Return the minimum along a given axis.
Refer to numpy.amin for full documentation.
See also
numpy.amin
equivalent function
- pop() complex
- pop(i: int) complex
Signature 1: Remove and return the last item
Signature 2: Remove and return the item at index
i
- remove(x: complex)
Remove the first item from the list whose value is x. It is an error if there is no such item.
- std(
- axis=None,
- dtype=None,
- out=None,
- ddof=0,
- keepdims=False,
- *,
- where=True,
Returns the standard deviation of the array elements along given axis.
Refer to numpy.std for full documentation.
See also
numpy.std
equivalent function
- sum(
- axis=None,
- dtype=None,
- out=None,
- keepdims=False,
- initial=0,
- where=True,
Return the sum of the array elements over the given axis.
Refer to numpy.sum for full documentation.
See also
numpy.sum
equivalent function
- var(
- axis=None,
- dtype=None,
- out=None,
- ddof=0,
- keepdims=False,
- *,
- where=True,
Returns the variance of the array elements, along given axis.
Refer to numpy.var for full documentation.
See also
numpy.var
equivalent function
- class spt3g.core.ComplexFloatVector(arg: numpy.ndarray)
- class spt3g.core.ComplexFloatVector()
- class spt3g.core.ComplexFloatVector(arg: ComplexFloatVector)
- class spt3g.core.ComplexFloatVector(arg: Iterable)
Signature 1: Constructor from numpy array
Signature 3: Copy constructor
- all(axis=None, out=None, keepdims=False, *, where=True)
Returns True if all elements evaluate to True.
Refer to numpy.all for full documentation.
See also
numpy.all
equivalent function
- any(axis=None, out=None, keepdims=False, *, where=True)
Returns True if any of the elements of a evaluate to True.
Refer to numpy.any for full documentation.
See also
numpy.any
equivalent function
- append(x: complex)
Add an item to the end of the list
- argmax(axis=None, out=None, *, keepdims=False)
Return indices of the maximum values along the given axis.
Refer to numpy.argmax for full documentation.
See also
numpy.argmax
equivalent function
- argmin(axis=None, out=None, *, keepdims=False)
Return indices of the minimum values along the given axis.
Refer to numpy.argmin for detailed documentation.
See also
numpy.argmin
equivalent function
- clear()
Clear the contents
- count(x: complex) int
Return the number of times
x
appears in the list
- extend(L: ComplexFloatVector)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- insert(i: int, x: complex)
Insert an item at a given position.
- max(
- axis=None,
- out=None,
- keepdims=False,
- initial=<no value>,
- where=True,
Return the maximum along a given axis.
Refer to numpy.amax for full documentation.
See also
numpy.amax
equivalent function
- mean(
- axis=None,
- dtype=None,
- out=None,
- keepdims=False,
- *,
- where=True,
Returns the average of the array elements along given axis.
Refer to numpy.mean for full documentation.
See also
numpy.mean
equivalent function
- min(
- axis=None,
- out=None,
- keepdims=False,
- initial=<no value>,
- where=True,
Return the minimum along a given axis.
Refer to numpy.amin for full documentation.
See also
numpy.amin
equivalent function
- pop() complex
- pop(i: int) complex
Signature 1: Remove and return the last item
Signature 2: Remove and return the item at index
i
- remove(x: complex)
Remove the first item from the list whose value is x. It is an error if there is no such item.
- std(
- axis=None,
- dtype=None,
- out=None,
- ddof=0,
- keepdims=False,
- *,
- where=True,
Returns the standard deviation of the array elements along given axis.
Refer to numpy.std for full documentation.
See also
numpy.std
equivalent function
- sum(
- axis=None,
- dtype=None,
- out=None,
- keepdims=False,
- initial=0,
- where=True,
Return the sum of the array elements over the given axis.
Refer to numpy.sum for full documentation.
See also
numpy.sum
equivalent function
- var(
- axis=None,
- dtype=None,
- out=None,
- ddof=0,
- keepdims=False,
- *,
- where=True,
Returns the variance of the array elements, along given axis.
Refer to numpy.var for full documentation.
See also
numpy.var
equivalent function
- class spt3g.core.DoubleVector(arg: numpy.ndarray)
- class spt3g.core.DoubleVector()
- class spt3g.core.DoubleVector(arg: DoubleVector)
- class spt3g.core.DoubleVector(arg: Iterable)
Signature 1: Constructor from numpy array
Signature 3: Copy constructor
- all(axis=None, out=None, keepdims=False, *, where=True)
Returns True if all elements evaluate to True.
Refer to numpy.all for full documentation.
See also
numpy.all
equivalent function
- any(axis=None, out=None, keepdims=False, *, where=True)
Returns True if any of the elements of a evaluate to True.
Refer to numpy.any for full documentation.
See also
numpy.any
equivalent function
- append(x: float)
Add an item to the end of the list
- argmax(axis=None, out=None, *, keepdims=False)
Return indices of the maximum values along the given axis.
Refer to numpy.argmax for full documentation.
See also
numpy.argmax
equivalent function
- argmin(axis=None, out=None, *, keepdims=False)
Return indices of the minimum values along the given axis.
Refer to numpy.argmin for detailed documentation.
See also
numpy.argmin
equivalent function
- clear()
Clear the contents
- count(x: float) int
Return the number of times
x
appears in the list
- extend(L: DoubleVector)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- insert(i: int, x: float)
Insert an item at a given position.
- max(axis=None, out=None, keepdims=False, initial=<no value>, where=True)
Return the maximum along a given axis.
Refer to numpy.amax for full documentation.
See also
numpy.amax
equivalent function
- mean(axis=None, dtype=None, out=None, keepdims=False, *, where=True)
Returns the average of the array elements along given axis.
Refer to numpy.mean for full documentation.
See also
numpy.mean
equivalent function
- min(axis=None, out=None, keepdims=False, initial=<no value>, where=True)
Return the minimum along a given axis.
Refer to numpy.amin for full documentation.
See also
numpy.amin
equivalent function
- pop() float
- pop(i: int) float
Signature 1: Remove and return the last item
Signature 2: Remove and return the item at index
i
- remove(x: float)
Remove the first item from the list whose value is x. It is an error if there is no such item.
- std(
- axis=None,
- dtype=None,
- out=None,
- ddof=0,
- keepdims=False,
- *,
- where=True,
Returns the standard deviation of the array elements along given axis.
Refer to numpy.std for full documentation.
See also
numpy.std
equivalent function
- sum(
- axis=None,
- dtype=None,
- out=None,
- keepdims=False,
- initial=0,
- where=True,
Return the sum of the array elements over the given axis.
Refer to numpy.sum for full documentation.
See also
numpy.sum
equivalent function
- var(
- axis=None,
- dtype=None,
- out=None,
- ddof=0,
- keepdims=False,
- *,
- where=True,
Returns the variance of the array elements, along given axis.
Refer to numpy.var for full documentation.
See also
numpy.var
equivalent function
- class spt3g.core.FloatVector(arg: numpy.ndarray)
- class spt3g.core.FloatVector()
- class spt3g.core.FloatVector(arg: FloatVector)
- class spt3g.core.FloatVector(arg: Iterable)
Signature 1: Constructor from numpy array
Signature 3: Copy constructor
- all(axis=None, out=None, keepdims=False, *, where=True)
Returns True if all elements evaluate to True.
Refer to numpy.all for full documentation.
See also
numpy.all
equivalent function
- any(axis=None, out=None, keepdims=False, *, where=True)
Returns True if any of the elements of a evaluate to True.
Refer to numpy.any for full documentation.
See also
numpy.any
equivalent function
- append(x: float)
Add an item to the end of the list
- argmax(axis=None, out=None, *, keepdims=False)
Return indices of the maximum values along the given axis.
Refer to numpy.argmax for full documentation.
See also
numpy.argmax
equivalent function
- argmin(axis=None, out=None, *, keepdims=False)
Return indices of the minimum values along the given axis.
Refer to numpy.argmin for detailed documentation.
See also
numpy.argmin
equivalent function
- clear()
Clear the contents
- count(x: float) int
Return the number of times
x
appears in the list
- extend(L: FloatVector)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- insert(i: int, x: float)
Insert an item at a given position.
- max(axis=None, out=None, keepdims=False, initial=<no value>, where=True)
Return the maximum along a given axis.
Refer to numpy.amax for full documentation.
See also
numpy.amax
equivalent function
- mean(axis=None, dtype=None, out=None, keepdims=False, *, where=True)
Returns the average of the array elements along given axis.
Refer to numpy.mean for full documentation.
See also
numpy.mean
equivalent function
- min(axis=None, out=None, keepdims=False, initial=<no value>, where=True)
Return the minimum along a given axis.
Refer to numpy.amin for full documentation.
See also
numpy.amin
equivalent function
- pop() float
- pop(i: int) float
Signature 1: Remove and return the last item
Signature 2: Remove and return the item at index
i
- remove(x: float)
Remove the first item from the list whose value is x. It is an error if there is no such item.
- std(
- axis=None,
- dtype=None,
- out=None,
- ddof=0,
- keepdims=False,
- *,
- where=True,
Returns the standard deviation of the array elements along given axis.
Refer to numpy.std for full documentation.
See also
numpy.std
equivalent function
- sum(
- axis=None,
- dtype=None,
- out=None,
- keepdims=False,
- initial=0,
- where=True,
Return the sum of the array elements over the given axis.
Refer to numpy.sum for full documentation.
See also
numpy.sum
equivalent function
- var(
- axis=None,
- dtype=None,
- out=None,
- ddof=0,
- keepdims=False,
- *,
- where=True,
Returns the variance of the array elements, along given axis.
Refer to numpy.var for full documentation.
See also
numpy.var
equivalent function
- class spt3g.core.FrameObjectVector()
- class spt3g.core.FrameObjectVector(arg: FrameObjectVector)
- class spt3g.core.FrameObjectVector(arg: Iterable)
Signature 2: Copy constructor
- append(x: G3FrameObject)
Add an item to the end of the list
- clear()
Clear the contents
- count(x: G3FrameObject) int
Return the number of times
x
appears in the list
- extend(L: FrameObjectVector)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- insert(i: int, x: G3FrameObject)
Insert an item at a given position.
- pop() G3FrameObject
- pop(i: int) G3FrameObject
Signature 1: Remove and return the last item
Signature 2: Remove and return the item at index
i
- remove(x: G3FrameObject)
Remove the first item from the list whose value is x. It is an error if there is no such item.
- class spt3g.core.FrameTypeVector()
- class spt3g.core.FrameTypeVector(arg: FrameTypeVector)
- class spt3g.core.FrameTypeVector(arg: Iterable)
Signature 2: Copy constructor
- append(x: G3FrameType)
Add an item to the end of the list
- clear()
Clear the contents
- count(x: G3FrameType) int
Return the number of times
x
appears in the list
- extend(L: FrameTypeVector)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- insert(i: int, x: G3FrameType)
Insert an item at a given position.
- pop() G3FrameType
- pop(i: int) G3FrameType
Signature 1: Remove and return the last item
Signature 2: Remove and return the item at index
i
- remove(x: G3FrameType)
Remove the first item from the list whose value is x. It is an error if there is no such item.
- class spt3g.core.FrameVector()
- class spt3g.core.FrameVector(arg: FrameVector)
- class spt3g.core.FrameVector(arg: Iterable)
Signature 2: Copy constructor
- clear()
Clear the contents
- extend(L: FrameVector)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- class spt3g.core.G3Frame()
- class spt3g.core.G3Frame(arg: G3FrameType)
- class spt3g.core.G3Frame(arg: G3Frame)
- class spt3g.core.G3Frame(adhoctypecode: str)
Frames are the core datatype of the analysis software. They behave like Python dictionaries except that they can only store subclasses of core.G3FrameObject and the dictionary keys must be strings. Pickling and unpickling them uses internal serialization and is extremely fast.
In addition to dictionary-like contents, frames have a type code (G3Frame.Type) that designates what kind of data are contained in it. These types usually indicates information that changes at different rates.
Signature 4: Create a frame with an ad-hoc (non-standard) type code. Use sparingly and with care.
- drop_blobs(decode_all: bool = False)
Drop all serialized data either for already-decoded objects (default) or all objects after decoding them (if decode_all is true). Saves memory at the expense of CPU time if reserialized.
- drop_objects()
Drop all decoded objects in favor of their serialized copies, where those serialized copies already exist. Saves memory for frames about to be written at the expense of CPU time to re-decode them if they are accessed again later.
- generate_blobs(drop_objects: bool = False)
Force immediate serialization of all objects. Will save some CPU time later during serialization of the frame in exchange for spending the exact same amount of CPU time right now.
- get(key: str, default: object = None) object
- pop(arg: str) object
- pop(arg0: str, arg1: object) object
- values() ValuesView
Return an object providing a view on the mappings’s values.
- property hash: bytes
Return the serialized representation of the frame
- property type: G3FrameType
Type code for frame. See general G3Frame docstring.
- class spt3g.core.G3FrameType(value: int)
- class spt3g.core.G3FrameType(arg: None)
Enumerated frame type for identifying G3Frame objects
- Calibration = spt3g.core.G3FrameType.Calibration
- EndProcessing = spt3g.core.G3FrameType.EndProcessing
- Ephemeris = spt3g.core.G3FrameType.Ephemeris
- GcpSlow = spt3g.core.G3FrameType.GcpSlow
- Housekeeping = spt3g.core.G3FrameType.Housekeeping
- InstrumentStatus = spt3g.core.G3FrameType.InstrumentStatus
- LightCurve = spt3g.core.G3FrameType.LightCurve
- Map = spt3g.core.G3FrameType.Map
- Observation = spt3g.core.G3FrameType.Observation
- PipelineInfo = spt3g.core.G3FrameType.PipelineInfo
- Scan = spt3g.core.G3FrameType.Scan
- Statistics = spt3g.core.G3FrameType.Statistics
- Timepoint = spt3g.core.G3FrameType.Timepoint
- Wiring = spt3g.core.G3FrameType.Wiring
- property key: str
C++ enum character key
- property name: str
- names: dict
Mapping of enum names to objects.
{'Calibration': spt3g.core.G3FrameType.Calibration, 'EndProcessing': spt3g.core.G3FrameType.EndProcessing, 'Ephemeris': spt3g.core.G3FrameType.Ephemeris, 'GcpSlow': spt3g.core.G3FrameType.GcpSlow, 'Housekeeping': spt3g.core.G3FrameType.Housekeeping, 'InstrumentStatus': spt3g.core.G3FrameType.InstrumentStatus, 'LightCurve': spt3g.core.G3FrameType.LightCurve, 'Map': spt3g.core.G3FrameType.Map, 'Observation': spt3g.core.G3FrameType.Observation, 'PipelineInfo': spt3g.core.G3FrameType.PipelineInfo, 'Scan': spt3g.core.G3FrameType.Scan, 'Statistics': spt3g.core.G3FrameType.Statistics, 'Timepoint': spt3g.core.G3FrameType.Timepoint, 'Wiring': spt3g.core.G3FrameType.Wiring, 'none': spt3g.core.G3FrameType.none}
- none = spt3g.core.G3FrameType.none
- property value: int
- values: dict
Mapping of enum values to objects.
{67: spt3g.core.G3FrameType.Calibration, 69: spt3g.core.G3FrameType.Ephemeris, 71: spt3g.core.G3FrameType.GcpSlow, 72: spt3g.core.G3FrameType.Housekeeping, 73: spt3g.core.G3FrameType.InstrumentStatus, 76: spt3g.core.G3FrameType.LightCurve, 77: spt3g.core.G3FrameType.Map, 78: spt3g.core.G3FrameType.none, 79: spt3g.core.G3FrameType.Observation, 80: spt3g.core.G3FrameType.PipelineInfo, 82: spt3g.core.G3FrameType.Statistics, 83: spt3g.core.G3FrameType.Scan, 84: spt3g.core.G3FrameType.Timepoint, 87: spt3g.core.G3FrameType.Wiring, 90: spt3g.core.G3FrameType.EndProcessing}
- class spt3g.core.G3LogLevel(value: int)
Logging level identifier for G3Logger objects
- LOG_DEBUG = spt3g.core.G3LogLevel.LOG_DEBUG
- LOG_ERROR = spt3g.core.G3LogLevel.LOG_ERROR
- LOG_FATAL = spt3g.core.G3LogLevel.LOG_FATAL
- LOG_INFO = spt3g.core.G3LogLevel.LOG_INFO
- LOG_NOTICE = spt3g.core.G3LogLevel.LOG_NOTICE
- LOG_TRACE = spt3g.core.G3LogLevel.LOG_TRACE
- LOG_WARN = spt3g.core.G3LogLevel.LOG_WARN
- property name: str
- names: dict
Mapping of enum names to objects.
{'LOG_DEBUG': spt3g.core.G3LogLevel.LOG_DEBUG, 'LOG_ERROR': spt3g.core.G3LogLevel.LOG_ERROR, 'LOG_FATAL': spt3g.core.G3LogLevel.LOG_FATAL, 'LOG_INFO': spt3g.core.G3LogLevel.LOG_INFO, 'LOG_NOTICE': spt3g.core.G3LogLevel.LOG_NOTICE, 'LOG_TRACE': spt3g.core.G3LogLevel.LOG_TRACE, 'LOG_WARN': spt3g.core.G3LogLevel.LOG_WARN}
- property value: int
- values: dict
Mapping of enum values to objects.
{0: spt3g.core.G3LogLevel.LOG_TRACE, 1: spt3g.core.G3LogLevel.LOG_DEBUG, 2: spt3g.core.G3LogLevel.LOG_INFO, 3: spt3g.core.G3LogLevel.LOG_NOTICE, 4: spt3g.core.G3LogLevel.LOG_WARN, 5: spt3g.core.G3LogLevel.LOG_ERROR, 6: spt3g.core.G3LogLevel.LOG_FATAL}
- class spt3g.core.G3Logger
C++ logging abstract base class
- get_level_for_unit(unit: str) G3LogLevel
- log(
- level: G3LogLevel,
- unit: str,
- file: str,
- line: int,
- function: str,
- message: str,
- set_level(level: G3LogLevel)
- set_level_for_unit(unit: str, level: G3LogLevel)
- global_logger = <spt3g.core.G3PrintfLogger object>
- class spt3g.core.G3LoggerVector()
- class spt3g.core.G3LoggerVector(arg: G3LoggerVector)
- class spt3g.core.G3LoggerVector(arg: Iterable)
Signature 2: Copy constructor
- clear()
Clear the contents
- extend(L: G3LoggerVector)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- class spt3g.core.G3MultiLogger(arg: G3LoggerVector)
Bases:
G3Logger
Log to multiple loggers at once
- class spt3g.core.G3NullLogger
Bases:
G3Logger
Logger that does not log. Useful if you don’t want log messages
- class spt3g.core.G3Pipeline()
A collection of core.G3Modules and Python callables. Added callables are called sequentially and are passed a frame as their only positional argument. If the added callable is a python function, it is also passed any keyword arguments given to Add(). If it is a class, those keyword arguments are passed to the class constructor.
The first module is passed None and returns one or more frames to be passed to the next module. Processing will halt if it returns [].
Following modules are passed the frames, one at a time, returned by the previous module. The return value from these modules then becomes the input queue for the next. Once the last module returns, or a module returns [] (or False, which is equivalent), control returns to the first module and new data is pushed through the pipe.
- Return value semantics for modules:
A single frame: pass frame to next module
An iterable (e.g. a list) of frames: pass frames to next module in order
None: pass input frame to next module (implicit if no return)
True: pass input frame to next module
False: discard input frame and return to first module, or end processing if returned by first module. Equivalent to [].
- static halt_processing()
Halts all running pipelines after they flush all currently in-flight frames. Once set, the first module will not be called again.
- Add(callable, name=None, subprocess=False, **kwargs)
Add a processing module to the pipeline. It can be any subclass of spt3g.core.G3Module or any Python callable, either an instance or a class. Positional and keyword arguments are passed through to the argument’s constructor (if a class) or as additional arguments to a function. If subprocess is set to True, this module will be run in a separate process.
- GetGraphInfo() str
Get stored control flow information from Run(graph=True)
- Run(profile: bool = False, graph: bool = False, signal_halt: bool = True)
Run pipeline. If profile is True, print execution time statistics for each module when complete. If graph is True, stores control flow data that can be processed with GraphViz once retrieved using GetGraphInfo(). If signal_halt is True (default), the pipeline will stop processing new frames when SIGINT is sent to this process. Equivalent to what happens when halt_processing() is called.
- class spt3g.core.G3PrintfLogger(
- default_level: G3LogLevel = spt3g.core.G3LogLevel.LOG_NOTICE,
Bases:
G3Logger
Logger that prints error messages to stderr (in color, if stderr is a tty).
- property timestamps: bool
- property trim_file_names: bool
- class spt3g.core.G3SyslogLogger(
- ident: str,
- facility: int,
- default_level: G3LogLevel = spt3g.core.G3LogLevel.LOG_NOTICE,
Bases:
G3Logger
Pass log messages to the syslog service. Initialize with a string identifier and a logging facility. See syslog(3) for details. Example: import syslog logger = core.G3SyslogLogger(‘myprogram’, syslog.LOG_USER)
- class spt3g.core.G3TimeVector(arg: numpy.ndarray)
- class spt3g.core.G3TimeVector()
- class spt3g.core.G3TimeVector(arg: G3TimeVector)
- class spt3g.core.G3TimeVector(arg: Iterable)
Signature 1: Constructor from numpy array
Signature 3: Copy constructor
- clear()
Clear the contents
- extend(L: G3TimeVector)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- class spt3g.core.G3TimestreamUnits(value: int)
- class spt3g.core.G3TimestreamUnits(arg: None)
Unit scheme for timestreams and maps. Designates different classes of units (power, current, on-sky temperature) rather than choices of unit within a class (watts vs. horsepower, or K vs. uK), transformations between which are handled by core.G3Units.
- Angle = spt3g.core.G3TimestreamUnits.Angle
- Counts = spt3g.core.G3TimestreamUnits.Counts
- Current = spt3g.core.G3TimestreamUnits.Current
- Distance = spt3g.core.G3TimestreamUnits.Distance
- FluxDensity = spt3g.core.G3TimestreamUnits.FluxDensity
- Frequency = spt3g.core.G3TimestreamUnits.Frequency
- None = spt3g.core.G3TimestreamUnits.None
- Power = spt3g.core.G3TimestreamUnits.Power
- Pressure = spt3g.core.G3TimestreamUnits.Pressure
- Resistance = spt3g.core.G3TimestreamUnits.Resistance
- Tcmb = spt3g.core.G3TimestreamUnits.Tcmb
- Trj = spt3g.core.G3TimestreamUnits.Trj
- Voltage = spt3g.core.G3TimestreamUnits.Voltage
- property name: str
- names: dict
Mapping of enum names to objects.
{'Angle': spt3g.core.G3TimestreamUnits.Angle, 'Counts': spt3g.core.G3TimestreamUnits.Counts, 'Current': spt3g.core.G3TimestreamUnits.Current, 'Distance': spt3g.core.G3TimestreamUnits.Distance, 'FluxDensity': spt3g.core.G3TimestreamUnits.FluxDensity, 'Frequency': spt3g.core.G3TimestreamUnits.Frequency, 'None': spt3g.core.G3TimestreamUnits.None, 'Power': spt3g.core.G3TimestreamUnits.Power, 'Pressure': spt3g.core.G3TimestreamUnits.Pressure, 'Resistance': spt3g.core.G3TimestreamUnits.Resistance, 'Tcmb': spt3g.core.G3TimestreamUnits.Tcmb, 'Trj': spt3g.core.G3TimestreamUnits.Trj, 'Voltage': spt3g.core.G3TimestreamUnits.Voltage}
- property value: int
- values: dict
Mapping of enum values to objects.
{0: spt3g.core.G3TimestreamUnits.None, 1: spt3g.core.G3TimestreamUnits.Counts, 2: spt3g.core.G3TimestreamUnits.Current, 3: spt3g.core.G3TimestreamUnits.Power, 4: spt3g.core.G3TimestreamUnits.Tcmb, 5: spt3g.core.G3TimestreamUnits.Resistance, 6: spt3g.core.G3TimestreamUnits.Angle, 7: spt3g.core.G3TimestreamUnits.Distance, 8: spt3g.core.G3TimestreamUnits.Voltage, 9: spt3g.core.G3TimestreamUnits.Pressure, 10: spt3g.core.G3TimestreamUnits.FluxDensity, 11: spt3g.core.G3TimestreamUnits.Trj, 12: spt3g.core.G3TimestreamUnits.Frequency}
- class spt3g.core.G3VectorStringVector()
- class spt3g.core.G3VectorStringVector(arg: G3VectorStringVector)
- class spt3g.core.G3VectorStringVector(arg: Iterable)
Signature 2: Copy constructor
- append(x: G3VectorString)
Add an item to the end of the list
- clear()
Clear the contents
- count(x: G3VectorString) int
Return the number of times
x
appears in the list
- extend(L: G3VectorStringVector)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- insert(i: int, x: G3VectorString)
Insert an item at a given position.
- pop() G3VectorString
- pop(i: int) G3VectorString
Signature 1: Remove and return the last item
Signature 2: Remove and return the item at index
i
- remove(x: G3VectorString)
Remove the first item from the list whose value is x. It is an error if there is no such item.
- class spt3g.core.Int64Vector(arg: numpy.ndarray)
- class spt3g.core.Int64Vector()
- class spt3g.core.Int64Vector(arg: Int64Vector)
- class spt3g.core.Int64Vector(arg: Iterable)
Signature 1: Constructor from numpy array
Signature 3: Copy constructor
- all(axis=None, out=None, keepdims=False, *, where=True)
Returns True if all elements evaluate to True.
Refer to numpy.all for full documentation.
See also
numpy.all
equivalent function
- any(axis=None, out=None, keepdims=False, *, where=True)
Returns True if any of the elements of a evaluate to True.
Refer to numpy.any for full documentation.
See also
numpy.any
equivalent function
- append(x: int)
Add an item to the end of the list
- argmax(axis=None, out=None, *, keepdims=False)
Return indices of the maximum values along the given axis.
Refer to numpy.argmax for full documentation.
See also
numpy.argmax
equivalent function
- argmin(axis=None, out=None, *, keepdims=False)
Return indices of the minimum values along the given axis.
Refer to numpy.argmin for detailed documentation.
See also
numpy.argmin
equivalent function
- clear()
Clear the contents
- count(x: int) int
Return the number of times
x
appears in the list
- extend(L: Int64Vector)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- insert(i: int, x: int)
Insert an item at a given position.
- max(axis=None, out=None, keepdims=False, initial=<no value>, where=True)
Return the maximum along a given axis.
Refer to numpy.amax for full documentation.
See also
numpy.amax
equivalent function
- mean(axis=None, dtype=None, out=None, keepdims=False, *, where=True)
Returns the average of the array elements along given axis.
Refer to numpy.mean for full documentation.
See also
numpy.mean
equivalent function
- min(axis=None, out=None, keepdims=False, initial=<no value>, where=True)
Return the minimum along a given axis.
Refer to numpy.amin for full documentation.
See also
numpy.amin
equivalent function
- pop() int
- pop(i: int) int
Signature 1: Remove and return the last item
Signature 2: Remove and return the item at index
i
- remove(x: int)
Remove the first item from the list whose value is x. It is an error if there is no such item.
- std(
- axis=None,
- dtype=None,
- out=None,
- ddof=0,
- keepdims=False,
- *,
- where=True,
Returns the standard deviation of the array elements along given axis.
Refer to numpy.std for full documentation.
See also
numpy.std
equivalent function
- sum(
- axis=None,
- dtype=None,
- out=None,
- keepdims=False,
- initial=0,
- where=True,
Return the sum of the array elements over the given axis.
Refer to numpy.sum for full documentation.
See also
numpy.sum
equivalent function
- var(
- axis=None,
- dtype=None,
- out=None,
- ddof=0,
- keepdims=False,
- *,
- where=True,
Returns the variance of the array elements, along given axis.
Refer to numpy.var for full documentation.
See also
numpy.var
equivalent function
- class spt3g.core.IntVector(arg: numpy.ndarray)
- class spt3g.core.IntVector()
- class spt3g.core.IntVector(arg: IntVector)
- class spt3g.core.IntVector(arg: Iterable)
Signature 1: Constructor from numpy array
Signature 3: Copy constructor
- all(axis=None, out=None, keepdims=False, *, where=True)
Returns True if all elements evaluate to True.
Refer to numpy.all for full documentation.
See also
numpy.all
equivalent function
- any(axis=None, out=None, keepdims=False, *, where=True)
Returns True if any of the elements of a evaluate to True.
Refer to numpy.any for full documentation.
See also
numpy.any
equivalent function
- append(x: int)
Add an item to the end of the list
- argmax(axis=None, out=None, *, keepdims=False)
Return indices of the maximum values along the given axis.
Refer to numpy.argmax for full documentation.
See also
numpy.argmax
equivalent function
- argmin(axis=None, out=None, *, keepdims=False)
Return indices of the minimum values along the given axis.
Refer to numpy.argmin for detailed documentation.
See also
numpy.argmin
equivalent function
- clear()
Clear the contents
- count(x: int) int
Return the number of times
x
appears in the list
- extend(L: IntVector)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- insert(i: int, x: int)
Insert an item at a given position.
- max(axis=None, out=None, keepdims=False, initial=<no value>, where=True)
Return the maximum along a given axis.
Refer to numpy.amax for full documentation.
See also
numpy.amax
equivalent function
- mean(axis=None, dtype=None, out=None, keepdims=False, *, where=True)
Returns the average of the array elements along given axis.
Refer to numpy.mean for full documentation.
See also
numpy.mean
equivalent function
- min(axis=None, out=None, keepdims=False, initial=<no value>, where=True)
Return the minimum along a given axis.
Refer to numpy.amin for full documentation.
See also
numpy.amin
equivalent function
- pop() int
- pop(i: int) int
Signature 1: Remove and return the last item
Signature 2: Remove and return the item at index
i
- remove(x: int)
Remove the first item from the list whose value is x. It is an error if there is no such item.
- std(axis=None, dtype=None, out=None, ddof=0, keepdims=False, *, where=True)
Returns the standard deviation of the array elements along given axis.
Refer to numpy.std for full documentation.
See also
numpy.std
equivalent function
- sum(axis=None, dtype=None, out=None, keepdims=False, initial=0, where=True)
Return the sum of the array elements over the given axis.
Refer to numpy.sum for full documentation.
See also
numpy.sum
equivalent function
- var(axis=None, dtype=None, out=None, ddof=0, keepdims=False, *, where=True)
Returns the variance of the array elements, along given axis.
Refer to numpy.var for full documentation.
See also
numpy.var
equivalent function
- class spt3g.core.ItemsView
View of mapping items, with length and iteration operations.
- class spt3g.core.KeysView
View of mapping keys, with length, existence and iteration operations.
- class spt3g.core.ModuleConfigVector()
- class spt3g.core.ModuleConfigVector(arg: ModuleConfigVector)
- class spt3g.core.ModuleConfigVector(arg: Iterable)
Signature 2: Copy constructor
- append(x: G3ModuleConfig)
Add an item to the end of the list
- clear()
Clear the contents
- count(x: G3ModuleConfig) int
Return the number of times
x
appears in the list
- extend(L: ModuleConfigVector)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- insert(i: int, x: G3ModuleConfig)
Insert an item at a given position.
- pop() G3ModuleConfig
- pop(i: int) G3ModuleConfig
Signature 1: Remove and return the last item
Signature 2: Remove and return the item at index
i
- remove(x: G3ModuleConfig)
Remove the first item from the list whose value is x. It is an error if there is no such item.
- class spt3g.core.Quat()
- class spt3g.core.Quat(arg: Quat)
- class spt3g.core.Quat(a: float, b: float, c: float, d: float)
- class spt3g.core.Quat(data: Buffer)
- class spt3g.core.Quat(data: Iterable)
Representation of a quaternion. Data in a,b,c,d.
Signature 2: Copy constructor
Signature 3: Create a quaternion from its four elements.
Signature 4: Create a quaternion from a numpy array
Signature 5: Create a quaternion from a python iterable
- abs() float
Return the Euclidean norm of the quaternion
- norm() float
Return the Cayley norm of the quaternion
- vnorm() float
Return the Cayley norm of the unreal (vector) part of the quaternion
- property a: float
Scalar component
- property b: float
First vector component
- property c: float
Second vector component
- property d: float
Third vector component
- property real: float
The real (scalar) part of the quaternion
- class spt3g.core.QuatVector(arg: Buffer)
- class spt3g.core.QuatVector()
- class spt3g.core.QuatVector(arg: QuatVector)
- class spt3g.core.QuatVector(arg: Iterable)
Signature 1: Constructor from numpy array
Signature 3: Copy constructor
- clear()
Clear the contents
- extend(L: QuatVector)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- class spt3g.core.StringVector()
- class spt3g.core.StringVector(arg: StringVector)
- class spt3g.core.StringVector(arg: Iterable)
Signature 2: Copy constructor
- append(x: str)
Add an item to the end of the list
- clear()
Clear the contents
- count(x: str) int
Return the number of times
x
appears in the list
- extend(L: StringVector)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- insert(i: int, x: str)
Insert an item at a given position.
- pop() str
- pop(i: int) str
Signature 1: Remove and return the last item
Signature 2: Remove and return the item at index
i
- remove(x: str)
Remove the first item from the list whose value is x. It is an error if there is no such item.
- class spt3g.core.UInt64Vector(arg: numpy.ndarray)
- class spt3g.core.UInt64Vector()
- class spt3g.core.UInt64Vector(arg: UInt64Vector)
- class spt3g.core.UInt64Vector(arg: Iterable)
Signature 1: Constructor from numpy array
Signature 3: Copy constructor
- append(x: int)
Add an item to the end of the list
- clear()
Clear the contents
- count(x: int) int
Return the number of times
x
appears in the list
- extend(L: UInt64Vector)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- insert(i: int, x: int)
Insert an item at a given position.
- pop() int
- pop(i: int) int
Signature 1: Remove and return the last item
Signature 2: Remove and return the item at index
i
- remove(x: int)
Remove the first item from the list whose value is x. It is an error if there is no such item.
- class spt3g.core.UIntVector(arg: numpy.ndarray)
- class spt3g.core.UIntVector()
- class spt3g.core.UIntVector(arg: UIntVector)
- class spt3g.core.UIntVector(arg: Iterable)
Signature 1: Constructor from numpy array
Signature 3: Copy constructor
- append(x: int)
Add an item to the end of the list
- clear()
Clear the contents
- count(x: int) int
Return the number of times
x
appears in the list
- extend(L: UIntVector)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- insert(i: int, x: int)
Insert an item at a given position.
- pop() int
- pop(i: int) int
Signature 1: Remove and return the last item
Signature 2: Remove and return the item at index
i
- remove(x: int)
Remove the first item from the list whose value is x. It is an error if there is no such item.
- class spt3g.core.UnsignedCharVector()
- class spt3g.core.UnsignedCharVector(arg: UnsignedCharVector)
- class spt3g.core.UnsignedCharVector(arg: Iterable)
Signature 2: Copy constructor
- append(x: int)
Add an item to the end of the list
- clear()
Clear the contents
- count(x: int) int
Return the number of times
x
appears in the list
- extend(L: UnsignedCharVector)
- extend(L: Iterable) None
Signature 1: Extend the list by appending all the items in the given list
Signature 2: Extend the list by appending all the items in the given list
- insert(i: int, x: int)
Insert an item at a given position.
- pop() int
- pop(i: int) int
Signature 1: Remove and return the last item
Signature 2: Remove and return the item at index
i
- remove(x: int)
Remove the first item from the list whose value is x. It is an error if there is no such item.
- class spt3g.core.ValuesView
View of mapping values, with length and iteration operations.
- class spt3g.core.apidoc.G3Documenter(root)[source]
Class for inspecting sub-modules of the SPT-3G software package and generating valid RST for use with sphinx-autodoc.
- find_objects(mod=None)[source]
Recursively find all objects in the input root that fit into one of the API categories listed in
categories
.- Parameters:
mod (object) – Object to inspect
- Returns:
cache – Recursively populated dictionary of fully qualified names and their associated API category.
- Return type:
dict
- generate()[source]
Construct valid RST for each of the API types in separate sections, and list all relevant objects with appropriate sphinx-autodoc directives.
- Returns:
String containing valid RST to append to a document
- Return type:
str
- property categories
Dictionary of API categories for which to generate documentation, containing a section title, description, and sphinx-autodoc directive as a tuple for each category.
Dictionary of API categories for which to generate documentation, containing a section title, description, and sphinx-autodoc directive as a tuple for each category.
- class spt3g.core.fileio.G3File(path)[source]
Iterable class for G3 files, as created by G3Writer. Loop through frames by doing something like:
with core.G3File("/path/to/file.g3") as f: for frame in f: print(frame)
An entire file can also be read into an indexable list by doing:
f = list(core.G3File("/path/to/file.g3"))
Useful Functions
Various Python and C++ functions that are part of the public API.
- spt3g.core.apidoc.module_apidoc(module_path)[source]
Create API documentation for a submodule of the spt3g library.
The output separates each of the API types into separate sections, and lists all relevant objects with appropriate sphinx-autodoc directives.
- Parameters:
module_path (str) – Python module path to inspect, e.g. “spt3g.core”
- Returns:
String containing valid RST to append to a document
- Return type:
str
- spt3g.core.g3logging.log_debug(*args, unit='Python')[source]
Log a message for the given unit at level LOG_DEBUG.
- spt3g.core.g3logging.log_error(*args, unit='Python')[source]
Log a message for the given unit at level LOG_ERROR.
- spt3g.core.g3logging.log_fatal(*args, unit='Python')[source]
Log a message for the given unit at level LOG_FATAL, and raise a RuntimeError.
- spt3g.core.g3logging.log_info(*args, unit='Python')[source]
Log a message for the given unit at level LOG_INFO.
- spt3g.core.g3logging.log_notice(*args, unit='Python')[source]
Log a message for the given unit at level LOG_NOTICE.
- spt3g.core.g3logging.log_trace(*args, unit='Python')[source]
Log a message for the given unit at level LOG_TRACE.
- spt3g.core.g3logging.log_warn(*args, unit='Python')[source]
Log a message for the given unit at level LOG_WARN.
- spt3g.core.g3logging.set_log_level(level, unit=None)[source]
Set log level to the requested level. If unit is not None, set the log level for the given logging unit only.
Example
core.set_log_level(core.G3LogLevel.LOG_DEBUG, 'GCPMuxDataDecoder')
- spt3g.core.timestreamextensions.concatenate_timestreams(ts_lst, ts_rounding_error=0.6, ts_interp_threshold=0)[source]
Concatenate G3Timestream or G3TimestreamMap objects together.
- Parameters:
ts_lst (list) – list of G3Timestream or G3TimestreamMap objects. Must all be the same type.
ts_rounding_error (float) – allowed error in timestream separation such that timestreams are contiguous, as a fraction of the sample rate. This should be 0 by default, but is 0.5 to allow for downsampler shifting, and then bumpted again to 0.6 to allow for floating-point errors in what 0.5 is.
ts_interp_threshold (float) – allowed timestream separation below which gaps between timestreams are interpolated to be made continuous
- Returns:
ts – The concatenation of the input list of objects
- Return type:
G3Timestream or G3TimestreamMap object
Decorators
Decorator functions for indicating any of the above types and/or modifying function behavior.
- @spt3g.core.g3decorators.cache_frame_data(type, **kwargs)[source]
This is a decorator for use with G3Modules written as functions. It enables a function to use cached values from other types of frames in the processing of a frame.
To make that confusing sentence clearer with an example, in a lot of cases we want to have a module that works on Scan frames, but have access to the BolometerProperties. This decorator allows you to specify the information to cache. This case looks like:
@core.cache_frame_data(type=core.G3FrameType.Scan, bolo_props='BolometerProperties') def FlagSomeStuff(frame, flag_key='Flags', bolo_props=None): pass
You specify the type of frame the function is operating on with the type argument. Any additional keyword arguments specifies information to cache and send to the function.
For the keyword args passed to the decorator having the format: Key = Value. Key specifies the name of the argument that we pass the infromation to in the decorated function. If the decorated function is called with Key as an argument it will overwrite the value specified in the decorator.
Value specifies the default path to look for the cached data. It will search all of the frames that do not have the frame type ‘type’ for a key with that value. This can be overridden when calling the decorated function.
- @spt3g.core.g3decorators.scan_func_cache_data[source]
This is a simple wrapper around cache_frame_data where the type argument has been set to core.G3FrameType.Scan.
- @spt3g.core.modconstruct.indexmod[source]
Mark argument as a processing module that can be found by automated documentation tools.
Example
@core.indexmod def dostuff(frame): dosomestuff()
- @spt3g.core.modconstruct.pipesegment[source]
Use as a decorator for a pre-assembled set of pipeline modules. Makes a pseudo-module consisting of several inputs. Use this to introspect the segment to find out what it does, or use
pipesegment_nodoc()
if your module does anything complicated.Example
@core.pipesegment def standardfiltering( pipe, PolyOrder=4, MaskedHighPassEll=6000, Input='CalTimestreams', Output='FilteredTimestreams', ): pipe.Add(analysis.PolyFilter, PolyOrder=PolyOrder, Input=Input, Output='__Temp' + Output) pipe.Add(analysis.MaskedHighPass, MaskedHighPassEll=MaskedHighPassEll, Input='__Temp' + Output, Output=Output) def cleanup(frame): del frame['__Temp' + Output] pipe.Add(cleanup) pipe.Add(standardfiltering, PolyOrder=3)
- @spt3g.core.modconstruct.pipesegment_nodoc[source]
Use as a decorator for a pre-assembled set of pipeline modules. Makes a pseudo-module consisting of several inputs. Use this variant instead of
pipesegment
to avoid introspection if your pipeline does anything complicated.Example
@core.pipesegment_nodoc def standardfiltering( pipe, PolyOrder=4, MaskedHighPassEll=6000, Input='CalTimestreams', Output='FilteredTimestreams', ): pipe.Add(analysis.PolyFilter, PolyOrder=PolyOrder, Input=Input, Output='__Temp' + Output) pipe.Add(analysis.MaskedHighPass, MaskedHighPassEll=MaskedHighPassEll, Input='__Temp' + Output, Output=Output) def cleanup(frame): del frame['__Temp' + Output] pipe.Add(cleanup) pipe.Add(standardfiltering, PolyOrder=3)