Skip to content

Commit

Permalink
Split cwfs into other directories.
Browse files Browse the repository at this point in the history
Updated docs.
  • Loading branch information
jfcrenshaw committed Oct 10, 2023
1 parent f0beee1 commit a3d1e00
Show file tree
Hide file tree
Showing 53 changed files with 149 additions and 112 deletions.
52 changes: 40 additions & 12 deletions doc/developer-guide/developer-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,32 +54,54 @@ This module is a high-level module to use other modules.
* **ParamReader**: Parameter reader class to read the yaml configuration files used in the calculation.
* **DonutImageCheck**: Donut image check class to judge the donut image is effective or not.
* **DonutDetector**: Detect donuts directly from an out of focus image by convolution with a template image.
* **Image**: Image class to have the function to get the donut center.
* **Instrument**: Instrument class to have the instrument information used in the Algorithm class to solve the TIE.

.. _WEP_modules_wep_cwfs:
.. _WEP_modules_wep_centroid:

wep.cwfs
wep.centroid
-------------

This module calculates the wavefront error by solving the TIE.
.. uml:: ../uml/centroidClass.uml
:caption: Class diagram of wep.centroid

.. uml:: ../uml/cwfsClass.uml
:caption: Class diagram of wep.cwfs
This module finds the centroids of donuts.

* **Algorithm**: Algorithm class to solve the TIE to get the wavefront error.
* **CompensableImage**: Compensable image class to project the donut image from the image plane to the pupil plane.
* **Image**: Image class to have the function to get the donut center.
* **Instrument**: Instrument class to have the instrument information used in the Algorithm class to solve the TIE.
* **CentroidFindFactory**: Factory for creating the centroid find object to calculate the centroid of donut.
* **CentroidDefault**: Default centroid class.
* **CentroidRandomWalk**: CentroidDefault child class to get the centroid of donut by the random walk model.
* **CentroidOtsu**: CentroidDefault child class to get the centroid of donut by the Otsu's method.
* **CentroidOtsu**: CentroidDefault child class to get the centroid of donut by Otsu's method.
* **CentroidConvolveTemplate**: CentroidDefault child class to get the centroids of one or more donuts in an image by convolution with a template donut.
* **BaseCwfsTestCase**: Base class for CWFS tests.

.. _WEP_modules_wep_templates:

wep.templates
-------------

.. uml:: ../uml/templatesClass.uml
:caption: Class diagram of wep.templates

This module generates donut templates, which are used for centroiding with a template.

* **DonutTemplateFactory**: Factory for creating donut template objects used by CentroidConvolveTemplate.
* **DonutTemplateDefault**: Default donut template class.
* **DonutTemplateModel**: DonutTemplateDefault child class to make donut templates using an Instrument model.
* **DonutTemplatePhosim**: DonutTemplateDefault child class to make donut templates from templates created with Phosim. See :doc:`here <../user-guide/phosimDonutTemplates>` for more information on creating and using Phosim donut templates.

.. _WEP_modules_wep_estimation:

wep.estimation
-------------

.. uml:: ../uml/estimationClass.uml
:caption: Class diagram of wep.estimation

This module estimates the wavefront error.

* **Algorithm**: Algorithm class to solve the TIE to get the wavefront error.
* **CompensableImage**: Compensable image class to project the donut image from the image plane to the pupil plane.
* **BaseCwfsTestCase**: Base class for TIE tests.

.. _WEP_modules_wep_deblend:

wep.deblend
Expand Down Expand Up @@ -165,7 +187,13 @@ This section is autogenerated from docstrings.
.. automodapi:: lsst.ts.wep
:no-inheritance-diagram:

.. automodapi:: lsst.ts.wep.cwfs
.. automodapi:: lsst.ts.wep.centroid
:no-inheritance-diagram:

.. automodapi:: lsst.ts.wep.templates
:no-inheritance-diagram:

.. automodapi:: lsst.ts.wep.estimation
:no-inheritance-diagram:

.. automodapi:: lsst.ts.wep.deblend
Expand Down
9 changes: 9 additions & 0 deletions doc/uml/centroidClass.uml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@startuml
CentroidDefault <|-- CentroidRandomWalk
CentroidDefault <|-- CentroidOtsu
CentroidDefault <|-- CentroidConvolveTemplate
CentroidFindFactory ..> CentroidRandomWalk
CentroidFindFactory ..> CentroidOtsu
CentroidFindFactory ..> CentroidConvolveTemplate
CentroidConvolveTemplate *-- CentroidRandomWalk
@enduml
24 changes: 0 additions & 24 deletions doc/uml/cwfsClass.uml

This file was deleted.

6 changes: 6 additions & 0 deletions doc/uml/estimationClass.uml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@startuml
Algorithm *-- Instrument
Algorithm -- CompensableImage
BaseCwfsTestCase ..> CompensableImage
BaseCwfsTestCase ..> Algorithm
@enduml
6 changes: 6 additions & 0 deletions doc/uml/templatesClass.uml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@startuml
DonutTemplateDefault <|-- DonutTemplateModel
DonutTemplateDefault <|-- DonutTemplatePhosim
DonutTemplateFactory ..> DonutTemplateModel
DonutTemplateFactory ..> DonutTemplatePhosim
@enduml
3 changes: 3 additions & 0 deletions doc/uml/wepClass.uml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ class DonutImageCheck
class DonutDetector
class ParamReader
class WfEstimator
class Image
class Instrument
ParamReader <|-- Instrument
@enduml
8 changes: 8 additions & 0 deletions doc/versionHistory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
Version History
##################

