Skip to content
This repository was archived by the owner on May 11, 2026. It is now read-only.
Merged
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
10 changes: 4 additions & 6 deletions tests/test.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import unittest
import numpy as np
from photutils.segmentation import SourceCatalog
import os
import tempfile
from astropy.io import fits

from opticam.background.global_background import DefaultBackground
from opticam.background.local_background import DefaultLocalBackground
from opticam.finders import DefaultFinder
from opticam.utils.generate import generate_flats, generate_gappy_observations, generate_observations
from opticam.utils.generate import generate_observations


class TestBackground(unittest.TestCase):
Expand Down Expand Up @@ -63,9 +62,9 @@ def test_finder(self):
image = np.array(hdul[0].data)

bkg = bkg_estimator(image)
segment_map = finder(image - bkg.background, 5 * bkg.background_rms)
tbl = finder(image - bkg.background, 5 * bkg.background_rms)

self.assertTrue(segment_map.nlabels == 6)
self.assertTrue(len(tbl) == 6)


class TestLocalBackground(unittest.TestCase):
Expand All @@ -92,8 +91,7 @@ def test_elliptical_local_background(self):
image = np.array(hdul[0].data)

bkg = bkg_estimator(image)
segment_map = finder(image - bkg.background, 5 * bkg.background_rms)
tbl = SourceCatalog(image - bkg.background, segment_map, background=bkg.background).to_table()
tbl = finder(image - bkg.background, 5 * bkg.background_rms)
coords = np.array([tbl["xcentroid"], tbl["ycentroid"]]).T
local_bkg_estimator = DefaultLocalBackground()

Expand Down