Instrument¶
- class cometsuite.instruments.Instrument(axes, scaler=None, normalizer=None, bins=10, range=None)¶
Bases:
objectSimulated instruments that can record anything.
Essentially a fancy histogram designed for Simulation.
A set of canned instruments are defined in cometsuite.instruments.
- Parameters:
- axestuple
Each axis is the name of a Simulation property that returns a single vector (e.g., radius, beta, s_ej, lam, bet, theta), a function that will generate data from the simulation, or a string describing a function to be passed to eval. In the latter case, numpy is imported as np, the simulation is named sim, and the string must be prefixed with “func:”. For example, to return the heliocentric ecliptic x coordinate, use “func:sim.r_f[0]”, or return the log of the radius with “func:np.log10(sim.radius)”.
- scalerScaler or CompositeScaler, optional
Particle scaler.
- normalizerScaler or CompositeScaler, optional
Use this scaling function for computing the normalization array n.
- binsint or ndarray, or tuples thereof, optional
The number of bins or the bin edges for each axis.
- range2-tuple, or tuples thereof, optional
When bin edges are not defined, use range as the left-most and right-most edges.
- Attributes:
- nndarray, int
The number of particles that have been observed.
- datandarray, float
The integration over all observed particles.
- extentndarray
The left- and right-most edges of the arrays, e.g., for use with matplotlib’s imshow.
- normalizedndarray, float
data / n.
Attributes Summary
Methods Summary
integrate(sim)Collect data from a simulation.
reset([bins, range])Initialize data arrays, optionally recomputing the bins.
Attributes Documentation
- extent¶
- normalized¶
Methods Documentation
- integrate(sim)¶
Collect data from a simulation.
- reset(bins=None, range=None)¶
Initialize data arrays, optionally recomputing the bins.
- Parameters:
- binsint or array, optional
The number of bins or bin edges.
- rangearray, optional
When bins is an integer, use range as the left and right edges.