From da2ee4784d44224fc8b78c6cf36f3ed05c5a9813 Mon Sep 17 00:00:00 2001 From: Alex Buts <Alex.Buts@stfc.ac.uk> Date: Fri, 11 Oct 2019 11:03:37 +0100 Subject: [PATCH] Re#26871 Shapes conversion to/from string + all IDF modified to accept new properties as part of the reduction --- instrument/LET_Parameters.xml | 28 ++++++++++++++++-- instrument/LET_Parameters_dr1to12.xml | 28 ++++++++++++++++-- instrument/LET_Parameters_dr2to12.xml | 28 ++++++++++++++++-- instrument/LET_Parameters_dr2to9.xml | 28 ++++++++++++++++-- instrument/LET_Parameters_dr3to10.xml | 28 ++++++++++++++++-- instrument/LET_Parameters_dr3to11.xml | 28 ++++++++++++++++-- instrument/MAPS_Parameters.xml | 5 ++-- instrument/MAPS_Parameters_2017_06_02.xml | 4 +-- instrument/MARI_Parameters.xml | 5 ++-- .../MARI_Parameters_19900101_20160911.xml | 29 ++++++++++++++++--- instrument/MERLIN_Parameters.xml | 20 +++++++++++++ instrument/MERLIN_Parameters_2017_02.xml | 20 +++++++++++++ instrument/MERLIN_Parameters_2018_03.xml | 22 ++++++++++++++ instrument/MERLIN_Parameters_after2013_4.xml | 24 ++++++++++++++- scripts/Inelastic/Direct/AbsorptionShapes.py | 9 ++++-- .../Inelastic/Direct/PropertiesDescriptors.py | 18 ++++++++---- scripts/test/AbsorptionShapesTest.py | 4 +-- scripts/test/DirectPropertyManagerTest.py | 16 ++++++++++ 18 files changed, 303 insertions(+), 41 deletions(-) diff --git a/instrument/LET_Parameters.xml b/instrument/LET_Parameters.xml index 229217281a1..20d84b6e70e 100644 --- a/instrument/LET_Parameters.xml +++ b/instrument/LET_Parameters.xml @@ -414,17 +414,39 @@ <value val="False"/> </parameter> -<!-- The semicolon separated list of possible log names, containing information on crystl rotation. - First found log will be used togethere with motor_offset to identify crystal rotation +<!-- The semicolon separated list of possible log names, containing information on crystal rotation. + First found log will be used together with motor_offset to identify crystal rotation (psi in Horace) --> <parameter name="motor_log_names" type="string"> <value val="CCR_ROT;Rot"/> </parameter> -<!-- Initial value used to identify crytsal rotation angle psi=motor_offset+wccr.timeAverageValue() --> +<!-- Initial value used to identify crystal rotation angle psi=motor_offset+wccr.timeAverageValue() --> <parameter name="motor_offset"> <value val="None"/> </parameter> +<parameter name="correct_absorption_on" type="string"> + <value val="None"/> + <description is="If defined, the property would initiate the run of the absorption corrections procedure, specific for the measured sample. + The corrections themselves are controlled by one of the absorption shapes classes, defined for Direct inelastic reduction. + These shapes are Cylinder, Plate, HollowCylinder and other defined in the AbsorptionShapes module within the direct inelastic + reduction scripts folder"/> +</parameter> +<parameter name="abs_corr_info" type="string"> + <value val="None"/> + <description is="The property describes the type of the absorption corrections to run and, if necessary, + additional properties of the absorption algorithm to use. The acceptable types are: + is_mc:True (for Monte-Carlo corrections) + is_fast:True (for analytical corrections) This option is default option if no this kind of key is present. + The property sting may have a form: + is_mc:True,NumberOfWavelengthPoints:50,EventsPerPoint:100 or any other non-sample related properties, accepted by Monte-Carlo corrections algorithm + or + is_mc:True,ExpMethod:FastApprox,ElementSize:10 or any other non-sample related accepted by AbsorptionCorrection algorithm + if set up in python script, the info can be provided both as string above and as a python dictionary. + "/> +</parameter> + + <!-- List of the words which can be used as a command line arguments to define reducer keywords the form is reducer_keword1=synonim1=synonim2=synonim3;reducer_keword1=synonim1a, so, the reducer keywords are the leftmost values of the keyword assignments below diff --git a/instrument/LET_Parameters_dr1to12.xml b/instrument/LET_Parameters_dr1to12.xml index 7dc8b5fa8b6..3d5cc9e46f6 100644 --- a/instrument/LET_Parameters_dr1to12.xml +++ b/instrument/LET_Parameters_dr1to12.xml @@ -414,18 +414,40 @@ <value val="False"/> </parameter> -<!-- The semicolon separated list of possible log names, containing information on crystl rotation. - First found log will be used togethere with motor_offset to identify crystal rotation +<!-- The semicolon separated list of possible log names, containing information on crystal rotation. + First found log will be used together with motor_offset to identify crystal rotation (psi in Horace) --> <parameter name="motor_log_names" type="string"> <value val="CCR_ROT;Rot"/> </parameter> -<!-- Initial value used to identify crytsal rotation angle psi=motor_offset+wccr.timeAverageValue() --> +<!-- Initial value used to identify crystal rotation angle psi=motor_offset+wccr.timeAverageValue() --> <parameter name="motor_offset"> <value val="None"/> </parameter> +<parameter name="correct_absorption_on" type="string"> + <value val="None"/> + <description is="If defined, the property would initiate the run of the absorption corrections procedure, specific for the measured sample. + The corrections themselves are controlled by one of the absorption shapes classes, defined for Direct inelastic reduction. + These shapes are Cylinder, Plate, HollowCylinder and other defined in the AbsorptionShapes module within the direct inelastic + reduction scripts folder"/> +</parameter> +<parameter name="abs_corr_info" type="string"> + <value val="None"/> + <description is="The property describes the type of the absorption corrections to run and, if necessary, + additional properties of the absorption algorithm to use. The acceptable types are: + is_mc:True (for Monte-Carlo corrections) + is_fast:True (for analytical corrections) This option is default option if no this kind of key is present. + The property sting may have a form: + is_mc:True,NumberOfWavelengthPoints:50,EventsPerPoint:100 or any other non-sample related properties, accepted by Monte-Carlo corrections algorithm + or + is_mc:True,ExpMethod:FastApprox,ElementSize:10 or any other non-sample related accepted by AbsorptionCorrection algorithm + if set up in python script, the info can be provided both as string above and as a python dictionary. + "/> +</parameter> + + <!-- List of the words which can be used as a command line arguments to define reducer keywords the form is reducer_keword1=synonim1=synonim2=synonim3;reducer_keword1=synonim1a, so, the reducer keywords are the leftmost values of the keyword assignments below diff --git a/instrument/LET_Parameters_dr2to12.xml b/instrument/LET_Parameters_dr2to12.xml index b1907b5869f..e6d167f8ba7 100644 --- a/instrument/LET_Parameters_dr2to12.xml +++ b/instrument/LET_Parameters_dr2to12.xml @@ -414,18 +414,40 @@ <value val="False"/> </parameter> -<!-- The semicolon separated list of possible log names, containing information on crystl rotation. - First found log will be used togethere with motor_offset to identify crystal rotation +<!-- The semicolon separated list of possible log names, containing information on crystal rotation. + First found log will be used together with motor_offset to identify crystal rotation (psi in Horace) --> <parameter name="motor_log_names" type="string"> <value val="CCR_ROT;Rot"/> </parameter> -<!-- Initial value used to identify crytsal rotation angle psi=motor_offset+wccr.timeAverageValue() --> +<!-- Initial value used to identify crystal rotation angle psi=motor_offset+wccr.timeAverageValue() --> <parameter name="motor_offset"> <value val="None"/> </parameter> +<parameter name="correct_absorption_on" type="string"> + <value val="None"/> + <description is="If defined, the property would initiate the run of the absorption corrections procedure, specific for the measured sample. + The corrections themselves are controlled by one of the absorption shapes classes, defined for Direct inelastic reduction. + These shapes are Cylinder, Plate, HollowCylinder and other defined in the AbsorptionShapes module within the direct inelastic + reduction scripts folder"/> +</parameter> +<parameter name="abs_corr_info" type="string"> + <value val="None"/> + <description is="The property describes the type of the absorption corrections to run and, if necessary, + additional properties of the absorption algorithm to use. The acceptable types are: + is_mc:True (for Monte-Carlo corrections) + is_fast:True (for analytical corrections) This option is default option if no this kind of key is present. + The property sting may have a form: + is_mc:True,NumberOfWavelengthPoints:50,EventsPerPoint:100 or any other non-sample related properties, accepted by Monte-Carlo corrections algorithm + or + is_mc:True,ExpMethod:FastApprox,ElementSize:10 or any other non-sample related accepted by AbsorptionCorrection algorithm + if set up in python script, the info can be provided both as string above and as a python dictionary. + "/> +</parameter> + + <!-- List of the words which can be used as a command line arguments to define reducer keywords the form is reducer_keword1=synonim1=synonim2=synonim3;reducer_keword1=synonim1a, so, the reducer keywords are the leftmost values of the keyword assignments below diff --git a/instrument/LET_Parameters_dr2to9.xml b/instrument/LET_Parameters_dr2to9.xml index 58c8e9bf70e..fec0e1c8de1 100644 --- a/instrument/LET_Parameters_dr2to9.xml +++ b/instrument/LET_Parameters_dr2to9.xml @@ -414,18 +414,40 @@ <value val="False"/> </parameter> -<!-- The semicolon separated list of possible log names, containing information on crystl rotation. - First found log will be used togethere with motor_offset to identify crystal rotation +<!-- The semicolon separated list of possible log names, containing information on crystal rotation. + First found log will be used together with motor_offset to identify crystal rotation (psi in Horace) --> <parameter name="motor_log_names" type="string"> <value val="CCR_ROT;Rot"/> </parameter> -<!-- Initial value used to identify crytsal rotation angle psi=motor_offset+wccr.timeAverageValue() --> +<!-- Initial value used to identify crystal rotation angle psi=motor_offset+wccr.timeAverageValue() --> <parameter name="motor_offset"> <value val="None"/> </parameter> +<parameter name="correct_absorption_on" type="string"> + <value val="None"/> + <description is="If defined, the property would initiate the run of the absorption corrections procedure, specific for the measured sample. + The corrections themselves are controlled by one of the absorption shapes classes, defined for Direct inelastic reduction. + These shapes are Cylinder, Plate, HollowCylinder and other defined in the AbsorptionShapes module within the direct inelastic + reduction scripts folder"/> +</parameter> +<parameter name="abs_corr_info" type="string"> + <value val="None"/> + <description is="The property describes the type of the absorption corrections to run and, if necessary, + additional properties of the absorption algorithm to use. The acceptable types are: + is_mc:True (for Monte-Carlo corrections) + is_fast:True (for analytical corrections) This option is default option if no this kind of key is present. + The property sting may have a form: + is_mc:True,NumberOfWavelengthPoints:50,EventsPerPoint:100 or any other non-sample related properties, accepted by Monte-Carlo corrections algorithm + or + is_mc:True,ExpMethod:FastApprox,ElementSize:10 or any other non-sample related accepted by AbsorptionCorrection algorithm + if set up in python script, the info can be provided both as string above and as a python dictionary. + "/> +</parameter> + + <!-- List of the words which can be used as a command line arguments to define reducer keywords the form is reducer_keword1=synonim1=synonim2=synonim3;reducer_keword1=synonim1a, so, the reducer keywords are the leftmost values of the keyword assignments below diff --git a/instrument/LET_Parameters_dr3to10.xml b/instrument/LET_Parameters_dr3to10.xml index 256fe193272..95e300c5fbf 100644 --- a/instrument/LET_Parameters_dr3to10.xml +++ b/instrument/LET_Parameters_dr3to10.xml @@ -414,17 +414,39 @@ <value val="False"/> </parameter> -<!-- The semicolon separated list of possible log names, containing information on crystl rotation. - First found log will be used togethere with motor_offset to identify crystal rotation +<!-- The semicolon separated list of possible log names, containing information on crystal rotation. + First found log will be used together with motor_offset to identify crystal rotation (psi in Horace) --> <parameter name="motor_log_names" type="string"> <value val="CCR_ROT;Rot"/> </parameter> -<!-- Initial value used to identify crytsal rotation angle psi=motor_offset+wccr.timeAverageValue() --> +<!-- Initial value used to identify crystal rotation angle psi=motor_offset+wccr.timeAverageValue() --> <parameter name="motor_offset"> <value val="None"/> </parameter> +<parameter name="correct_absorption_on" type="string"> + <value val="None"/> + <description is="If defined, the property would initiate the run of the absorption corrections procedure, specific for the measured sample. + The corrections themselves are controlled by one of the absorption shapes classes, defined for Direct inelastic reduction. + These shapes are Cylinder, Plate, HollowCylinder and other defined in the AbsorptionShapes module within the direct inelastic + reduction scripts folder"/> +</parameter> +<parameter name="abs_corr_info" type="string"> + <value val="None"/> + <description is="The property describes the type of the absorption corrections to run and, if necessary, + additional properties of the absorption algorithm to use. The acceptable types are: + is_mc:True (for Monte-Carlo corrections) + is_fast:True (for analytical corrections) This option is default option if no this kind of key is present. + The property sting may have a form: + is_mc:True,NumberOfWavelengthPoints:50,EventsPerPoint:100 or any other non-sample related properties, accepted by Monte-Carlo corrections algorithm + or + is_mc:True,ExpMethod:FastApprox,ElementSize:10 or any other non-sample related accepted by AbsorptionCorrection algorithm + if set up in python script, the info can be provided both as string above and as a python dictionary. + "/> +</parameter> + + <!-- List of the words which can be used as a command line arguments to define reducer keywords the form is reducer_keword1=synonim1=synonim2=synonim3;reducer_keword1=synonim1a, so, diff --git a/instrument/LET_Parameters_dr3to11.xml b/instrument/LET_Parameters_dr3to11.xml index c46297bf739..c71403135d9 100644 --- a/instrument/LET_Parameters_dr3to11.xml +++ b/instrument/LET_Parameters_dr3to11.xml @@ -414,18 +414,40 @@ <value val="False"/> </parameter> -<!-- The semicolon separated list of possible log names, containing information on crystl rotation. - First found log will be used togethere with motor_offset to identify crystal rotation +<!-- The semicolon separated list of possible log names, containing information on crystal rotation. + First found log will be used together with motor_offset to identify crystal rotation (psi in Horace) --> <parameter name="motor_log_names" type="string"> <value val="CCR_ROT;Rot"/> </parameter> -<!-- Initial value used to identify crytsal rotation angle psi=motor_offset+wccr.timeAverageValue() --> +<!-- Initial value used to identify crystal rotation angle psi=motor_offset+wccr.timeAverageValue() --> <parameter name="motor_offset"> <value val="None"/> </parameter> +<parameter name="correct_absorption_on" type="string"> + <value val="None"/> + <description is="If defined, the property would initiate the run of the absorption corrections procedure, specific for the measured sample. + The corrections themselves are controlled by one of the absorption shapes classes, defined for Direct inelastic reduction. + These shapes are Cylinder, Plate, HollowCylinder and other defined in the AbsorptionShapes module within the direct inelastic + reduction scripts folder"/> +</parameter> +<parameter name="abs_corr_info" type="string"> + <value val="None"/> + <description is="The property describes the type of the absorption corrections to run and, if necessary, + additional properties of the absorption algorithm to use. The acceptable types are: + is_mc:True (for Monte-Carlo corrections) + is_fast:True (for analytical corrections) This option is default option if no this kind of key is present. + The property sting may have a form: + is_mc:True,NumberOfWavelengthPoints:50,EventsPerPoint:100 or any other non-sample related properties, accepted by Monte-Carlo corrections algorithm + or + is_mc:True,ExpMethod:FastApprox,ElementSize:10 or any other non-sample related accepted by AbsorptionCorrection algorithm + if set up in python script, the info can be provided both as string above and as a python dictionary. + "/> +</parameter> + + <!-- List of the words which can be used as a command line arguments to define reducer keywords the form is reducer_keword1=synonim1=synonim2=synonim3;reducer_keword1=synonim1a, so, the reducer keywords are the leftmost values of the keyword assignments below diff --git a/instrument/MAPS_Parameters.xml b/instrument/MAPS_Parameters.xml index 5073515875c..adddcee538f 100644 --- a/instrument/MAPS_Parameters.xml +++ b/instrument/MAPS_Parameters.xml @@ -429,18 +429,19 @@ <parameter name="motor_offset"> <value val="None"/> </parameter> + <parameter name="correct_absorption_on" type="string"> <value val="None"/> <description is="If defined, the property would initiate the run of the absorption corrections procedure, specific for the measured sample. The corrections themselves are controlled by one of the absorption shapes classes, defined for Direct inelastic reduction. - These shapes are Cylinder, Plate, AnnularRing and other defined in the AbsorptionShapes module within the direct inelastic + These shapes are Cylinder, Plate, HollowCylinder and other defined in the AbsorptionShapes module within the direct inelastic reduction scripts folder"/> </parameter> <parameter name="abs_corr_info" type="string"> <value val="None"/> <description is="The property describes the type of the absorption corrections to run and, if necessary, additional properties of the absorption algorithm to use. The acceptable types are: - is_mc:True (for monte-carlo corrections) + is_mc:True (for Monte-Carlo corrections) is_fast:True (for analytical corrections) This option is default option if no this kind of key is present. The property sting may have a form: is_mc:True,NumberOfWavelengthPoints:50,EventsPerPoint:100 or any other non-sample related properties, accepted by Monte-Carlo corrections algorithm diff --git a/instrument/MAPS_Parameters_2017_06_02.xml b/instrument/MAPS_Parameters_2017_06_02.xml index 407c7822b76..a5835a99a04 100644 --- a/instrument/MAPS_Parameters_2017_06_02.xml +++ b/instrument/MAPS_Parameters_2017_06_02.xml @@ -434,14 +434,14 @@ <value val="None"/> <description is="If defined, the property would initiate the run of the absorption corrections procedure, specific for the measured sample. The corrections themselves are controlled by one of the absorption shapes classes, defined for Direct inelastic reduction. - These shapes are Cylinder, Plate, AnnularRing and other defined in the AbsorptionShapes module within the direct inelastic + These shapes are Cylinder, Plate, HollowCylinder and other defined in the AbsorptionShapes module within the direct inelastic reduction scripts folder"/> </parameter> <parameter name="abs_corr_info" type="string"> <value val="None"/> <description is="The property describes the type of the absorption corrections to run and, if necessary, additional properties of the absorption algorithm to use. The acceptable types are: - is_mc:True (for monte-carlo corrections) + is_mc:True (for Monte-Carlo corrections) is_fast:True (for analytical corrections) This option is default option if no this kind of key is present. The property sting may have a form: is_mc:True,NumberOfWavelengthPoints:50,EventsPerPoint:100 or any other non-sample related properties, accepted by Monte-Carlo corrections algorithm diff --git a/instrument/MARI_Parameters.xml b/instrument/MARI_Parameters.xml index 9d92d648fb7..82f403756fa 100644 --- a/instrument/MARI_Parameters.xml +++ b/instrument/MARI_Parameters.xml @@ -437,14 +437,14 @@ <value val="None"/> <description is="If defined, the property would initiate the run of the absorption corrections procedure, specific for the measured sample. The corrections themselves are controlled by one of the absorption shapes classes, defined for Direct inelastic reduction. - These shapes are Cylinder, Plate, AnnularRing and other defined in the AbsorptionShapes module within the direct inelastic + These shapes are Cylinder, Plate, HollowCylinder and other defined in the AbsorptionShapes module within the direct inelastic reduction scripts folder"/> </parameter> <parameter name="abs_corr_info" type="string"> <value val="None"/> <description is="The property describes the type of the absorption corrections to run and, if necessary, additional properties of the absorption algorithm to use. The acceptable types are: - is_mc:True (for monte-carlo corrections) + is_mc:True (for Monte-Carlo corrections) is_fast:True (for analytical corrections) This option is default option if no this kind of key is present. The property sting may have a form: is_mc:True,NumberOfWavelengthPoints:50,EventsPerPoint:100 or any other non-sample related properties, accepted by Monte-Carlo corrections algorithm @@ -454,7 +454,6 @@ "/> </parameter> - <!-- List of the words which can be used as a command line arguments to define reducer keywords the form is reducer_keword1=synonim1=synonim2=synonim3;reducer_keword1=synonim1a, so, the reducer keywords are the leftmost values of the keyword assignments below diff --git a/instrument/MARI_Parameters_19900101_20160911.xml b/instrument/MARI_Parameters_19900101_20160911.xml index 1162fdd091e..69ab01f104c 100644 --- a/instrument/MARI_Parameters_19900101_20160911.xml +++ b/instrument/MARI_Parameters_19900101_20160911.xml @@ -415,18 +415,39 @@ <value val="False"/> </parameter> -<!-- The semicolon separated list of possible log names, containing information on crystl rotation. - First found log will be used togethere with motor_offset to identify crystal rotation +<!-- The semicolon separated list of possible log names, containing information on crystal rotation. + First found log will be used together with motor_offset to identify crystal rotation (psi in Horace) MARI of course not uses it and probably not writes such log, but - it is goot to have it here for testing purtposes --> + it is goot to have it here for testing purposes --> <parameter name="motor_log_names" type="string"> <value val="wccr;Rot"/> </parameter> -<!-- Initial value used to identify crytsal rotation angle psi=motor_offset+wccr.timeAverageValue() --> +<!-- Initial value used to identify crystal rotation angle psi=motor_offset+wccr.timeAverageValue() --> <parameter name="motor_offset"> <value val="None"/> </parameter> +<parameter name="correct_absorption_on" type="string"> + <value val="None"/> + <description is="If defined, the property would initiate the run of the absorption corrections procedure, specific for the measured sample. + The corrections themselves are controlled by one of the absorption shapes classes, defined for Direct inelastic reduction. + These shapes are Cylinder, Plate, HollowCylinder and other defined in the AbsorptionShapes module within the direct inelastic + reduction scripts folder"/> +</parameter> +<parameter name="abs_corr_info" type="string"> + <value val="None"/> + <description is="The property describes the type of the absorption corrections to run and, if necessary, + additional properties of the absorption algorithm to use. The acceptable types are: + is_mc:True (for Monte-Carlo corrections) + is_fast:True (for analytical corrections) This option is default option if no this kind of key is present. + The property sting may have a form: + is_mc:True,NumberOfWavelengthPoints:50,EventsPerPoint:100 or any other non-sample related properties, accepted by Monte-Carlo corrections algorithm + or + is_mc:True,ExpMethod:FastApprox,ElementSize:10 or any other non-sample related accepted by AbsorptionCorrection algorithm + if set up in python script, the info can be provided both as string above and as a python dictionary. + "/> +</parameter> + <!-- List of the words which can be used as a command line arguments to define reducer keywords the form is reducer_keword1=synonim1=synonim2=synonim3;reducer_keword1=synonim1a, so, diff --git a/instrument/MERLIN_Parameters.xml b/instrument/MERLIN_Parameters.xml index 88bdbdc9deb..01ada8da0df 100644 --- a/instrument/MERLIN_Parameters.xml +++ b/instrument/MERLIN_Parameters.xml @@ -425,6 +425,26 @@ <value val="None"/> </parameter> +<parameter name="correct_absorption_on" type="string"> + <value val="None"/> + <description is="If defined, the property would initiate the run of the absorption corrections procedure, specific for the measured sample. + The corrections themselves are controlled by one of the absorption shapes classes, defined for Direct inelastic reduction. + These shapes are Cylinder, Plate, HollowCylinder and other defined in the AbsorptionShapes module within the direct inelastic + reduction scripts folder"/> +</parameter> +<parameter name="abs_corr_info" type="string"> + <value val="None"/> + <description is="The property describes the type of the absorption corrections to run and, if necessary, + additional properties of the absorption algorithm to use. The acceptable types are: + is_mc:True (for Monte-Carlo corrections) + is_fast:True (for analytical corrections) This option is default option if no this kind of key is present. + The property sting may have a form: + is_mc:True,NumberOfWavelengthPoints:50,EventsPerPoint:100 or any other non-sample related properties, accepted by Monte-Carlo corrections algorithm + or + is_mc:True,ExpMethod:FastApprox,ElementSize:10 or any other non-sample related accepted by AbsorptionCorrection algorithm + if set up in python script, the info can be provided both as string above and as a python dictionary. + "/> +</parameter> <!-- List of the words which can be used as a command line arguments to define reducer keywords the form is reducer_keword1=synonim1=synonim2=synonim3;reducer_keword1=synonim1a, so, diff --git a/instrument/MERLIN_Parameters_2017_02.xml b/instrument/MERLIN_Parameters_2017_02.xml index 391803ba18a..95c01ca983b 100644 --- a/instrument/MERLIN_Parameters_2017_02.xml +++ b/instrument/MERLIN_Parameters_2017_02.xml @@ -425,6 +425,26 @@ <value val="None"/> </parameter> +<parameter name="correct_absorption_on" type="string"> + <value val="None"/> + <description is="If defined, the property would initiate the run of the absorption corrections procedure, specific for the measured sample. + The corrections themselves are controlled by one of the absorption shapes classes, defined for Direct inelastic reduction. + These shapes are Cylinder, Plate, HollowCylinder and other defined in the AbsorptionShapes module within the direct inelastic + reduction scripts folder"/> +</parameter> +<parameter name="abs_corr_info" type="string"> + <value val="None"/> + <description is="The property describes the type of the absorption corrections to run and, if necessary, + additional properties of the absorption algorithm to use. The acceptable types are: + is_mc:True (for Monte-Carlo corrections) + is_fast:True (for analytical corrections) This option is default option if no this kind of key is present. + The property sting may have a form: + is_mc:True,NumberOfWavelengthPoints:50,EventsPerPoint:100 or any other non-sample related properties, accepted by Monte-Carlo corrections algorithm + or + is_mc:True,ExpMethod:FastApprox,ElementSize:10 or any other non-sample related accepted by AbsorptionCorrection algorithm + if set up in python script, the info can be provided both as string above and as a python dictionary. + "/> +</parameter> <!-- List of the words which can be used as a command line arguments to define reducer keywords the form is reducer_keword1=synonim1=synonim2=synonim3;reducer_keword1=synonim1a, so, diff --git a/instrument/MERLIN_Parameters_2018_03.xml b/instrument/MERLIN_Parameters_2018_03.xml index 8ae55cbec86..b6695e7669a 100644 --- a/instrument/MERLIN_Parameters_2018_03.xml +++ b/instrument/MERLIN_Parameters_2018_03.xml @@ -426,6 +426,28 @@ </parameter> +<parameter name="correct_absorption_on" type="string"> + <value val="None"/> + <description is="If defined, the property would initiate the run of the absorption corrections procedure, specific for the measured sample. + The corrections themselves are controlled by one of the absorption shapes classes, defined for Direct inelastic reduction. + These shapes are Cylinder, Plate, HollowCylinder and other defined in the AbsorptionShapes module within the direct inelastic + reduction scripts folder"/> +</parameter> +<parameter name="abs_corr_info" type="string"> + <value val="None"/> + <description is="The property describes the type of the absorption corrections to run and, if necessary, + additional properties of the absorption algorithm to use. The acceptable types are: + is_mc:True (for Monte-Carlo corrections) + is_fast:True (for analytical corrections) This option is default option if no this kind of key is present. + The property sting may have a form: + is_mc:True,NumberOfWavelengthPoints:50,EventsPerPoint:100 or any other non-sample related properties, accepted by Monte-Carlo corrections algorithm + or + is_mc:True,ExpMethod:FastApprox,ElementSize:10 or any other non-sample related accepted by AbsorptionCorrection algorithm + if set up in python script, the info can be provided both as string above and as a python dictionary. + "/> +</parameter> + + <!-- List of the words which can be used as a command line arguments to define reducer keywords the form is reducer_keword1=synonim1=synonim2=synonim3;reducer_keword1=synonim1a, so, the reducer keywords are the leftmost values of the keyword assignments below diff --git a/instrument/MERLIN_Parameters_after2013_4.xml b/instrument/MERLIN_Parameters_after2013_4.xml index 3a47b550dce..03288ba80f2 100644 --- a/instrument/MERLIN_Parameters_after2013_4.xml +++ b/instrument/MERLIN_Parameters_after2013_4.xml @@ -420,12 +420,34 @@ <parameter name="motor_log_names" type="string"> <value val="CCR_ROT;wccr"/> </parameter> -<!-- Initial value used to identify crytsal rotation angle psi=motor_offset+wccr.timeAverageValue() --> +<!-- Initial value used to identify crystal rotation angle psi=motor_offset+wccr.timeAverageValue() --> <parameter name="motor_offset"> <value val="None"/> </parameter> +<parameter name="correct_absorption_on" type="string"> + <value val="None"/> + <description is="If defined, the property would initiate the run of the absorption corrections procedure, specific for the measured sample. + The corrections themselves are controlled by one of the absorption shapes classes, defined for Direct inelastic reduction. + These shapes are Cylinder, Plate, HollowCylinder and other defined in the AbsorptionShapes module within the direct inelastic + reduction scripts folder"/> +</parameter> +<parameter name="abs_corr_info" type="string"> + <value val="None"/> + <description is="The property describes the type of the absorption corrections to run and, if necessary, + additional properties of the absorption algorithm to use. The acceptable types are: + is_mc:True (for Monte-Carlo corrections) + is_fast:True (for analytical corrections) This option is default option if no this kind of key is present. + The property sting may have a form: + is_mc:True,NumberOfWavelengthPoints:50,EventsPerPoint:100 or any other non-sample related properties, accepted by Monte-Carlo corrections algorithm + or + is_mc:True,ExpMethod:FastApprox,ElementSize:10 or any other non-sample related accepted by AbsorptionCorrection algorithm + if set up in python script, the info can be provided both as string above and as a python dictionary. + "/> +</parameter> + + <!-- List of the words which can be used as a command line arguments to define reducer keywords the form is reducer_keword1=synonim1=synonim2=synonim3;reducer_keword1=synonim1a, so, the reducer keywords are the leftmost values of the keyword assignments below diff --git a/scripts/Inelastic/Direct/AbsorptionShapes.py b/scripts/Inelastic/Direct/AbsorptionShapes.py index 86de69abe99..98fb4bbb510 100644 --- a/scripts/Inelastic/Direct/AbsorptionShapes.py +++ b/scripts/Inelastic/Direct/AbsorptionShapes.py @@ -11,6 +11,7 @@ from mantid.kernel import funcinspect from mantid.simpleapi import * from mantid.api import (AlgorithmManager, Algorithm) + import random import types import ast @@ -85,6 +86,11 @@ class anAbsorptionShape(object): def __del__(self): DeleteWorkspace(self._testWorkspace) # + def __str__(self): + """ Convert an absorption shape into a string representation""" + return str(self._ShapeDescription) + '!' + str(self._Material) + + # @property def material(self): """ Contains the material, used in adsorbtion correction calculations""" @@ -210,9 +216,6 @@ class anAbsorptionShape(object): adsrbtn_correctios = MonteCarloAbsorption(correction_base_ws,**kwarg) return adsrbtn_correctios # - def str(self): - """ Convert an absorption shape into a string representation""" - return str(self._ShapeDescription) + '!' + str(self._Material) # @staticmethod def from_str(str_val): diff --git a/scripts/Inelastic/Direct/PropertiesDescriptors.py b/scripts/Inelastic/Direct/PropertiesDescriptors.py index fd82fae63b7..e8816d574b4 100644 --- a/scripts/Inelastic/Direct/PropertiesDescriptors.py +++ b/scripts/Inelastic/Direct/PropertiesDescriptors.py @@ -20,7 +20,7 @@ import mantid.simpleapi as mantid from mantid import api import Direct.ReductionHelpers as prop_helpers -from Direct.AbsorptionShapes import anAbsorptionShape +from Direct.AbsorptionShapes import * import collections @@ -1745,6 +1745,11 @@ class AbsCorrInfo(PropDescriptor): val_dict[key] = check_normalizer(val) # Store new dictionary in the property self._alg_prop = val_dict + def __str__(self): + alg_prop = self.__get__(self,AbsCorrInfo) + return str(alg_prop) + + def _algo_selector(self,algo_key,key_val): if algo_key == 'is_fast': @@ -1752,10 +1757,6 @@ class AbsCorrInfo(PropDescriptor): elif algo_key == 'is_mc': self._is_fast = not bool(key_val) - def str(self): - alg_prop = self.__get__(self,AbsCorrInfo) - return str(alg_prop) - class AbsorptionShapesContainer(PropDescriptor): """ Class to keep AbsorptionShape classes, responsible for making absorption corrections @@ -1781,11 +1782,16 @@ class AbsorptionShapesContainer(PropDescriptor): self._theShapeHolder = None return if isinstance(value,str): - raise RuntimeError('This functionality is Not yet implemented') + self._theShapeHolder = anAbsorptionShape.from_str(value) elif isinstance(value,anAbsorptionShape): self._theShapeHolder = value else: raise ValueError('The property can accept only strings and the childrens of the class anAbsorptionShape') + def __str__(self): + if self._theShapeHolder is None: + return 'None' + else: + return self._theShapeHolder.str() def list_checker(val,list_in,mess_base): """ Helper function to check the value val (first input) belongs to the diff --git a/scripts/test/AbsorptionShapesTest.py b/scripts/test/AbsorptionShapesTest.py index 695414592a9..e55b3a30ec9 100644 --- a/scripts/test/AbsorptionShapesTest.py +++ b/scripts/test/AbsorptionShapesTest.py @@ -161,7 +161,7 @@ class AdsorbtionShapesTest(unittest.TestCase): def test_string_conversion(self): """ check if shape conversion to string representation works""" ash = HollowCylinder('V',[10,2,4]) - ash_str = ash.str() + ash_str = str(ash) ash_rec = anAbsorptionShape.from_str(ash_str) self.assertTrue(isinstance(ash_rec,HollowCylinder)) @@ -169,7 +169,7 @@ class AdsorbtionShapesTest(unittest.TestCase): self.assertDictEqual(ash.shape,ash_rec.shape) ash = Sphere(['Al',10],10) - ash_str = ash.str() + ash_str = str(ash) ash_rec = anAbsorptionShape.from_str(ash_str) self.assertTrue(isinstance(ash_rec,Sphere)) diff --git a/scripts/test/DirectPropertyManagerTest.py b/scripts/test/DirectPropertyManagerTest.py index 778b5d44c0c..5532f0808e3 100644 --- a/scripts/test/DirectPropertyManagerTest.py +++ b/scripts/test/DirectPropertyManagerTest.py @@ -1286,6 +1286,22 @@ class DirectPropertyManagerTest(unittest.TestCase): got = propman.correct_absorption_on self.assertEqual(got,cyl) + str_rep_cyl = str(propman.correct_absorption_on) + is_in = 'Shape' in str_rep_cyl + self.assertTrue(is_in) + is_in = 'Cylinder' in str_rep_cyl + self.assertTrue(is_in) + + propman.correct_absorption_on = str_rep_cyl + + got = propman.correct_absorption_on + + self.assertTrue(isinstance(got,Cylinder)) + self.assertEqual(got.material,cyl.material) + self.assertEqual(got.shape,cyl.shape) + + + if __name__ == "__main__": #tester = DirectPropertyManagerTest('test_abs_shapes_container') -- GitLab