Ejemplo n.º 1
0
def settings(instrument):
    """Combine run specific configuration with default settings

    Parameters
    ----------
    config : dict(str:obj)
        run specific settings

    Returns
    -------
    settings : dict(str:obj)
        updated settings
    """

    return configuration.get_configuration_for_instrument(instrument,
                                                          plot=False)
Ejemplo n.º 2
0
def settings(instrument):
    """Combine run specific configuration with default settings

    Parameters
    ----------
    config : dict(str:obj)
        run specific settings

    Returns
    -------
    settings : dict(str:obj)
        updated settings
    """

    settings = configuration.get_configuration_for_instrument(instrument,
                                                              plot=False)
    settings["wavecal"]["manual"] = False
    settings["orders"]["manual"] = False
    return settings
Ejemplo n.º 3
0
    # "science",
    # "continuum",
    # "finalize",
)

# some basic settings
# Expected Folder Structure: base_dir/datasets/HD132205/*.fits.gz
# Feel free to change this to your own preference, values in curly brackets will be replaced with the actual values {}

# load dataset (and save the location)
base_dir = "/DATA/ESO/CRIRES+"
input_dir = "tdata/CD13/UNCLASSIFIED"
output_dir = "reduced/{mode}/"

# Path to the configuration parameters, that are to be used for this reduction

config = get_configuration_for_instrument(instrument, plot=1)

pyreduce.reduce.main(
    instrument,
    target,
    night,
    mode,
    steps,
    base_dir=base_dir,
    input_dir=input_dir,
    output_dir=output_dir,
    configuration=config,
    order_range=(0, 4),
)
Ejemplo n.º 4
0
def config(supported_instrument):
    return get_configuration_for_instrument(supported_instrument)
Ejemplo n.º 5
0
# define parameters
instrument = "HARPS"
target = "HD109200"
night = "2015-04-09"
mode = "red"

# some basic settings
# Expected Folder Structure: base_dir/datasets/HD132205/*.fits.gz
# Feel free to change this to your own preference, values in curly brackets will be replaced with the actual values {}

# load dataset (and save the location)
base_dir = datasets.HARPS("/DATA/PyReduce")
input_dir = "raw"
output_dir = f"reduced_{mode}"

config = configuration.get_configuration_for_instrument(instrument, plot=False)

f = os.path.join(base_dir, output_dir, "harps_red.thar.npz")
data = np.load(f, allow_pickle=True)
thar = data["thar"]
wave = data["wave"]

f = os.path.join(base_dir, output_dir, "harps_red.comb.npz")
data = np.load(f, allow_pickle=True)
comb = data["comb"]

ndim = 2
kwargs = config["wavecal"]
kwargs_comb = config["freq_comb"]
kwargs["dimensionality"] = f"{ndim}D"
kwargs_comb["dimensionality"] = f"{ndim}D"
Ejemplo n.º 6
0
    # "finalize",
)

# some basic settings
# Expected Folder Structure: base_dir/datasets/HD132205/*.fits.gz
# Feel free to change this to your own preference, values in curly brackets will be replaced with the actual values {}

# load dataset (and save the location)
base_dir = "/DATA/ESO/CRIRES+/pCOMM/210824_mincal"
input_dir = "J1228/"
output_dir = "{mode}_reduced/"

# Path to the configuration parameters, that are to be used for this reduction

config = get_configuration_for_instrument(instrument,
                                          plot=1,
                                          bias_scaling="exposure_time")

pyreduce.reduce.main(
    instrument,
    target,
    night,
    mode,
    steps,
    base_dir=base_dir,
    input_dir=input_dir,
    output_dir=output_dir,
    configuration=config,
    allow_calibration_only=True,
    # order_range=(0, 4),
)
Ejemplo n.º 7
0
bpm_mask = "path/to/bpm_mask.fits"
wavecal_file = "path/to/wavecal_file"

# create our custom instrument
instrument = create_custom_instrument("custom",
                                      extension=1,
                                      mask_file=bpm_mask,
                                      wavecal_file=wavecal_file)

# Override default values
# those can either be fixed values or refer to FITS header keywords
instrument.info["readnoise"] = 1
instrument.info["prescan_x"] = "PRESCAN X"

# For loading the config we specify pyreduce as the source, since this is the default
config = get_configuration_for_instrument("pyreduce", plot=1)
# Define your own configuration
config["orders"]["degree"] = 5

# Since we can't find the files ourselves (at least not without defining the criteria we are looking for)
# We need to manually define which files go where
files = {"bias": ["file1", "file2"], "flat": ["file3"]}

# We define the path to the output directory
output_dir = "path/to/output"

# (optional) We need to define the log file
log_file = "path/to/log_file.txt"
start_logging(log_file)

# Define other parameter for PyReduce
Ejemplo n.º 8
0
def test_validation():
    config = conf.get_configuration_for_instrument("UVES")
    config["orders"]["degree"] = -1

    with pytest.raises(ValueError):
        conf.validate_config(config)