Skip to content

Commit

Permalink
Merge pull request #57 from lsst-ts/tickets/DM-28164
Browse files Browse the repository at this point in the history
Tickets/dm 28164
  • Loading branch information
teweitsai authored Dec 30, 2020
2 parents 80fe91a + 5ab618b commit 2f7835d
Show file tree
Hide file tree
Showing 92 changed files with 12,898 additions and 12,890 deletions.
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-1.4.9:

-------------
1.4.9
-------------

* Unify the line ending to LF.

.. _lsst.ts.wep-1.4.8:

-------------
Expand Down
100 changes: 50 additions & 50 deletions examples/mapSensorAndFieldIdx.py
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
# This file is part of ts_wep.
#
# Developed for the LSST Telescope and Site Systems.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
# for details of code ownership.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

import numpy as np

from lsst.ts.wep.SourceProcessor import SourceProcessor


if __name__ == "__main__":

# Set the 35 field points
nArm = 6
armLen = [0.379, 0.841, 1.237, 1.535, 1.708]
fieldWFSx = [1.176, -1.176, -1.176, 1.176]
fieldWFSy = [1.176, 1.176, -1.176, -1.176]
pointAngle = np.arange(nArm) * (2 * np.pi) / nArm
fieldX = np.concatenate(
[np.zeros(1), np.kron(armLen, np.cos(pointAngle)), fieldWFSx]
)
fieldY = np.concatenate(
[np.zeros(1), np.kron(armLen, np.sin(pointAngle)), fieldWFSy]
)

fieldXY = np.array([fieldX, fieldY]).T

# Do the mapping
sourPro = SourceProcessor()
mapping = sourPro.mapSensorAndFieldIdx(fieldXY)

# Print the mapping
for sensorName, idxField in mapping.items():
print(sensorName, idxField)
# This file is part of ts_wep.
#
# Developed for the LSST Telescope and Site Systems.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
# for details of code ownership.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

import numpy as np

from lsst.ts.wep.SourceProcessor import SourceProcessor


if __name__ == "__main__":

# Set the 35 field points
nArm = 6
armLen = [0.379, 0.841, 1.237, 1.535, 1.708]
fieldWFSx = [1.176, -1.176, -1.176, 1.176]
fieldWFSy = [1.176, 1.176, -1.176, -1.176]
pointAngle = np.arange(nArm) * (2 * np.pi) / nArm
fieldX = np.concatenate(
[np.zeros(1), np.kron(armLen, np.cos(pointAngle)), fieldWFSx]
)
fieldY = np.concatenate(
[np.zeros(1), np.kron(armLen, np.sin(pointAngle)), fieldWFSy]
)

fieldXY = np.array([fieldX, fieldY]).T

# Do the mapping
sourPro = SourceProcessor()
mapping = sourPro.mapSensorAndFieldIdx(fieldXY)

# Print the mapping
for sensorName, idxField in mapping.items():
print(sensorName, idxField)
82 changes: 41 additions & 41 deletions examples/mapSensorAndFieldIdxLsstFam.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
# This file is part of ts_wep.
#
# Developed for the LSST Telescope and Site Systems.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
# for details of code ownership.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

import os
import numpy as np

from lsst.ts.wep.Utility import getModulePath
from lsst.ts.wep.SourceProcessor import SourceProcessor


if __name__ == "__main__":

# Set the 189 field points
fieldPosFilePath = os.path.join(getModulePath(), "examples", "fieldPosLsst.txt")
fieldXY = np.loadtxt(fieldPosFilePath)

# Do the mapping
sourPro = SourceProcessor()
mapping = sourPro.mapSensorAndFieldIdx(fieldXY)

# Print the mapping
for sensorName, idxField in mapping.items():
print(sensorName, idxField)
# This file is part of ts_wep.
#
# Developed for the LSST Telescope and Site Systems.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
# for details of code ownership.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

