camsim 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. camsim/__init__.py +65 -0
  2. camsim/_version.py +7 -0
  3. camsim/camera/__init__.py +24 -0
  4. camsim/camera/camera.py +831 -0
  5. camsim/characterization/__init__.py +32 -0
  6. camsim/characterization/emva.py +1559 -0
  7. camsim/characterization/isp.py +1860 -0
  8. camsim/characterization/metrics.py +1514 -0
  9. camsim/characterization/report.py +1533 -0
  10. camsim/cli.py +850 -0
  11. camsim/config/__init__.py +1 -0
  12. camsim/config/io.py +249 -0
  13. camsim/config/presets/isp/default.json +70 -0
  14. camsim/config/presets/sensors/flagship_phone_50mp.json +103 -0
  15. camsim/config/schema.py +809 -0
  16. camsim/core/__init__.py +1 -0
  17. camsim/core/color.py +164 -0
  18. camsim/core/constants.py +41 -0
  19. camsim/core/frames.py +606 -0
  20. camsim/core/memory.py +190 -0
  21. camsim/core/spectral.py +385 -0
  22. camsim/core/units.py +84 -0
  23. camsim/data/__init__.py +67 -0
  24. camsim/data/spectra/cfa_rggb.csv +61 -0
  25. camsim/data/spectra/ir_cut.csv +56 -0
  26. camsim/data/spectra/qe_flagship.csv +57 -0
  27. camsim/io/__init__.py +34 -0
  28. camsim/io/images.py +424 -0
  29. camsim/io/raw.py +469 -0
  30. camsim/isp/__init__.py +16 -0
  31. camsim/isp/awb.py +563 -0
  32. camsim/isp/blc.py +194 -0
  33. camsim/isp/ccm.py +563 -0
  34. camsim/isp/colorspace.py +290 -0
  35. camsim/isp/demosaic.py +615 -0
  36. camsim/isp/denoise.py +640 -0
  37. camsim/isp/dpc.py +181 -0
  38. camsim/isp/lsc.py +339 -0
  39. camsim/isp/pipeline.py +615 -0
  40. camsim/isp/sharpen.py +184 -0
  41. camsim/isp/tone.py +437 -0
  42. camsim/metrics/__init__.py +82 -0
  43. camsim/metrics/acutance.py +187 -0
  44. camsim/metrics/chart.py +395 -0
  45. camsim/metrics/color.py +885 -0
  46. camsim/metrics/mtf.py +859 -0
  47. camsim/metrics/snr.py +617 -0
  48. camsim/metrics/summary.py +617 -0
  49. camsim/optics/__init__.py +1 -0
  50. camsim/optics/lens.py +140 -0
  51. camsim/optics/propagation.py +228 -0
  52. camsim/optics/psf.py +346 -0
  53. camsim/optics/vignetting.py +137 -0
  54. camsim/py.typed +0 -0
  55. camsim/scene/__init__.py +1 -0
  56. camsim/scene/charts.py +301 -0
  57. camsim/scene/glyphs.py +751 -0
  58. camsim/scene/illuminants.py +458 -0
  59. camsim/scene/spectral_data.py +416 -0
  60. camsim/scene/targets.py +899 -0
  61. camsim/sensor/__init__.py +50 -0
  62. camsim/sensor/adc.py +188 -0
  63. camsim/sensor/binning.py +252 -0
  64. camsim/sensor/cfa.py +622 -0
  65. camsim/sensor/defects.py +363 -0
  66. camsim/sensor/gain.py +221 -0
  67. camsim/sensor/noise.py +488 -0
  68. camsim/sensor/sensor.py +1204 -0
  69. camsim/tasks/__init__.py +1 -0
  70. camsim/viz/__init__.py +83 -0
  71. camsim/viz/metrics.py +452 -0
  72. camsim/viz/pipeline.py +493 -0
  73. camsim/viz/sensor.py +537 -0
  74. camsim/viz/spectra.py +737 -0
  75. camsim/viz/style.py +116 -0
  76. camsim-0.1.0.dist-info/METADATA +412 -0
  77. camsim-0.1.0.dist-info/RECORD +81 -0
  78. camsim-0.1.0.dist-info/WHEEL +4 -0
  79. camsim-0.1.0.dist-info/entry_points.txt +2 -0
  80. camsim-0.1.0.dist-info/licenses/LICENSE +202 -0
  81. camsim-0.1.0.dist-info/licenses/NOTICE +22 -0
