Skip to content

Commit

Permalink
fix(transforms): parametrize pybsm darkCurrentFromDensity call
Browse files Browse the repository at this point in the history
  • Loading branch information
vicentebolea committed Aug 26, 2024
1 parent c999dfd commit 529df10
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ dependencies = [
"nrtk>=0.4.2",
"numpy",
"Pillow",
"pybsm<=0.5",
"packaging",
"pybsm",
"scikit-learn==1.5.1",
"smqtk_image_io",
"tabulate",
Expand Down
11 changes: 9 additions & 2 deletions src/nrtk_explorer/library/nrtk_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import numpy as np
import logging
from packaging.version import Version
from PIL import Image as ImageModule
from PIL.Image import Image
from nrtk_explorer.library.transforms import ImageTransform, ParameterDescription
Expand All @@ -12,7 +13,13 @@
logger.setLevel(logging.INFO)

try:
from pybsm.otf import darkCurrentFromDensity
import pybsm

if Version(pybsm.__version__) < Version("0.5"):
import pybsm.otf.darkCurrentFromDensity as dark_current_from_density
else:
import pybsm.otf.dark_current_from_density as dark_current_from_density

from nrtk.impls.perturb_image.generic.cv2.blur import GaussianBlurPerturber
from nrtk.impls.perturb_image.pybsm.perturber import PybsmPerturber, PybsmSensor, PybsmScenario
except ImportError:
Expand Down Expand Up @@ -99,7 +106,7 @@ def createSampleSensorAndScenario():
intTime = 30.0e-3

# dark current density of 1 nA/cm2 guess, guess mid range for a silicon camera
darkCurrent = darkCurrentFromDensity(1e-5, wx, wy)
darkCurrent = dark_current_from_density(1e-5, wx, wy)

# rms read noise (rms electrons)
readNoise = 25.0
Expand Down

0 comments on commit 529df10

Please sign in to comment.