import os
import numpy as np

from lsst.ts.wep.Utility import getModulePath
from lsst.ts.wep.SourceProcessor import SourceProcessor


if __name__ == "__main__":

# Set the 189 field points
fieldPosFilePath = os.path.join(getModulePath(), "examples", "fieldPosLsst.txt")
fieldXY = np.loadtxt(fieldPosFilePath)

# Do the mapping
sourPro = SourceProcessor()
mapping = sourPro.mapSensorAndFieldIdx(fieldXY)

# Print the mapping
for sensorName, idxField in mapping.items():
print(sensorName, idxField)
184 changes: 92 additions & 92 deletions python/lsst/ts/wep/DefocalImage.py
Original file line number Diff line number Diff line change
@@ -1,92 +1,92 @@
# This file is part of ts_wep.
#
# Developed for the LSST Telescope and Site Systems.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
# for details of code ownership.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.


class DefocalImage(object):
def __init__(self, intraImg=None, extraImg=None):
"""Initialize the DefocalImage class.
Parameters
----------
intraImg : numpy.ndarray, optional
Intra-defocal image. (the default is None.)
extraImg : numpy.ndarray, optional
Extra-defocal image. (the default is None.)
"""

# Defocal images
self.intraImg = intraImg
self.extraImg = extraImg

def setImg(self, intraImg=None, extraImg=None):
"""Set the image.
Parameters
----------
intraImg : numpy.ndarray, optional
Intra-defocal image. (the default is None.)
extraImg : numpy.ndarray, optional
Extra-defocal image. (the default is None.)
"""

self._setValIfNotNone("intraImg", intraImg)
self._setValIfNotNone("extraImg", extraImg)

def _setValIfNotNone(self, attrName, val):
"""Set the value to the related class attribute if the value is not
none.
Parameters
----------
attrName : str
Attribute name.
val : numpy.ndarray
Assigned value.
"""

if val is not None:
setattr(self, attrName, val)

def getIntraImg(self):
"""Get the intra-defocal image.
Returns
-------
numpy.ndarray
Intra-defocal image.
"""

return self.intraImg

def getExtraImg(self):
"""Get the extra-defocal image.
Returns
-------
numpy.ndarray
Extra-defocal image.
"""

return self.extraImg


if __name__ == "__main__":
pass
# This file is part of ts_wep.
#
# Developed for the LSST Telescope and Site Systems.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
# for details of code ownership.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.


class DefocalImage(object):
def __init__(self, intraImg=None, extraImg=None):
"""Initialize the DefocalImage class.
Parameters
----------
intraImg : numpy.ndarray, optional
Intra-defocal image. (the default is None.)
extraImg : numpy.ndarray, optional
Extra-defocal image. (the default is None.)
"""

# Defocal images
self.intraImg = intraImg
self.extraImg = extraImg

def setImg(self, intraImg=None, extraImg=None):
"""Set the image.
Parameters
----------
intraImg : numpy.ndarray, optional
Intra-defocal image. (the default is None.)
extraImg : numpy.ndarray, optional
Extra-defocal image. (the default is None.)
"""

self._setValIfNotNone("intraImg", intraImg)
self._setValIfNotNone("extraImg", extraImg)

def _setValIfNotNone(self, attrName, val):
"""Set the value to the related class attribute if the value is not
none.
Parameters
----------
attrName : str
Attribute name.
val : numpy.ndarray
Assigned value.
"""

if val is not None:
setattr(self, attrName, val)

def getIntraImg(self):
"""Get the intra-defocal image.
Returns
-------
numpy.ndarray
Intra-defocal image.
"""

return self.intraImg

def getExtraImg(self):
"""Get the extra-defocal image.
Returns
-------
numpy.ndarray
Extra-defocal image.
"""

return self.extraImg


if __name__ == "__main__":
pass
Loading

0 comments on commit 2f7835d

Please sign in to comment.