camsim/__init__.py ADDED
@@ -0,0 +1,65 @@
1
+ """camsim: deterministic camera sensor and ISP simulation with IQ metrics.
2
+
3
+ The public namespace is deliberately lazy (PEP 562). Importing ``camsim`` loads
4
+ only version metadata; public types are resolved on first attribute access.
5
+ This keeps ``import camsim.metrics`` free of the sensor, ISP, scene, and optics
6
+ packages, which the metrics harness is required not to depend on.
7
+
8
+ Later phases register public names in ``_LAZY_EXPORTS`` as
9
+ ``name -> (module path, attribute name)`` pairs.
10
+ """
11
+
12
+ from __future__ import annotations
13
+
14
+ from importlib import import_module
15
+ from typing import TYPE_CHECKING, Any, Final
16
+
17
+ from ._version import __version__
18
+
19
+ if TYPE_CHECKING:
20
+ # Static analysers and the documentation builder cannot execute the lazy
21
+ # ``__getattr__`` below, so mirror the public map with type-checking-only
22
+ # aliases. This block is never imported at runtime and therefore adds no
23
+ # cost to ``import camsim``.
24
+ from camsim.camera.camera import Camera as Camera
25
+ from camsim.config.schema import LensConfig as LensConfig
26
+ from camsim.core.spectral import SpectralIrradiance as SpectralIrradiance
27
+ from camsim.core.spectral import WavelengthGrid as WavelengthGrid
28
+ from camsim.isp.pipeline import ISP as ISP
29
+ from camsim.sensor import Sensor as Sensor
30
+
31
+ __all__: Final[list[str]] = [
32
+ "ISP",
33
+ "Camera",
34
+ "LensConfig",
35
+ "Sensor",
36
+ "SpectralIrradiance",
37
+ "WavelengthGrid",
38
+ "__version__",
39
+ ]
40
+
41
+ # Public name -> (module path, attribute name). Populated as public types land.
42
+ _LAZY_EXPORTS: Final[dict[str, tuple[str, str]]] = {
43
+ "Camera": ("camsim.camera.camera", "Camera"),
44
+ "ISP": ("camsim.isp.pipeline", "ISP"),
45
+ "LensConfig": ("camsim.config.schema", "LensConfig"),
46
+ "Sensor": ("camsim.sensor", "Sensor"),
47
+ "SpectralIrradiance": ("camsim.core.spectral", "SpectralIrradiance"),
48
+ "WavelengthGrid": ("camsim.core.spectral", "WavelengthGrid"),
49
+ }
50
+
51
+
52
+ def __getattr__(name: str) -> Any:
53
+ """Resolve a lazily exported public name on first access."""
54
+ try:
55
+ module_path, attribute = _LAZY_EXPORTS[name]
56
+ except KeyError:
57
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}") from None
58
+ value = getattr(import_module(module_path), attribute)
59
+ globals()[name] = value
60
+ return value
61
+
62
+
63
+ def __dir__() -> list[str]:
64
+ """Include lazily exported names in ``dir(camsim)`` and tab completion."""
65
+ return sorted(set(globals()) | set(__all__) | set(_LAZY_EXPORTS))
camsim/_version.py ADDED
@@ -0,0 +1,7 @@
1
+ """Single source of truth for the package version.
2
+
3
+ ``pyproject.toml`` reads this file through hatchling, so installed distribution
4
+ metadata and ``camsim.__version__`` cannot drift apart.
5
+ """
6
+
7
+ __version__ = "0.1.0"
@@ -0,0 +1,24 @@
1
+ """Camera orchestration and the opt-in auto-exposure policy.
2
+
3
+ :class:`~camsim.camera.camera.Camera` binds a lens, a sensor, and an ISP into
4
+ one object that can turn a rendered scene into a display image. The default
5
+ capture is the fixed-exposure baseline from the sensor preset; auto-exposure is
6
+ an explicit request that probes the real sensor, meters the black-corrected
7
+ signal with a centre-weighted statistic, and reports every decision.
8
+
9
+ The package re-exports the three public value types:
10
+
11
+ * :class:`Camera` — capture and auto-exposure entry points.
12
+ * :class:`ExposureSettings` — a fixed exposure, analog gain, and readout mode.
13
+ * :class:`ExposureResult` — the measured settings and evidence from one
14
+ auto-exposure run.
15
+
16
+ Importing the package loads the camera module, which in turn imports the
17
+ sensor, ISP, and scene layers; ``import camsim`` itself remains lazy.
18
+ """
19
+
20
+ from __future__ import annotations
21
+
22
+ from camsim.camera.camera import Camera, ExposureResult, ExposureSettings
23
+
24
+ __all__ = ["Camera", "ExposureResult", "ExposureSettings"]