Commit af9e3ed0 authored by Zhang, Yuanpeng's avatar Zhang, Yuanpeng
Browse files

fix the issue with shadow mask generation config

parent c4561c24
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ Here is a typical input configuration file (in JSON format),
    "SampleEnv": "Shifter",
    "OutputDir": "/SNS/NOM/shared/CALIBRATION/2023_1_1A_Group_CAL",
    "DiaLattParam": 3.5671299351,
    "GenShadowMask": true,
    "GenShadowMask": "shadow_mask.in",
    "GroupMethod": "KMEANS_ED",
    "SaveInitCalTable": true,
    "Quiet": true,
@@ -36,14 +36,14 @@ detailed information,

> DOI: 10.1103/PhysRevLett.104.085901

The `GenShadowMask` entry is for controlling whether to generate the masks for
the shadowed region of the detectors. The `GroupMethod` entry specifies the
method to be used for grouping pixels initially before the calibration.
Currently, the grouping of pixels is only used for identifying those pixels
which are far away from others and thus will be treated as outliers and masked
out. The `SaveInitCalTable` flag is for specifying whether to save the
intermediate calibration where all pixels are lined up without further
calibration. The `Quiet` flag controls whether to print out logs during the
The `GenShadowMask` entry is for specifying the file name of the generated masks for
the shadowed region of the detectors. If the entry is not given, no shadow mask will
be generated.  The `GroupMethod` entry specifies the method to be used for grouping
pixels initially before the calibration. Currently, the grouping of pixels is only
used for identifying those pixels which are far away from others and thus will be
treated as outliers and masked out. The `SaveInitCalTable` flag is for specifying
whether to save the intermediate calibration where all pixels are lined up without
further calibration. The `Quiet` flag controls whether to print out logs during the
running. By suppressing the console log output, one can save a lot of wall time.
The `ArbCalFile` entry specifies an arbitrary starting calibration file. This is
to be used as the input calibration file for running the `PDCalibration`
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
    "SampleEnv": "Shifter",
    "OutputDir": "/SNS/NOM/shared/CALIBRATION/2023_1_1A_Group_CAL",
    "DiaLattParam": 3.5671299351,
    "GenShadowMask": true,
    "GenShadowMask": "shadow_mask.in",
    "GroupMethod": "KMEANS_ED",
    "SaveInitCalTable": true,
    "Quiet": true,
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ echo "Output directory: $out_dir"
echo "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"

# Generate mask
if [ $gen_mask_file = "yes" ]; then
if [ ! $gen_mask_file = "no" ]; then
    mantidpython $working_dir/inputs/mask_gen/nom_shadow_mask_gen.py $dia_file
    rm -rf $running_dir/manual_mask_cache/gen_mask/$gen_mask_file
    Rscript $working_dir/inputs/mask_gen/find_dip.R $gen_mask_file
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ echo "Output directory: $out_dir"
echo "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"

# Generate mask
if [ $gen_mask_file = "yes" ]; then
if [ ! $gen_mask_file = "no" ]; then
    mantidpython $working_dir/inputs/mask_gen/nom_shadow_mask_gen.py $dia_file
    rm -rf $running_dir/manual_mask_cache/gen_mask/$gen_mask_file
    Rscript $working_dir/inputs/mask_gen/find_dip.R $gen_mask_file
+3 −4
Original line number Diff line number Diff line
@@ -5,9 +5,8 @@ input_config_f = sys.argv[1]
with open(input_config_f, "r") as f:
    input_config = json.load(f)

if "GenShadowMask" in input_config:
    gen_mask = input_config["GenShadowMask"]

if gen_mask:
    print("yes")
    print(gen_mask)
else:
    print("no")