Coder Social home page Coder Social logo

Comments (2)

andykee avatar andykee commented on July 17, 2024

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.

andykee avatar andykee commented on July 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.