Skip to content

Commit

Permalink
Organized util functions in utils directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
jfcrenshaw committed Oct 10, 2023
1 parent 2834894 commit 7ed5b50
Show file tree
Hide file tree
Showing 75 changed files with 1,381 additions and 1,184 deletions.
20 changes: 17 additions & 3 deletions doc/developer-guide/developer-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ This module is a high-level module to use other modules.
:caption: Class diagram of wep

* **WfEstimator**: Calculate the wavefront error in annular Zernike polynomials up to 22 terms based on the defocal donut images.
* **Utility**: Utility functions used in WEP.
* **PlotUtil**: Plot utility functions used in WEP.
* **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.
Expand All @@ -71,7 +69,6 @@ This module calculates the wavefront error by solving the TIE.
* **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.
* **Tool**: Annular Zernike polynomials related functions.
* **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.
Expand Down Expand Up @@ -144,6 +141,20 @@ This module has the tasks to run WEP as a pipeline with Gen 3 LSST DM middleware
* **GenerateDonutFromRefitWcsTaskConfig**: Configuration setup for GenerateDonutFromRefitWcsTask.
* **GenerateDonutCatalogUtils**: Common utility functions for the GenerateDonutCatalog...Tasks.

.. _WEP_modules_wep_utils:

wep.utils
-------------

This module contains utility functions that are used elsewhere in WEP.

* **enumUtils**: Enum definitions and related functions.
* **ioUtils**: Functions for reading and writing files.
* **taskUtils**: Functions for running command line tasks from a python script.
* **zernikeUtils**: Functions for evaluating and fitting Zernike polynomials.
* **plotUtils**: Functions for plotting results.
* **miscUtils**: Miscellaneous utility functions.

.. _WEP_API:

Python API reference
Expand All @@ -163,6 +174,9 @@ This section is autogenerated from docstrings.
.. automodapi:: lsst.ts.wep.task
:no-inheritance-diagram:

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

.. _WEP_contributing:

Contributing
Expand Down
9 changes: 9 additions & 0 deletions doc/versionHistory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
##################
Version History
##################

.. _lsst.ts.wep-7.0.0:

-------------
7.0.0
-------------

* Organize all utility functions inside the ``utils`` module.

.. _lsst.ts.wep-6.4.12:

-------------
Expand Down
1 change: 0 additions & 1 deletion python/lsst/ts/wep/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
from .utility import *

