apportion_counts_to_resultants¶
- romanisim.l1.apportion_counts_to_resultants(counts, tij, inv_linearity=None, crparam=None, persistence=None, tstart=None, rng=None, seed=None)¶
Apportion counts to resultants given read times.
This finds a statistically appropriate assignment of counts to each read composing a resultant, and averages the reads together to make the resultants.
There’s an alternative approach where you have a count rate image and need to do Poisson draws from it. That’s easier, and isn’t this function. On some systems I’ve used Poisson draws have been slower than binomial draws, so it’s not clear that approach offers any advantages, either— though I’ve had mixed experience there.
We loop over the reads, each time sampling from the counts image according to the probability that a photon lands in that particular read. This is just np.random.binomial(number of counts left, p/p_left)
We then average the reads together to get a resultant.
We accumulate:
a sum for the resultant, which is divided by the number of reads and returned in the resultants array
a sum for the total number of photons accumulated so far, so we know where to start the next resultant
the resultants so far
- Parameters:
- countsnp.ndarray[nx, ny] (int)
The number of counts in each pixel from sources in the final image This final image should be a ~conceptual image of the scene observed by an idealized instrument seeing only backgrounds and sources and observing until the end of the last read; no instrumental effects are included beyond PSF & distortion.
- tijlist[list[float]]
list of list of readout times for each read entering a resultant
- inv_linearityromanisim.nonlinearity.NL or None
Object implementing inverse non-linearity correction
- crparamdict
Dictionary of keywords sent to romanisim.cr.simulate_crs for simulating cosmic rays. If None, no CRs are added
- persistenceromanisim.persistence.Persistence or None
Persistence object describing persistence-affected photons, or None if persistence should not be simulated.
- tstartastropy.time.Time
Time of exposure start. Used only if persistence is not None.
- rnggalsim.BaseDeviate
random number generator
- seedint
seed to use for random number generator
- Returns:
- resultants, dq
- resultantsnp.ndarray[n_resultant, nx, ny]
array of n_resultant images giving each resultant
- dqnp.ndarray[n_resultant, nx, ny]
dq array marking CR hits in resultants