LSST Applications 27.0.0,g0265f82a02+469cd937ee,g02d81e74bb+21ad69e7e1,g1470d8bcf6+cbe83ee85a,g2079a07aa2+e67c6346a6,g212a7c68fe+04a9158687,g2305ad1205+94392ce272,g295015adf3+81dd352a9d,g2bbee38e9b+469cd937ee,g337abbeb29+469cd937ee,g3939d97d7f+72a9f7b576,g487adcacf7+71499e7cba,g50ff169b8f+5929b3527e,g52b1c1532d+a6fc98d2e7,g591dd9f2cf+df404f777f,g5a732f18d5+be83d3ecdb,g64a986408d+21ad69e7e1,g858d7b2824+21ad69e7e1,g8a8a8dda67+a6fc98d2e7,g99cad8db69+f62e5b0af5,g9ddcbc5298+d4bad12328,ga1e77700b3+9c366c4306,ga8c6da7877+71e4819109,gb0e22166c9+25ba2f69a1,gb6a65358fc+469cd937ee,gbb8dafda3b+69d3c0e320,gc07e1c2157+a98bf949bb,gc120e1dc64+615ec43309,gc28159a63d+469cd937ee,gcf0d15dbbd+72a9f7b576,gdaeeff99f8+a38ce5ea23,ge6526c86ff+3a7c1ac5f1,ge79ae78c31+469cd937ee,gee10cc3b42+a6fc98d2e7,gf1cff7945b+21ad69e7e1,gfbcc870c63+9a11dc8c8f
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Attributes | List of all members
lsst.ip.isr.deferredCharge.SerialTrap Class Reference

Public Member Functions

 __init__ (self, size, emission_time, pixel, trap_type, coeffs)
 
 __eq__ (self, other)
 
 trap_array (self)
 
 trapped_charge (self)
 
 initialize (self, ny, nx, prescan_width)
 
 release_charge (self)
 
 trap_charge (self, free_charge)
 
 capture (self, pixel_signals)
 

Public Attributes

 size
 
 emission_time
 
 pixel
 
 trap_type
 
 coeffs
 
 interp
 
 trapped_charge
 

Protected Attributes

 _trap_array
 
 _trapped_charge
 

Detailed Description

Represents a serial register trap.

Parameters
----------
size : `float`
    Size of the charge trap, in electrons.
emission_time : `float`
    Trap emission time constant, in inverse transfers.
pixel : `int`
    Serial pixel location of the trap, including the prescan.
trap_type : `str`
    Type of trap capture to use.  Should be one of ``linear``,
    ``logistic``, or ``spline``.
coeffs : `list` [`float`]
    Coefficients for the capture process.  Linear traps need one
    coefficient, logistic traps need two, and spline based traps
    need to have an even number of coefficients that can be split
    into their spline locations and values.

Raises
------
ValueError
    Raised if the specified parameters are out of expected range.

Definition at line 36 of file deferredCharge.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.ip.isr.deferredCharge.SerialTrap.__init__ ( self,
size,
emission_time,
pixel,
trap_type,
coeffs )

Definition at line 62 of file deferredCharge.py.

62 def __init__(self, size, emission_time, pixel, trap_type, coeffs):
63 if size < 0.0:
64 raise ValueError('Trap size must be greater than or equal to 0.')
65 self.size = size
66
67 if emission_time <= 0.0:
68 raise ValueError('Emission time must be greater than 0.')
69 if np.isnan(emission_time):
70 raise ValueError('Emission time must be real-valued, not NaN')
71 self.emission_time = emission_time
72
73 if int(pixel) != pixel:
74 raise ValueError('Fraction value for pixel not allowed.')
75 self.pixel = int(pixel)
76
77 self.trap_type = trap_type
78 self.coeffs = coeffs
79
80 if self.trap_type not in ('linear', 'logistic', 'spline'):
81 raise ValueError('Unknown trap type: %s', self.trap_type)
82
83 if self.trap_type == 'spline':
84 # Note that ``spline`` is actually a piecewise linear interpolation
85 # in the model and the application, and not a true spline.
86 centers, values = np.split(np.array(self.coeffs, dtype=np.float64), 2)
87 # Ensure all NaN values are stripped out
88 values = values[~np.isnan(centers)]
89 centers = centers[~np.isnan(centers)]
90 centers = centers[~np.isnan(values)]
91 values = values[~np.isnan(values)]
92 self.interp = interp.interp1d(
93 centers,
94 values,
95 bounds_error=False,
96 fill_value=(values[0], values[-1]),
97 )
98
99 self._trap_array = None
100 self._trapped_charge = None
101

Member Function Documentation

◆ __eq__()

lsst.ip.isr.deferredCharge.SerialTrap.__eq__ ( self,
other )

Definition at line 102 of file deferredCharge.py.

102 def __eq__(self, other):
103 # A trap is equal to another trap if all of the initialization
104 # parameters are equal. All other properties are only filled
105 # during use, and are not persisted into the calibration.
106 if self.size != other.size:
107 return False
108 if self.emission_time != other.emission_time:
109 return False
110 if self.pixel != other.pixel:
111 return False
112 if self.trap_type != other.trap_type:
113 return False
114 if self.coeffs != other.coeffs:
115 return False
116 return True
117

◆ capture()

lsst.ip.isr.deferredCharge.SerialTrap.capture ( self,
pixel_signals )
Trap capture function.

Parameters
----------
pixel_signals : `list` [`float`]
    Input pixel values.

Returns
-------
captured_charge : `list` [`float`]
    Amount of charge captured from each pixel.

