Comments (2)
A quick list of methods to keep:
- collect_charge(img, wave, qe)
- collect_charge_bayer(img, wave, red_qe, green_qe, blue_qe, bayer_pattern)
- pixelate(img, pixelscale, oversample)
- adc(img, gain, saturation_capacity)
- shot_noise(img, method)
- autoregressive_noise(img, sigma, ar_parameter, axis, seed)
- charge_diffusion(img, sigma)
- rule_07_dark_current(temperature, cutoff_wavelength, pixelscale, shape)
- cosmic_ray(img, pixelscale, ts, rate, proton_flux, alpha_flux)
from lentil.
autoregressive_noise
isn't going to make the cut. In case we want to include it later, here are the relevant bits of code required to reconstruct the functionality:
class NormalFPN(RandomFPN):
"""Base class for fixed pattern noise represented by a normal distribution.
Parameters
----------
loc : float
scale : float
size : float
"""
def __init__(self, loc, scale, size, seed=None):
super().__init__(seed)
if self.rng:
self.data = self.rng.normal(loc, scale, size)
else:
self.data = np.random.normal(loc, scale, size)
class PixelOffsetFPN(NormalFPN):
r"""Pixel offset FPN model.
Pixel offset FPN can be represented by an autoregressive random process with
(:math:`\mu = 0.0, \sigma = ` :attr:`sigma`) [1], [2].
Parameters
----------
sigma : float
1-sigma pixel offset FPN value in number of electrons
ar_parameter : float
Autoregressive parameter which characterizes the dependency of each
pixel on its neighbors. Valid values are between 0 and 0.5 [1]. Small
values correspond to less correlation.
size : None or array_like, optional
Precomputed FPN matrix size. Typically this will be equal to the
detector size. See :class:`GainFPN` note for details on the two
different modes for when ``size`` is specified or not.
seed : None, int, or array_like, optional
Random seed used to initialize ``numpy.random.RandomState``. If
``None``, then ``RandomState`` will try to read data from /dev/urandom
(or the Windows analogue) if available or seed from the clock otherwise.
References
----------
[1] El Gamal, A. et. al., Modeling and Estimation of FPN Components in CMOS Image Sensors, SPIE Proc. 3301 (1998)
[2] `Autoregressive model - Wikipedia <https://en.wikipedia.org/wiki/Autoregressive_model>`_
"""
def __init__(self, sigma, ar_parameter, size, seed=None):
assert (ar_parameter >= 0) and (ar_parameter <= 0.5)
super().__init__(loc=1.0, scale=sigma, size=size, seed=seed)
self.sigma = sigma
self.ar_parameter = ar_parameter
# apply the autoregressive filter
self.data = signal.lfilter([1], [1, self.ar_parameter], self.data, axis=0)
class ColumnOffsetFPN(NormalFPN):
r"""Column offset FPN model.
Column offset FPN can be represented by an autoregressive random process
with (:math:`\mu = 0.0, \sigma = ` :attr:`sigma`) [1], [2].
Parameters
----------
sigma : float
1-sigma column offset FPN value in number of electrons
ar_parameter : float
Autoregressive parameter which characterizes the dependency of each
column on its neighbors. Valid values are between 0 and 0.5 [1]. Small
values correspond to less correlation.
size : None or array_like, optional
Precomputed FPN matrix size. Typically this will be equal to the
detector size. See :class:`GainFPN` note for details on the two
different modes for when ``size`` is specified or not.
seed : None, int, or array_like, optional
Random seed used to initialize ``numpy.random.RandomState``. If
``None``, then ``RandomState`` will try to read data from /dev/urandom
(or the Windows analogue) if available or seed from the clock otherwise.
References
----------
[1] El Gamal, A. et. al., Modeling and Estimation of FPN Components in CMOS
Image Sensors, SPIE Proc. 3301 (1998)
[2] `Autoregressive model - Wikipedia <https://en.wikipedia.org/wiki/Autoregressive_model>`_
"""
def __init__(self, sigma, ar_parameter, size, seed=None):
assert (ar_parameter >= 0) and (ar_parameter <= 0.5)
super().__init__(loc=1.0, scale=sigma, size=size[1], seed=seed)
self.sigma = sigma
self.ar_parameter = ar_parameter
# apply the autoregressive filter
self.data = signal.lfilter([1], [1, self.ar_parameter], self.data)
self.data = np.tile(self.data, (size[0], 1))
from lentil.
Related Issues (20)
- Adjust how default value for npix in propagate() is computed HOT 2
- Combine mask and segmask in Plane
- Implement generic multiply interface
- Replace Plane caching functionality with `Plane.freeze()` HOT 1
- Update Plane.fit_tilt() to return a new Plane object HOT 1
- Implement a plane resampling method
- Deprecate `propagate()`, attach new methods to `Wavefront`
- Remove modeltools.iterable_* methods
- Deprecate Pupil diameter attribute
- Can't access Wavefront.field when created with default values
- Plane.multiply() isn't robust to multiplication with a default Plane
- planes with no pixelscale should have pixelscale=() instead of None
- rescale() should accept 2-dimensional scale
- Add Plane.freeze() method
- Rethink plane transformations
- Allow in-place operations on Wavefront
- Python 3.9 breaks mat2ndarray.m HOT 2
- Update map_coordinates import
- Something in Numpy 1.22 causing test failure HOT 3
- Wavefront.insert function signature is inconsistent with what is actually happening
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lentil.