Skip to content

Commit

Permalink
Fixed donutDetector test.
Browse files Browse the repository at this point in the history
  • Loading branch information
jfcrenshaw committed Dec 14, 2023
1 parent 013884a commit 54817be
Showing 1 changed file with 9 additions and 20 deletions.
29 changes: 9 additions & 20 deletions tests/test_donutDetector.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@

import numpy as np
import pandas as pd
from lsst.obs.lsst import LsstCam
from lsst.ts.wep.donutDetector import DonutDetector
from lsst.ts.wep.templates import DonutTemplateFactory
from lsst.ts.wep.utils import DefocalType, DonutTemplateType
from lsst.ts.wep.utils import createTemplateForDetector


class TestDonutDetector(unittest.TestCase):
Expand All @@ -34,24 +34,13 @@ class TestDonutDetector(unittest.TestCase):
def setUp(self):
self.donutDetector = DonutDetector()

def _makeData(self, imgSize, templateSize, donutSep):
templateMaker = DonutTemplateFactory.createDonutTemplate(
DonutTemplateType.Model
)

# Set inst information
instParams = {
"obscuration": 0.61,
"focalLength": 10.312,
"apertureDiameter": 8.36,
"offset": 1.0,
"pixelSize": 10.0e-6,
}
def _makeData(self, imgSize, donutSep):
# Create the template
camera = LsstCam().getCamera()
detector = camera.get("R22_S11")
template = createTemplateForDetector(detector, "extra")

template = templateMaker.makeTemplate(
"R22_S11", DefocalType.Extra, templateSize, instParams=instParams
)
templateHalfWidth = int(templateSize / 2)
templateHalfWidth = int(len(template) / 2)

blendedImg = np.zeros((imgSize, imgSize))
center = int(imgSize / 2)
Expand Down Expand Up @@ -105,7 +94,7 @@ def testIdentifyBlendedDonuts(self):
)

def testDetectDonuts(self):
template, testImg = self._makeData(480, 160, 60)
template, testImg = self._makeData(480, 60)
donutDf = self.donutDetector.detectDonuts(testImg, template, 126)

self.assertCountEqual(
Expand Down

0 comments on commit 54817be

Please sign in to comment.