diff --git a/docs/configuration.rst b/docs/configuration.rst index 9bb2007..bffdaad 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -20,10 +20,11 @@ is divided into sections: **paths** section ------------------ -There are four configurables for this section: +There are five configurables for this section: - *overlappogram*: path to the overlappogram image to be inverted. -- *weights*: path to the accompanying weights used in the inversion. Weights should be in units of :math:`\frac{1}{\sigma}` where :math:`\sigma` is the uncertainty or standard deviation +- *weights*: path to the accompanying weights used in the inversion. Weights should be in units of :math:`\frac{1}{\sigma}` where :math:`\sigma` is the uncertainty or standard deviation. Weights are optional and the keyword can be omitted to run in weightless mode. +- *mask*: path to the accompanying mask used in the inversion. This mask is optional and the keyword can be omitted to run without a mask. - *response*: path to the instrument response. - *gnt*: path to the file containing atomic physics values from Chianti, the *G(n, t)* function. diff --git a/example_config.toml b/example_config.toml index 5523942..33cdcc0 100644 --- a/example_config.toml +++ b/example_config.toml @@ -1,6 +1,7 @@ [paths] overlappogram = "./data/ECCCO_speedtest_runs/combined_ECCCO_trim_sw_lw_s_i_scaled.fits" -weights = "data/ECCCO_speedtest_runs/combined_ECCCO_weights_trim_sw_lw_s_i_scaled.fits" +weights = "data/ECCCO_speedtest_runs/combined_ECCCO_weights_trim_sw_lw_s_i_scaled.fits" # optional, omit keyword to skip +#mask = "no example" # mask has been commented out since we do not use it in this example response = "data/ECCCO_speedtest_runs/D27Feb2024_eccco_response_feldman_m_el_with_tables_trim_sw_lw_s_i_scaled.fits" gnt = "data/ECCCO_speedtest_runs/master_gnt_eccco_inphotons_cm3persperpix_with_tables.fits" @@ -12,14 +13,14 @@ overwrite = true [inversion] solution_fov_width = 2 -detector_row_range = [0, 50] +detector_row_range = [0, 500] field_angle_range = [-1227, 1227] response_dependency_name = "logt" response_dependency_list = [5.7, 5.8, 5.9, 6.0 , 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8] smooth_over = 'dependence' [model] -alphas = [3E-5] #, 4E-5, 0.1] #[0.2, 0.1, 0.01, 0.005] +alphas = [3E-5, 4E-5, 0.1, 0.2, 0.1, 0.01, 0.005] rhos = [0.1] warm_start = false tol = 1E-2 diff --git a/overlappogram/cli.py b/overlappogram/cli.py index 152d90f..46709a9 100644 --- a/overlappogram/cli.py +++ b/overlappogram/cli.py @@ -32,7 +32,8 @@ def unfold(config): os.makedirs(config["output"]["directory"], exist_ok=True) # make sure output directory exists overlappogram = load_overlappogram(config["paths"]["overlappogram"], - config["paths"]["weights"] if 'weights' in config['paths'] else None) + config["paths"]["weights"] if 'weights' in config['paths'] else None, + config["paths"]["mask"] if 'mask' in config['paths'] else None) response_cube = load_response_cube(config["paths"]["response"]) inversion = Inverter( diff --git a/overlappogram/io.py b/overlappogram/io.py index 146f761..70cd9ea 100644 --- a/overlappogram/io.py +++ b/overlappogram/io.py @@ -19,7 +19,7 @@ 'ELECDIST'] -def load_overlappogram(image_path: str, weights_path: str | None) -> NDCube: +def load_overlappogram(image_path: str, weights_path: str | None = None, mask_path: str | None = None) -> NDCube: with fits.open(image_path) as image_hdul: image = image_hdul[0].data header = image_hdul[0].header @@ -32,7 +32,13 @@ def load_overlappogram(image_path: str, weights_path: str | None) -> NDCube: weights = weights_hdul[0].data uncertainty = StdDevUncertainty(1 / weights) - return NDCube(image, wcs=wcs, uncertainty=uncertainty, meta=dict(header)) + if mask_path is None: + mask = None + else: + with fits.open(mask_path) as mask_hdul: + mask = mask_hdul[0].data + + return NDCube(image, wcs=wcs, uncertainty=uncertainty, mask=mask, meta=dict(header)) def load_response_cube(path: str) -> NDCube: diff --git a/pyproject.toml b/pyproject.toml index 73b539e..f17eeb7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ requires = ["setuptools", [project] name = "overlappogram" -version = "0.0.6" +version = "0.0.7" dependencies = ["numpy<2.0.0", "astropy", "scikit-learn",