Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ctis.inverters.NeuralNetworkInverter class, which trains a CNN to solve the inversion problem. #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ctis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
A package for inverting imagery captured by a computed tomography imaging
spectrograph.
"""
from . import inverters

__all__ = [
"inverters",
]
10 changes: 10 additions & 0 deletions ctis/inverters/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""
A collection of the different inversion algorithms defined in this package.
"""
from ._abc import AbstractInverter
from ._cnn import NeuralNetworkInverter

__all__ = [
"AbstractInverter",
"NeuralNetworkInverter",
]
42 changes: 42 additions & 0 deletions ctis/inverters/_abc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import abc
import dataclasses
import named_arrays as na

__all__ = [
"AbstractInverter",
]


@dataclasses.dataclass
class AbstractInverter(
abc.ABC,
):
"""
An interface describing an algorithm which can invert CTIS observations
to yield a reconstruction of the observed scene.
"""

def __call__(
self,
observation: na.FunctionArray[
na.SpectralPositionalVectorArray,
na.AbstractScalarArray,
],
**kwargs,
):
"""
Invert the given image deprojections to reconstruct the original scene.

Parameters
----------
observation
Observed images which have been projected backwards through the scene.
This defines the field of view and wavelength range of the
reconstructed scene.
We choose the deprojections instead of the images here since the
former defines the extent of the reconstructed scene without the
need for additional arguments.
kwargs
Additional keyword arguments which can be used by subclass
implementations.
"""
9 changes: 9 additions & 0 deletions ctis/inverters/_cnn/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""
An inversion algorithm based on training a convolutional neural network.
"""

from ._cnn import NeuralNetworkInverter

__all__ = [
"NeuralNetworkInverter",
]
Loading
Loading