예제 #1
0
specific ISO speed), not normalised gain maps (normalised ADU/electron).

Command line arguments:
    * `file`: the location of the gain map to be analysed. This should be an
    NPY file generated using ../calibration/gain.py.
"""

import numpy as np
from sys import argv
from matplotlib import pyplot as plt
from spectacle import io, plot, symmetric_percentiles

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

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

# Save locations
savefolder = camera.filename_analysis("gain", makefolders=True)
save_to_histogram = savefolder / f"gain_histogram_iso{ISO}.pdf"
save_to_map = savefolder / f"gain_map_iso{ISO}.pdf"
save_to_histogram_miniature = savefolder / f"gain_histogram_iso{ISO}_rgb_only.pdf"

# Load the data
gains = np.load(file)
print("Loaded data")
예제 #2
0
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
dark_current, bias_fit = dark.fit_dark_current_linear(times, means)
print("Fitted dark current to each pixel")

# Save the dark current map at this ISO
np.save(save_to_ADU, dark_current)
print(f"Saved dark current map at ISO {ISO} to '{save_to_ADU}'")
예제 #3
0
from sys import argv
from matplotlib import pyplot as plt
from spectacle import io, plot, analyse
from spectacle.general import gauss_filter_multidimensional

# 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_folder = io.results_folder

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

# Find the ISO speed for each gain map, to include in the plot titles
isos = [io.split_iso(file) for file in files]

# Labels for the plots, based on camera and ISO
labels = [f"{camera.name} (ISO {iso})" for camera, iso in zip(cameras, isos)]

# Load the data
data_arrays = [np.load(file) for file in files]
print("Loaded data")

# Demosaick the data (split into the Bayer RGBG2 channels)
data_RGBG_arrays = [
    camera.demosaick(data) for data, camera in zip(data_arrays, cameras)
]
print("Demosaicked data")

# Convolve the RGBG2 data with a Gaussian kernel