Skip to content

Commit

Permalink
small api change to be consistent with topic guide
Browse files Browse the repository at this point in the history
  • Loading branch information
wtbarnes committed Sep 17, 2024
1 parent 08dd45e commit 556d217
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 38 deletions.
74 changes: 37 additions & 37 deletions sunkit_instruments/abstractions/channels.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module defines abstractions related to instrument channels."""

import abc

import astropy.units as u
Expand All @@ -21,13 +22,13 @@ class SourceSpectra:
Parameters
----------
temperature: u.Quantity
temperature: `~astropy.units.Quantity`
1D array describing the variation along the temperature axis
wavelength: u.Quantity
wavelength: `~astropy.units.Quantity`
1D array describing the variation along the wavelength axis
spectra: u.Quantity
spectra: `~astropy.units.Quantity`
Source spectra as a 2D array. The first axis should correspond to temperature and the second axis should correspond to wavelength.
density: u.Quantity, optional
density: `~astropy.units.Quantity`, optional
1D array describing the variation in density along the temperature axis. It is assumed
that temperature and density are dependent.
"""
Expand Down Expand Up @@ -86,6 +87,9 @@ def data(self) -> u.photon * u.cm**3 / (u.s * u.AA * u.sr):
class AbstractChannel(abc.ABC):
"""
An abstract base class for defining instrument channels.
For all methods and properties defined here, see the
`topic guide on instrument response <>`_ for more information.
"""

@u.quantity_input
Expand All @@ -98,8 +102,7 @@ def temperature_response(
The temperature response function describes the sensitivity of an imaging
instrument as a function of temperature. The temperature response is
calculated by integrating the source spectra over the wavelength dimension,
weighted by the wavelength response of the instrument. For more information,
see the `topic guide on instrument response <>`_.
weighted by the wavelength response of the instrument.
Parameters
----------
Expand Down Expand Up @@ -135,8 +138,7 @@ def wavelength_response(
The wavelength response is the effective area with
the conversion factors from photons to DN and steradians
to pixels. For more information, see the `topic guide on
instrument response <>`_.
to pixels.
Parameters
----------
Expand All @@ -160,8 +162,7 @@ def effective_area(self, obstime=None) -> u.cm**2:
The effective area is the geometrical collecting area
weighted by the mirror reflectance, filter transmittance,
quantum efficiency, and instrument degradation. For more
information, see the `topic guide on instrument response <>`_.
quantum efficiency, and instrument degradation.
Parameters
----------
Expand All @@ -173,7 +174,7 @@ def effective_area(self, obstime=None) -> u.cm**2:
self.geometrical_area
* self.mirror_reflectance
* self.filter_transmittance
* self.quantum_efficiency
* self.effective_quantum_efficiency
* self.degradation(obstime=obstime)
)

Expand All @@ -184,45 +185,44 @@ def energy_per_photon(self) -> u.eV / u.photon:

@abc.abstractmethod
@u.quantity_input
def degradation(self, obstime=None):
...
def degradation(self, obstime=None): ...

@abc.abstractproperty
@property
@abc.abstractmethod
@u.quantity_input
def geometrical_area(self) -> u.cm**2:
...
def geometrical_area(self) -> u.cm**2: ...

@abc.abstractproperty
@property
@abc.abstractmethod
@u.quantity_input
def mirror_reflectance(self) -> u.dimensionless_unscaled:
...
def mirror_reflectance(self) -> u.dimensionless_unscaled: ...

@abc.abstractproperty
@property
@abc.abstractmethod
@u.quantity_input
def filter_transmittance(self) -> u.dimensionless_unscaled:
...
def filter_transmittance(self) -> u.dimensionless_unscaled: ...

@abc.abstractproperty
@property
@abc.abstractmethod
@u.quantity_input
def quantum_efficiency(self) -> u.dimensionless_unscaled:
...
def effective_quantum_efficiency(self) -> u.dimensionless_unscaled: ...

@abc.abstractproperty
@property
@abc.abstractmethod
@u.quantity_input
def camera_gain(self) -> u.DN / u.electron:
...
def camera_gain(self) -> u.DN / u.electron: ...

@abc.abstractproperty
@property
@abc.abstractmethod
@u.quantity_input
def energy_per_electron(self) -> u.eV / u.electron:
...
def energy_per_electron(self) -> u.eV / u.electron: ...

@abc.abstractproperty
@property
@abc.abstractmethod
@u.quantity_input
def pixel_solid_angle(self) -> u.steradian / u.pixel:
...
def pixel_solid_angle(self) -> u.steradian / u.pixel: ...

@abc.abstractproperty
@property
@abc.abstractmethod
@u.quantity_input
def wavelength(self) -> u.Angstrom:
...
def wavelength(self) -> u.Angstrom: ...
2 changes: 1 addition & 1 deletion sunkit_instruments/abstractions/tests/test_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def filter_transmittance(self) -> u.dimensionless_unscaled:

@property
@u.quantity_input
def quantum_efficiency(self) -> u.dimensionless_unscaled:
def effective_quantum_efficiency(self) -> u.dimensionless_unscaled:
return np.ones(self.wavelength.shape)

@property
Expand Down

0 comments on commit 556d217

Please sign in to comment.