LSSTApplications  21.0.0+1b62c9342b,21.0.0+45a059f35e,21.0.0-1-ga51b5d4+ceb9cf20a3,21.0.0-19-g7c7630f+a88ebbf2d9,21.0.0-2-g103fe59+3522cf3bc7,21.0.0-2-g1367e85+571a348718,21.0.0-2-g2909d54+45a059f35e,21.0.0-2-g45278ab+1b62c9342b,21.0.0-2-g4bc9b9f+35a70d5868,21.0.0-2-g5242d73+571a348718,21.0.0-2-g54e2caa+aa129c4686,21.0.0-2-g66bcc37+3caef57c29,21.0.0-2-g7f82c8f+6f9059e2fe,21.0.0-2-g8dde007+5d1b9cb3f5,21.0.0-2-g8f08a60+73884b2cf5,21.0.0-2-g973f35b+1d054a08b9,21.0.0-2-ga326454+6f9059e2fe,21.0.0-2-ga63a54e+3d2c655db6,21.0.0-2-gc738bc1+a567cb0f17,21.0.0-2-gde069b7+5a8f2956b8,21.0.0-2-ge17e5af+571a348718,21.0.0-2-ge712728+834f2a3ece,21.0.0-2-gecfae73+dfe6e80958,21.0.0-2-gfc62afb+571a348718,21.0.0-21-g006371a9+88174a2081,21.0.0-3-g4c5b185+7fd31a6834,21.0.0-3-g6d51c4a+3caef57c29,21.0.0-3-gaa929c8+55f5a6a5c9,21.0.0-3-gd222c45+afc8332dbe,21.0.0-3-gd5de2f2+3caef57c29,21.0.0-4-g3300ddd+1b62c9342b,21.0.0-4-g5873dc9+9a92674037,21.0.0-4-g8a80011+5955f0fd15,21.0.0-5-gb7080ec+8658c79ec4,21.0.0-5-gcff38f6+89f2a0074d,21.0.0-6-gd3283ba+55f5a6a5c9,21.0.0-8-g19111d86+2c4b0a9f47,21.0.0-9-g7bed000b9+c7d3cce47e,w.2021.03
LSSTDataManagementBasePackage
Public Member Functions | Public Attributes | List of all members
lsst.cp.pipe.astierCovFitParameters.StructArray Class Reference
Inheritance diagram for lsst.cp.pipe.astierCovFitParameters.StructArray:

Public Member Functions

def __new__ (cls, array, struct=[])
 
def __array_finalize__ (self, obj)
 
def __getitem__ (self, args)
 
def __setitem__ (self, args, val)
 
def __getslice__ (self, start, stop)
 
def __reduce__ (self)
 
def __setstate__ (self, state)
 

Public Attributes

 struct
 

Detailed Description

Decorate numpy arrays with a collection of named slices.

Array slices becomes accessible by their name. This is applicable to
nd array, although the same `Structure` is shared between all
dimensions.

Examples:
---------
>>> v = StructArray(np.zeros(10), [('a', 3), ('b', 7)])
>>> print v['a']
[ 0.  0.  0.]

>>> C = StructArray(np.zeros((10,10)), [('a', 2), ('b', 8)])
>>> print C['a', 'a']
[[ 0.  0.]
 [ 0.  0.]]

Definition at line 107 of file astierCovFitParameters.py.

Member Function Documentation

◆ __array_finalize__()

def lsst.cp.pipe.astierCovFitParameters.StructArray.__array_finalize__ (   self,
  obj 
)

Definition at line 130 of file astierCovFitParameters.py.

130  def __array_finalize__(self, obj):
131  if obj is None:
132  return
133  self.struct = getattr(obj, 'struct', [])
134 

◆ __getitem__()

def lsst.cp.pipe.astierCovFitParameters.StructArray.__getitem__ (   self,
  args 
)

Definition at line 135 of file astierCovFitParameters.py.

135  def __getitem__(self, args):
136  if not isinstance(args, tuple):
137  args = args,
138  newargs = tuple([self.struct[arg] for arg in args])
139  return np.asarray(self)[newargs]
140 

◆ __getslice__()

def lsst.cp.pipe.astierCovFitParameters.StructArray.__getslice__ (   self,
  start,
  stop 
)

Definition at line 147 of file astierCovFitParameters.py.

147  def __getslice__(self, start, stop):
148  return self.__getitem__(slice(start, stop))
149 

◆ __new__()

def lsst.cp.pipe.astierCovFitParameters.StructArray.__new__ (   cls,
  array,
  struct = [] 
)

Definition at line 125 of file astierCovFitParameters.py.

125  def __new__(cls, array, struct=[]):
126  obj = array.view(cls)
127  obj.struct = Structure(struct)
128  return obj
129 

◆ __reduce__()

def lsst.cp.pipe.astierCovFitParameters.StructArray.__reduce__ (   self)

Definition at line 150 of file astierCovFitParameters.py.

150  def __reduce__(self):
151  # Get the parent's __reduce__ tuple
152  pickled_state = super(StructArray, self).__reduce__()
153  # Create our own tuple to pass to __setstate__
154  new_state = pickled_state[2] + (self.struct,)
155  # Return a tuple that replaces the parent's __setstate__ tuple with our own
156  return (pickled_state[0], pickled_state[1], new_state)
157 

◆ __setitem__()

def lsst.cp.pipe.astierCovFitParameters.StructArray.__setitem__ (   self,
  args,
  val 
)

Definition at line 141 of file astierCovFitParameters.py.

141  def __setitem__(self, args, val):
142  if not isinstance(args, tuple):
143  args = args,
144  newargs = tuple([self.struct[arg] for arg in args])
145  np.asarray(self)[newargs] = val
146 

◆ __setstate__()

def lsst.cp.pipe.astierCovFitParameters.StructArray.__setstate__ (   self,
  state 
)

Definition at line 158 of file astierCovFitParameters.py.

158  def __setstate__(self, state):
159  self.struct = state[-1] # Set the info attribute
160  # Call the parent's __setstate__ with the other tuple elements.
161  super(StructArray, self).__setstate__(state[0:-1])
162 
163 

Member Data Documentation

◆ struct

lsst.cp.pipe.astierCovFitParameters.StructArray.struct

Definition at line 133 of file astierCovFitParameters.py.


The documentation for this class was generated from the following file: