Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sensors.py: new function for datacube size (in bit) #130

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
repos:
- repo: https://github.com/pycqa/isort
rev: 5.10.1
rev: 5.13.2
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 22.3.0
rev: 24.3.0
hooks:
- id: black

- repo: https://github.com/PyCQA/autoflake
rev: v1.7.7
rev: v2.3.1
hooks:
- id: autoflake

- repo: https://github.com/asottile/pyupgrade
rev: v2.32.0
rev: v3.15.1
hooks:
- id: pyupgrade

- repo: https://github.com/myint/docformatter
rev: v1.5.0
rev: v1.7.5
hooks:
- id: docformatter
args: [--blank, --in-place, --recursive, --wrap-descriptions=88, --wrap-summaries=80] # does not yet support toml config
Expand All @@ -33,7 +33,7 @@ repos:


- repo: https://github.com/nbQA-dev/nbQA
rev: 1.3.1
rev: 1.8.4
hooks:
- id: nbqa-isort
- id: nbqa-black
Expand Down
1 change: 1 addition & 0 deletions architect/libs/utillib.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""An assortment of utilities and classes for scientific computing."""

# external
import numpy as np
from astropy.units.quantity import Quantity
Expand Down
1 change: 1 addition & 0 deletions architect/luts/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
"""Look Up Table implementation."""

from .functions import *
1 change: 1 addition & 0 deletions architect/systems/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Import base classes."""

from .system import System # isort:skip
from .component import Component
1 change: 1 addition & 0 deletions architect/systems/component.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Component class."""

# external
import astropy.units as unit

Expand Down
1 change: 1 addition & 0 deletions architect/systems/optical/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
"""Import component type."""

from .optical_component import OpticalComponent
1 change: 1 addition & 0 deletions architect/systems/optical/optical_component.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Optical component class."""

# stdlib
import logging

Expand Down
20 changes: 20 additions & 0 deletions architect/systems/optical/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,26 @@ def get_waveband(self) -> Quantity[unit.m]:
else:
raise ValueError("Waveband is not set.")

def get_datacube_size(self) -> unit.bit:
"""Get the size of datacube in bit.

Ref: https://www.notion.so/utat-ss/Hyperspectral-Datacube-Size-5390b2593dff48b2b96d954eb8267844

"""

assert self.n_px is not None, "n_px must be specified."
assert self.n_bit is not None, "n_bit must be specified."

npxx = self.n_px[
0
] # 640 px, pixels on the sensor in the across-track direction -> spatial information
npxy = self.n_px[
1
] # 512 px, pixels on the sensor in the along-track direction -> spectral information
nbit = self.n_bit # bit depth
D = npxx * npxx * npxy * nbit
return D / unit.pix**3


class TauSWIR(Sensor):
"""Teledyne FLIR Tau SWIR sensor.
Expand Down
1 change: 1 addition & 0 deletions architect/systems/optical/spectrometers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Spectrometer classes."""

# stdlib
import logging
import math
Expand Down
1 change: 1 addition & 0 deletions architect/systems/space/satellites.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Satellite system classes."""

# external
import astropy.constants as const
import astropy.units as unit
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "architect"
version = "0.1.0"
version = "1.4.0"
description = ""
authors = ["UTAT"]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for transmissive diffractor component."""

# stdlib
import logging

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for VPH Grating component."""

# stdlib
import logging

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for VPH Grism component."""

# stdlib
import logging

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for Foreoptic component."""

# stdlib
import logging

Expand Down
1 change: 1 addition & 0 deletions tests/test_systems/test_optical/test_lenses/test_Lens.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for AchromLens component."""

# stdlib
import logging

Expand Down
12 changes: 12 additions & 0 deletions tests/test_systems/test_optical/test_sensors/test_Sensor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for Sensor component."""

# stdlib
import logging

Expand Down Expand Up @@ -156,3 +157,14 @@ def test_get_efficiency():
LOG.info(result)

assert result.unit == unit.pct * unit.electron


def test_get_datacube_size():
"""Test get_datacube_size method."""

sensor = Sensor(n_px=(640, 512) * unit.pix, n_bit=14 * unit.bit)

result = sensor.get_datacube_size()
LOG.info(result)

assert result.unit == unit.bit
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""FINCHEye class tests."""

# stdlib
import logging

Expand Down
1 change: 1 addition & 0 deletions tests/test_systems/test_space/test_CubeSat.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Satellite class tests."""

# stdlib
import logging

Expand Down
1 change: 1 addition & 0 deletions tests/test_systems/test_space/test_FINCH.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Satellite class tests."""

# stdlib
import logging

Expand Down
1 change: 1 addition & 0 deletions tests/test_systems/test_space/test_Satellite.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Satellite class tests."""

# stdlib
import logging

Expand Down
1 change: 1 addition & 0 deletions tests/test_systems/test_system.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""System class tests."""

# stdlib
import logging

Expand Down