.. _lsst.ts.wep-8.0.0:

-------------
8.0.0
-------------

* Split the ``cwfs`` modules into ``centroid``, ``templates``, and ``estimation``.

.. _lsst.ts.wep-7.0.0:

-------------
Expand Down
1 change: 1 addition & 0 deletions python/lsst/ts/wep/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# this will be a problem to import.
try:
from .donutDetector import DonutDetector
from .image import Image
from .paramReader import ParamReader
from .wfEstimator import WfEstimator
except ImportError:
Expand Down
5 changes: 5 additions & 0 deletions python/lsst/ts/wep/centroid/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from .centroidConvolveTemplate import *
from .centroidDefault import *
from .centroidFindFactory import *
from .centroidOtsu import *
from .centroidRandomWalk import *
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
from copy import copy

import numpy as np
from lsst.ts.wep.cwfs.centroidDefault import CentroidDefault
from lsst.ts.wep.cwfs.centroidRandomWalk import CentroidRandomWalk
from lsst.ts.wep.centroid.centroidDefault import CentroidDefault
from lsst.ts.wep.centroid.centroidRandomWalk import CentroidRandomWalk
from scipy.signal import correlate
from sklearn.cluster import DBSCAN, KMeans

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

__all__ = ["CentroidFindFactory"]

from lsst.ts.wep.cwfs.centroidConvolveTemplate import CentroidConvolveTemplate
from lsst.ts.wep.cwfs.centroidOtsu import CentroidOtsu
from lsst.ts.wep.cwfs.centroidRandomWalk import CentroidRandomWalk
from lsst.ts.wep.centroid.centroidConvolveTemplate import CentroidConvolveTemplate
from lsst.ts.wep.centroid.centroidOtsu import CentroidOtsu
from lsst.ts.wep.centroid.centroidRandomWalk import CentroidRandomWalk
from lsst.ts.wep.utils import CentroidFindType


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

__all__ = ["CentroidOtsu"]

from lsst.ts.wep.cwfs.centroidDefault import CentroidDefault
from lsst.ts.wep.centroid.centroidDefault import CentroidDefault
from skimage.filters import threshold_otsu


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
__all__ = ["CentroidRandomWalk"]

import numpy as np
from lsst.ts.wep.cwfs.centroidDefault import CentroidDefault
from lsst.ts.wep.centroid.centroidDefault import CentroidDefault


class CentroidRandomWalk(CentroidDefault):
Expand Down
15 changes: 0 additions & 15 deletions python/lsst/ts/wep/cwfs/__init__.py

This file was deleted.

2 changes: 1 addition & 1 deletion python/lsst/ts/wep/deblend/deblendAdapt.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
__all__ = ["DeblendAdapt"]

import numpy as np
from lsst.ts.wep.cwfs.centroidFindFactory import CentroidFindFactory
from lsst.ts.wep.centroid import CentroidFindFactory
from lsst.ts.wep.deblend.deblendDefault import DeblendDefault
from lsst.ts.wep.deblend.nelderMeadModify import nelderMeadModify
from lsst.ts.wep.utils import CentroidFindType
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ts/wep/deblend/deblendDefault.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
__all__ = ["DeblendDefault"]

import numpy as np
from lsst.ts.wep.cwfs.centroidFindFactory import CentroidFindFactory
from lsst.ts.wep.centroid import CentroidFindFactory
from lsst.ts.wep.utils import CentroidFindType


Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ts/wep/donutDetector.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import numpy as np
import pandas as pd
from lsst.ts.wep.cwfs.centroidFindFactory import CentroidFindFactory
from lsst.ts.wep.centroid import CentroidFindFactory
from lsst.ts.wep.deblend.deblendAdapt import DeblendAdapt
from lsst.ts.wep.utils import CentroidFindType
from scipy.spatial.distance import cdist
Expand Down
3 changes: 3 additions & 0 deletions python/lsst/ts/wep/estimation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .algorithm import *
from .baseCwfsTestCase import *
from .compensableImage import *
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

