irfpy.swim.swim_mass

Module for SWIM mass analysis

irfpy.swim.swim_mass.getobstime(orbit=None, timerange=None)[source]

Return the observation time of SWIM mass data.

Parameters
  • orbit – Returns the obseration time for corresponding orbit number

  • timerange – Time range to be examined.

Either orbit or timerange should be specified.

>>> o939 = getobstime(orbit=939)
>>> print(len(o939))
885
>>> t0 = datetime.datetime(2009, 1, 25, 12, 0, 0)
>>> t1 = datetime.datetime(2009, 1, 25, 15, 0, 0)
>>> o2 = getobstime(timerange=[t0, t1])
>>> print(len(o2))
777
irfpy.swim.swim_mass.getdata(t, filter=[])[source]

Get the data.

Parameters
  • t (Type supported by irfpy.util.utc.convert.) – Time.

  • filter – Filter to apply. Usually a function defined in filter class.

>>> t0 = datetime.datetime(2009, 1, 25, 14)
>>> data = getdata(t0)
>>> mspec = data.getData()  # Mass spectra data
>>> print(mspec.shape)
(16, 16, 32)
>>> print(mspec.sum())   # Using v3.2 database.
1538.0

If you use filter to filter out one counts, the value should change. >>> mspec_ocr = getdata(t0, filter=[filter.remove_one_count]).getData() >>> print(mspec_ocr.shape) (16, 16, 32) >>> print(mspec_ocr.sum()) 1409.0

You may remove one count event using filter.remove_one_count_event_l1(). >>> mspec_l1 = getdata(t0, filter=[filter.remove_one_count_event_l1]).getData() >>> print(mspec_l1.shape) (16, 16, 32) >>> print(mspec_l1.sum()) 1528.0

irfpy.swim.swim_mass.statusCache()[source]
irfpy.swim.swim_mass.clearCache()[source]
class irfpy.swim.swim_mass.filter[source]

Bases: object

Collection of SWIM mass matrix fileters.

SWIM mass matrix filter is a function that get raw E16xD16xM32 matrix (np.array) to return the matrix that has the same shape.

classmethod remove_one_count(raw)[source]

As one count is not statistically siginificant, those counts are removed.

# Emulate the raw counts that consists fully with 1. >>> raw = np.ones([16, 16, 32]) >>> print(raw.sum()) 8192.0

# If the filter is applied, everything should be zero. >>> proc = filter.remove_one_count(raw) >>> print(proc.sum()) 0.0

>>> print(raw.sum())
8192.0
classmethod remove_one_count_event_l1(raw)[source]

Remove one count event with L1 (empirical) suppression.

One count event is not same as 1 count in the usual sense. This is an instrumental origin, appears strange count in a specific tof channel.

This can also be referred to swimmassspectrum.pro that MW developed originally in IDL. See https://butler.irf.se/sara-trac/file/SARA/swim_mass/swimmassspectrum.pro also.

The original procedure contains the comment like: define elements where one-count events can happen empiricaly this is probably temperature independent, but takes less events away

classmethod remove_one_count_event_l2(raw)[source]

Remove one count event with L2 (soft) suppression.

One count event is not same as 1 count in the usual sense. This is an instrumental origin, appears strange count in a specific tof channel.

This can also be referred to swimmassspectrum.pro that MW developed originally in IDL. See https://butler.irf.se/sara-trac/file/SARA/swim_mass/swimmassspectrum.pro also.

The original procedure contains the comment like: Define elements where one-count events can happen analyticaly: this is temperature independent, but takes sometimes too many counts away

classmethod remove_one_count_event_l3(raw)[source]

Remove one count event with L3 (strong) suppression.

One count event is not same as 1 count in the usual sense. This is an instrumental origin, appears strange count in a specific tof channel.

This can also be referred to swimmassspectrum.pro that MW developed originally in IDL. See https://butler.irf.se/sara-trac/file/SARA/swim_mass/swimmassspectrum.pro also.

The original procedure contains the comment like: Define elements where one-count events can happen analyticaly: this is temperature independent, but takes sometimes too many counts away

classmethod remove_one_count_event_l4(raw)[source]

Remove one count event with L4 (full) suppression.

One count event is not same as 1 count in the usual sense. This is an instrumental origin, appears strange count in a specific tof channel.

This can also be referred to swimmassspectrum.pro that MW developed originally in IDL. See https://butler.irf.se/sara-trac/file/SARA/swim_mass/swimmassspectrum.pro also.

The original procedure contains the comment like: ; Define elements where one-count events can happen analyticaly: ; this is temperature independent, but takes sometimes too many counts away