Raises
------
RuntimeError
    Raised if the trap type is invalid.

Definition at line 183 of file deferredCharge.py.

183 def capture(self, pixel_signals):
184 """Trap capture function.
185
186 Parameters
187 ----------
188 pixel_signals : `list` [`float`]
189 Input pixel values.
190
191 Returns
192 -------
193 captured_charge : `list` [`float`]
194 Amount of charge captured from each pixel.
195
196 Raises
197 ------
198 RuntimeError
199 Raised if the trap type is invalid.
200 """
201 if self.trap_type == 'linear':
202 scaling = self.coeffs[0]
203 return np.minimum(self.size, pixel_signals*scaling)
204 elif self.trap_type == 'logistic':
205 f0, k = (self.coeffs[0], self.coeffs[1])
206 return self.size/(1.+np.exp(-k*(pixel_signals-f0)))
207 elif self.trap_type == 'spline':
208 return self.interp(pixel_signals)
209 else:
210 raise RuntimeError(f"Invalid trap capture type: {self.trap_type}.")
211
212

◆ initialize()

lsst.ip.isr.deferredCharge.SerialTrap.initialize ( self,
ny,
nx,
prescan_width )
Initialize trapping arrays for simulated readout.

Parameters
----------
ny : `int`
    Number of rows to simulate.
nx : `int`
    Number of columns to simulate.
prescan_width : `int`
    Additional transfers due to prescan.

Raises
------
ValueError
    Raised if the trap falls outside of the image.

Definition at line 126 of file deferredCharge.py.

126 def initialize(self, ny, nx, prescan_width):
127 """Initialize trapping arrays for simulated readout.
128
129 Parameters
130 ----------
131 ny : `int`
132 Number of rows to simulate.
133 nx : `int`
134 Number of columns to simulate.
135 prescan_width : `int`
136 Additional transfers due to prescan.
137
138 Raises
139 ------
140 ValueError
141 Raised if the trap falls outside of the image.
142 """
143 if self.pixel > nx+prescan_width:
144 raise ValueError('Trap location {0} must be less than {1}'.format(self.pixel,
145 nx+prescan_width))
146
147 self._trap_array = np.zeros((ny, nx+prescan_width))
148 self._trap_array[:, self.pixel] = self.size
149 self._trapped_charge = np.zeros((ny, nx+prescan_width))
150

◆ release_charge()

lsst.ip.isr.deferredCharge.SerialTrap.release_charge ( self)
Release charge through exponential decay.

Returns
-------
released_charge : `float`
    Charge released.

Definition at line 151 of file deferredCharge.py.

151 def release_charge(self):
152 """Release charge through exponential decay.
153
154 Returns
155 -------
156 released_charge : `float`
157 Charge released.
158 """
159 released_charge = self._trapped_charge*(1-np.exp(-1./self.emission_time))
160 self._trapped_charge -= released_charge
161
162 return released_charge
163

◆ trap_array()

lsst.ip.isr.deferredCharge.SerialTrap.trap_array ( self)

Definition at line 119 of file deferredCharge.py.

119 def trap_array(self):
120 return self._trap_array
121

◆ trap_charge()

lsst.ip.isr.deferredCharge.SerialTrap.trap_charge ( self,
free_charge )
Perform charge capture using a logistic function.

Parameters
----------
free_charge : `float`
    Charge available to be trapped.

Returns
-------
captured_charge : `float`
    Amount of charge actually trapped.

Definition at line 164 of file deferredCharge.py.

164 def trap_charge(self, free_charge):
165 """Perform charge capture using a logistic function.
166
167 Parameters
168 ----------
169 free_charge : `float`
170 Charge available to be trapped.
171
172 Returns
173 -------
174 captured_charge : `float`
175 Amount of charge actually trapped.
176 """
177 captured_charge = (np.clip(self.capture(free_charge), self.trapped_charge, self._trap_array)
178 - self.trapped_charge)
179 self._trapped_charge += captured_charge
180
181 return captured_charge
182

◆ trapped_charge()

lsst.ip.isr.deferredCharge.SerialTrap.trapped_charge ( self)

Definition at line 123 of file deferredCharge.py.

123 def trapped_charge(self):
124 return self._trapped_charge
125

Member Data Documentation

◆ _trap_array

lsst.ip.isr.deferredCharge.SerialTrap._trap_array
protected

Definition at line 99 of file deferredCharge.py.

◆ _trapped_charge

lsst.ip.isr.deferredCharge.SerialTrap._trapped_charge
protected

Definition at line 100 of file deferredCharge.py.

◆ coeffs

lsst.ip.isr.deferredCharge.SerialTrap.coeffs

Definition at line 78 of file deferredCharge.py.

◆ emission_time

lsst.ip.isr.deferredCharge.SerialTrap.emission_time

Definition at line 71 of file deferredCharge.py.

◆ interp

lsst.ip.isr.deferredCharge.SerialTrap.interp

Definition at line 92 of file deferredCharge.py.

◆ pixel

lsst.ip.isr.deferredCharge.SerialTrap.pixel

Definition at line 75 of file deferredCharge.py.

◆ size

lsst.ip.isr.deferredCharge.SerialTrap.size

Definition at line 65 of file deferredCharge.py.

◆ trap_type

lsst.ip.isr.deferredCharge.SerialTrap.trap_type

Definition at line 77 of file deferredCharge.py.

◆ trapped_charge

lsst.ip.isr.deferredCharge.SerialTrap.trapped_charge

Definition at line 178 of file deferredCharge.py.


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