import galsim
import numpy as np
from lsst.ts.wep.cwfs.instrument import Instrument
from lsst.ts.wep.instrument import Instrument
from lsst.ts.wep.paramReader import ParamReader
from lsst.ts.wep.utils import (
DefocalType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
import os

import numpy as np
from lsst.ts.wep.cwfs.algorithm import Algorithm
from lsst.ts.wep.cwfs.compensableImage import CompensableImage
from lsst.ts.wep.cwfs.instrument import Instrument
from lsst.ts.wep.estimation.algorithm import Algorithm
from lsst.ts.wep.estimation.compensableImage import CompensableImage
from lsst.ts.wep.instrument import Instrument
from lsst.ts.wep.utils import DefocalType, getConfigDir


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

import numpy as np
from galsim.utilities import horner2d
from lsst.ts.wep.cwfs.image import Image
from lsst.ts.wep.image import Image
from lsst.ts.wep.paramReader import ParamReader
from lsst.ts.wep.utils import (
CentroidFindType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

import numpy as np
from astropy.io import fits
from lsst.ts.wep.cwfs.centroidFindFactory import CentroidFindFactory
from lsst.ts.wep.centroid import CentroidFindFactory
from lsst.ts.wep.utils import CentroidFindType


Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions python/lsst/ts/wep/task/cutOutDonutsBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
from lsst.daf.base import PropertyList
from lsst.fgcmcal.utilities import lookupStaticCalibrations
from lsst.pipe.base import connectionTypes
from lsst.ts.wep.cwfs.donutTemplateFactory import DonutTemplateFactory
from lsst.ts.wep.cwfs.instrument import Instrument
from lsst.ts.wep.instrument import Instrument
from lsst.ts.wep.task.donutStamp import DonutStamp
from lsst.ts.wep.task.donutStamps import DonutStamps
from lsst.ts.wep.templates import DonutTemplateFactory
from lsst.ts.wep.utils import (
DonutTemplateType,
createInstDictFromConfig,
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ts/wep/task/donutStamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import numpy as np
from lsst.afw.cameraGeom import FIELD_ANGLE, PIXELS
from lsst.meas.algorithms.stamps import AbstractStamp
from lsst.ts.wep.cwfs.compensableImage import CompensableImage
from lsst.ts.wep.estimation import CompensableImage
from lsst.ts.wep.utils import DefocalType, FilterType, getFilterTypeFromBandLabel


Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ts/wep/task/generateDonutDirectDetectTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
import numpy as np
import pandas as pd
from lsst.fgcmcal.utilities import lookupStaticCalibrations
from lsst.ts.wep.cwfs.donutTemplateFactory import DonutTemplateFactory
from lsst.ts.wep.task.donutQuickMeasurementTask import DonutQuickMeasurementTask
from lsst.ts.wep.task.donutSourceSelectorTask import DonutSourceSelectorTask
from lsst.ts.wep.templates import DonutTemplateFactory
from lsst.ts.wep.utils import (
DefocalType,
DonutTemplateType,
Expand Down
4 changes: 4 additions & 0 deletions python/lsst/ts/wep/templates/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .donutTemplateDefault import *
from .donutTemplateFactory import *
from .donutTemplateModel import *
from .donutTemplatePhosim import *
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

__all__ = ["DonutTemplateFactory"]

from lsst.ts.wep.cwfs.donutTemplateModel import DonutTemplateModel
from lsst.ts.wep.cwfs.donutTemplatePhosim import DonutTemplatePhosim
from lsst.ts.wep.templates.donutTemplateModel import DonutTemplateModel
from lsst.ts.wep.templates.donutTemplatePhosim import DonutTemplatePhosim
from lsst.ts.wep.utils import DonutTemplateType


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
import lsst.afw.cameraGeom as cameraGeom
import lsst.obs.lsst as obs_lsst
import numpy as np
from lsst.ts.wep.cwfs.compensableImage import CompensableImage
from lsst.ts.wep.cwfs.donutTemplateDefault import DonutTemplateDefault
from lsst.ts.wep.cwfs.instrument import Instrument
from lsst.ts.wep.estimation import CompensableImage
from lsst.ts.wep.instrument import Instrument
from lsst.ts.wep.templates.donutTemplateDefault import DonutTemplateDefault
from lsst.ts.wep.utils import CamType, FilterType, getConfigDir, readPhoSimSettingData


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import os

import numpy as np
from lsst.ts.wep.cwfs.donutTemplateDefault import DonutTemplateDefault
from lsst.ts.wep.templates.donutTemplateDefault import DonutTemplateDefault
from lsst.ts.wep.utils import DefocalType, getConfigDir


Expand Down
5 changes: 2 additions & 3 deletions python/lsst/ts/wep/wfEstimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@

__all__ = ["WfEstimator"]

from lsst.ts.wep.cwfs.algorithm import Algorithm
from lsst.ts.wep.cwfs.compensableImage import CompensableImage
from lsst.ts.wep.cwfs.instrument import Instrument
from lsst.ts.wep.estimation import Algorithm, CompensableImage
from lsst.ts.wep.instrument import Instrument
from lsst.ts.wep.utils import CamType, CentroidFindType, DefocalType, FilterType


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import unittest

import numpy as np
from lsst.ts.wep.cwfs.centroidConvolveTemplate import CentroidConvolveTemplate
from lsst.ts.wep.centroid import CentroidConvolveTemplate


class TestCentroidConvolveTemplate(unittest.TestCase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import unittest

import numpy as np
from lsst.ts.wep.cwfs.centroidDefault import CentroidDefault
from lsst.ts.wep.centroid import CentroidDefault
from scipy.ndimage import generate_binary_structure, iterate_structure


Expand Down
Loading

0 comments on commit a3d1e00

Please sign in to comment.