# This class needs the scons to build the cython code. In the Jenkins test,
# this will be a problem to import.
Expand Down
1 change: 0 additions & 1 deletion python/lsst/ts/wep/cwfs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@
from .donutTemplatePhosim import *
from .image import *
from .instrument import *
from .tool import *
8 changes: 4 additions & 4 deletions python/lsst/ts/wep/cwfs/algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
import galsim
import numpy as np
from lsst.ts.wep.cwfs.instrument import Instrument
from lsst.ts.wep.cwfs.tool import (
from lsst.ts.wep.paramReader import ParamReader
from lsst.ts.wep.utils import (
DefocalType,
ZernikeAnnularEval,
ZernikeMaskedFit,
extractArray,
padArray,
plotZernike,
)
from lsst.ts.wep.paramReader import ParamReader
from lsst.ts.wep.plotUtil import plotZernike
from lsst.ts.wep.utility import DefocalType
from scipy.ndimage import (
binary_dilation,
binary_erosion,
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ts/wep/cwfs/baseCwfsTestCase.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
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.utility import DefocalType, getConfigDir
from lsst.ts.wep.utils import DefocalType, getConfigDir


class BaseCwfsTestCase(object):
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ts/wep/cwfs/centroidFindFactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
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.utility import CentroidFindType
from lsst.ts.wep.utils import CentroidFindType


class CentroidFindFactory(object):
Expand Down
9 changes: 6 additions & 3 deletions python/lsst/ts/wep/cwfs/compensableImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,17 @@
import numpy as np
from galsim.utilities import horner2d
from lsst.ts.wep.cwfs.image import Image
from lsst.ts.wep.cwfs.tool import (
from lsst.ts.wep.paramReader import ParamReader
from lsst.ts.wep.utils import (
CentroidFindType,
DefocalType,
FilterType,
ZernikeAnnularGrad,
ZernikeAnnularJacobian,
extractArray,
padArray,
rotMatrix,
)
from lsst.ts.wep.paramReader import ParamReader
from lsst.ts.wep.utility import CentroidFindType, DefocalType, FilterType, rotMatrix
from scipy.interpolate import RectBivariateSpline
from scipy.ndimage import (
binary_dilation,
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ts/wep/cwfs/donutTemplateFactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

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


class DonutTemplateFactory(object):
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ts/wep/cwfs/donutTemplateModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
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.utility import CamType, FilterType, getConfigDir, readPhoSimSettingData
from lsst.ts.wep.utils import CamType, FilterType, getConfigDir, readPhoSimSettingData


class DonutTemplateModel(DonutTemplateDefault):
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ts/wep/cwfs/donutTemplatePhosim.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

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


class DonutTemplatePhosim(DonutTemplateDefault):
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ts/wep/cwfs/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import numpy as np
from astropy.io import fits
from lsst.ts.wep.cwfs.centroidFindFactory import CentroidFindFactory
from lsst.ts.wep.utility import CentroidFindType
from lsst.ts.wep.utils import CentroidFindType


class Image(object):
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ts/wep/cwfs/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import numpy as np
from lsst.ts.wep.paramReader import ParamReader
from lsst.ts.wep.utility import CamType, getCamNameFromCamType, getConfigDir
from lsst.ts.wep.utils import CamType, getCamNameFromCamType, getConfigDir


class Instrument(object):
Expand Down
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 @@ -25,7 +25,7 @@
from lsst.ts.wep.cwfs.centroidFindFactory import CentroidFindFactory
from lsst.ts.wep.deblend.deblendDefault import DeblendDefault
from lsst.ts.wep.deblend.nelderMeadModify import nelderMeadModify
from lsst.ts.wep.utility import CentroidFindType
from lsst.ts.wep.utils import CentroidFindType
from scipy.ndimage import (
binary_closing,
binary_erosion,
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 @@ -23,7 +23,7 @@

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


class DeblendDefault(object):
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ts/wep/deblend/deblendDonutFactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
__all__ = ["DeblendDonutFactory"]

from lsst.ts.wep.deblend.deblendAdapt import DeblendAdapt
from lsst.ts.wep.utility import DeblendDonutType
from lsst.ts.wep.utils import DeblendDonutType


class DeblendDonutFactory(object):
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 @@ -27,7 +27,7 @@
import pandas as pd
from lsst.ts.wep.cwfs.centroidFindFactory import CentroidFindFactory
from lsst.ts.wep.deblend.deblendAdapt import DeblendAdapt
from lsst.ts.wep.utility import CentroidFindType
from lsst.ts.wep.utils import CentroidFindType
from scipy.spatial.distance import cdist


Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ts/wep/task/calcZernikesTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from lsst.pipe.base import connectionTypes
from lsst.ts.wep.task.combineZernikesSigmaClipTask import CombineZernikesSigmaClipTask
from lsst.ts.wep.task.donutStamps import DonutStamps
from lsst.ts.wep.utility import (
from lsst.ts.wep.utils import (
DefocalType,
createInstDictFromConfig,
getCamTypeFromButlerName,
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ts/wep/task/cutOutDonutsBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from lsst.ts.wep.cwfs.instrument import Instrument
from lsst.ts.wep.task.donutStamp import DonutStamp
from lsst.ts.wep.task.donutStamps import DonutStamps
from lsst.ts.wep.utility import (
from lsst.ts.wep.utils import (
DonutTemplateType,
createInstDictFromConfig,
getCamTypeFromButlerName,
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ts/wep/task/cutOutDonutsCwfsTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
CutOutDonutsBaseTaskConnections,
)
from lsst.ts.wep.task.donutStamps import DonutStamps
from lsst.ts.wep.utility import DefocalType
from lsst.ts.wep.utils import DefocalType
from lsst.utils.timer import timeMethod


Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ts/wep/task/cutOutDonutsScienceSensorTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
CutOutDonutsBaseTaskConnections,
)
from lsst.ts.wep.task.donutStamps import DonutStamps
from lsst.ts.wep.utility import DefocalType
from lsst.ts.wep.utils import DefocalType
from lsst.utils.timer import timeMethod


Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ts/wep/task/donutSourceSelectorTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from lsst.afw.cameraGeom import FIELD_ANGLE, PIXELS
from lsst.meas.algorithms.sourceSelector import _getFieldFromCatalog
from lsst.ts.wep.paramReader import ParamReader
from lsst.ts.wep.utility import getConfigDir
from lsst.ts.wep.utils import getConfigDir
from lsst.utils.timer import timeMethod
from sklearn.neighbors import NearestNeighbors

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 @@ -32,7 +32,7 @@
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.utility import DefocalType, FilterType, getFilterTypeFromBandLabel
from lsst.ts.wep.utils import DefocalType, FilterType, getFilterTypeFromBandLabel


@dataclass
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 @@ -34,7 +34,7 @@
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.utility import (
from lsst.ts.wep.utils import (
DefocalType,
DonutTemplateType,
createInstDictFromConfig,
Expand Down
Loading

0 comments on commit 7ed5b50

Please sign in to comment.