apportion_counts_to_resultants

romanisim.l1.apportion_counts_to_resultants(counts, tij, pedestal=None, pedestal_extra_noise=None, 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 electrons to each read composing a resultant, and averages the reads together to make the resultants.

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 implemented via 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

An initial reset level can be supported by setting the pedestal and pedestal extra noise levels. These need to be correct to probe the correct portion of the linearity & inverse linearity polynomials.

Parameters:
countsnp.ndarray[ny, nx] (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 lists of readout times for each read entering a resultant

pedestal: int

initial instrumental count level (electrons)

pedestal_extra_noise: float

pedestal noise (electrons)

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