Exemplo n.º 1
0
To do:
    * Save maps for all ISOs and use these in the calibration process.
    * Generic filenames, if data are not labelled by ISO.
"""

import numpy as np
from sys import argv
from spectacle import io, dark

# Get the data folder from the command line
folder = io.path_from_input(argv)
root = io.find_root_folder(folder)

# Load Camera object
camera = io.load_camera(root)
print(f"Loaded Camera object: {camera}")

# Save location based on camera name
save_to_normalised = camera.filename_calibration("dark_current_normalised.npy")

# Get the ISO speed at which the data were taken from the folder name
ISO = io.split_iso(folder)
save_to_ADU = camera.filename_intermediaries(
    "dark_current/dark_current_iso{ISO}.npy", makefolders=True)

# Load the data
times, means = io.load_means(folder, retrieve_value=io.split_exposure_time)
print(f"Loaded data at {len(times)} exposure times")

# Fit a linear trend to each pixel
import numpy as np
from sys import argv
from spectacle import io, spectral
from spectacle.general import RMS

# Get the data folder from the command line
files = io.path_from_input(argv)
roots = [io.find_root_folder(file) for file in files]

save_to_rgbg2 = io.results_folder / "spectral_responses.pdf"
save_to_rgb = io.results_folder / "spectral_responses_RGB.pdf"
save_to_snr = io.results_folder / "spectral_responses_SNR.pdf"

# Load Camera objects
cameras = [io.load_camera(root) for root in roots]
print(f"Loaded Camera objects: {cameras}")

# Load the data
curves = [np.loadtxt(f, delimiter=",", unpack=True) for f in files]
print("Loaded data")

# Check that all necessary data are available
assert len(cameras) == len(curves)

number_of_cameras = len(cameras)
camera_names = [camera.name for camera in cameras]

# Line styles for the individual camera spectra
styles = ["-", "--", ":", "-."]