Skip to content

Commit

Permalink
propagate option properly
Browse files Browse the repository at this point in the history
  • Loading branch information
mdoucet committed Apr 2, 2024
1 parent 0627eb5 commit 4aea6b3
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 10 deletions.
14 changes: 14 additions & 0 deletions reduction/data/sf_197912_Si_dt_par_46_200.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# y=a+bx
#
# LambdaRequested[Angstroms] S1H[mm] (S2/Si)H[mm] S1W[mm] (S2/Si)W[mm] a b error_a error_b
#
# Medium=Si, runs: [197920, 197921, 197922, 197923, 197924, 197925, 197926, 197927, 197928, 197929, 197930, 197931]
IncidentMedium=Si LambdaRequested=9.74 S1H=0.391 S2iH=0.24999999999999978 S1W=20.005 S2iW=20.000084375 a=1.0888766996055554 b=-5.6872177686659006e-08 error_a=161.84564441183014 error_b=0.003988540742274152
IncidentMedium=Si LambdaRequested=7.043 S1H=0.39 S2iH=0.24999999999999978 S1W=19.952000000000005 S2iW=19.950864375000002 a=7.341821040427503 b=-6.012040147643712e-06 error_a=741.2376390289155 error_b=0.024193504430316405
IncidentMedium=Si LambdaRequested=4.25 S1H=0.39 S2iH=0.24999999999999978 S1W=8.779 S2iW=8.780164375000002 a=9.320962216410319 b=-3.708412514404863e-05 error_a=606.2605886476512 error_b=0.03099199091035445
IncidentMedium=Si LambdaRequested=4.25 S1H=0.39 S2iH=0.24999999999999978 S1W=20.002 S2iW=19.999844375000002 a=30.370149781266015 b=9.763444187558825e-05 error_a=2680.8766315704106 error_b=0.1365883376903538
IncidentMedium=Si LambdaRequested=4.25 S1H=0.77 S2iH=0.49312 S1W=12.489000000000004 S2iW=12.485564375000003 a=62.89965009567662 b=0.0001557592235018875 error_a=5488.459056149113 error_b=0.27948760026302427
IncidentMedium=Si LambdaRequested=4.25 S1H=0.774 S2iH=0.4930399999999997 S1W=20.001000000000005 S2iW=20.000244375 a=120.9852469160573 b=0.00020691590164400054 error_a=11657.27959807004 error_b=0.5869489140907286
IncidentMedium=Si LambdaRequested=4.25 S1H=1.525 S2iH=0.976 S1W=16.384000000000004 S2iW=16.395444375000004 a=356.40436234906264 b=0.0018275069497976878 error_a=36527.53453159627 error_b=1.8464457216875345
IncidentMedium=Si LambdaRequested=4.25 S1H=1.528 S2iH=0.976 S1W=20.004 S2iW=20.000244375 a=455.2870337782051 b=0.0018152748579145265 error_a=50088.87968853836 error_b=2.508098158009919
IncidentMedium=Si LambdaRequested=4.25 S1H=3.016 S2iH=1.9319199999999999 S1W=20.003000000000004 S2iW=20.000164375 a=2380.7392962875742 b=-0.03222957069862086 error_a=184998.5077522072 error_b=9.063057308166101
18 changes: 9 additions & 9 deletions reduction/data/sf_197912_Si_dt_par_46_300.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
# LambdaRequested[Angstroms] S1H[mm] (S2/Si)H[mm] S1W[mm] (S2/Si)W[mm] a b error_a error_b
#
# Medium=Si, runs: [197920, 197921, 197922, 197923, 197924, 197925, 197926, 197927, 197928, 197929, 197930, 197931]
IncidentMedium=Si LambdaRequested=9.74 S1H=0.391 S2iH=0.24999999999999978 S1W=20.005 S2iW=20.000084375 a=1.0888766996055554 b=-5.6872177686659006e-08 error_a=161.84564441183014 error_b=0.003988540742274152
IncidentMedium=Si LambdaRequested=7.043 S1H=0.39 S2iH=0.24999999999999978 S1W=19.952000000000005 S2iW=19.950864375000002 a=7.341821040427503 b=-6.012040147643712e-06 error_a=741.2376390289155 error_b=0.024193504430316405
IncidentMedium=Si LambdaRequested=4.25 S1H=0.39 S2iH=0.24999999999999978 S1W=8.779 S2iW=8.780164375000002 a=9.320962216410319 b=-3.708412514404863e-05 error_a=606.2605886476512 error_b=0.03099199091035445
IncidentMedium=Si LambdaRequested=4.25 S1H=0.39 S2iH=0.24999999999999978 S1W=20.002 S2iW=19.999844375000002 a=30.370149781266015 b=9.763444187558825e-05 error_a=2680.8766315704106 error_b=0.1365883376903538
IncidentMedium=Si LambdaRequested=4.25 S1H=0.77 S2iH=0.49312 S1W=12.489000000000004 S2iW=12.485564375000003 a=62.89965009567662 b=0.0001557592235018875 error_a=5488.459056149113 error_b=0.27948760026302427
IncidentMedium=Si LambdaRequested=4.25 S1H=0.774 S2iH=0.4930399999999997 S1W=20.001000000000005 S2iW=20.000244375 a=120.9852469160573 b=0.00020691590164400054 error_a=11657.27959807004 error_b=0.5869489140907286
IncidentMedium=Si LambdaRequested=4.25 S1H=1.525 S2iH=0.976 S1W=16.384000000000004 S2iW=16.395444375000004 a=356.40436234906264 b=0.0018275069497976878 error_a=36527.53453159627 error_b=1.8464457216875345
IncidentMedium=Si LambdaRequested=4.25 S1H=1.528 S2iH=0.976 S1W=20.004 S2iW=20.000244375 a=455.2870337782051 b=0.0018152748579145265 error_a=50088.87968853836 error_b=2.508098158009919
IncidentMedium=Si LambdaRequested=4.25 S1H=3.016 S2iH=1.9319199999999999 S1W=20.003000000000004 S2iW=20.000164375 a=2380.7392962875742 b=-0.03222957069862086 error_a=184998.5077522072 error_b=9.063057308166101
IncidentMedium=Si LambdaRequested=9.74 S1H=0.391 S2iH=0.24999999999999978 S1W=20.005 S2iW=20.000084375 a=0.9696521424239634 b=3.109825930777195e-06 error_a=233.25548699691095 error_b=0.005709869223821722
IncidentMedium=Si LambdaRequested=7.043 S1H=0.39 S2iH=0.24999999999999978 S1W=19.952000000000005 S2iW=19.950864375000002 a=7.888065990554204 b=-2.5851412589413515e-05 error_a=1054.563051347941 error_b=0.033950572631030344
IncidentMedium=Si LambdaRequested=4.25 S1H=0.39 S2iH=0.24999999999999978 S1W=8.779 S2iW=8.780164375000002 a=9.62385188352408 b=-5.570512058074805e-05 error_a=871.2007519922379 error_b=0.043472028815114895
IncidentMedium=Si LambdaRequested=4.25 S1H=0.39 S2iH=0.24999999999999978 S1W=20.002 S2iW=19.999844375000002 a=30.788530271881037 b=7.368170486421024e-05 error_a=3864.1491573285743 error_b=0.1924859170699873
IncidentMedium=Si LambdaRequested=4.25 S1H=0.77 S2iH=0.49312 S1W=12.489000000000004 S2iW=12.485564375000003 a=63.48718014559093 b=0.0001257591150576306 error_a=7921.015153325416 error_b=0.394555674637449
IncidentMedium=Si LambdaRequested=4.25 S1H=0.774 S2iH=0.4930399999999997 S1W=20.001000000000005 S2iW=20.000244375 a=128.62729619621012 b=-0.0002561652398998484 error_a=16762.476487369557 error_b=0.8226687408455199
IncidentMedium=Si LambdaRequested=4.25 S1H=1.525 S2iH=0.976 S1W=16.384000000000004 S2iW=16.395444375000004 a=369.7306065840916 b=0.0010537182539730222 error_a=52662.092278312455 error_b=2.599967726224994
IncidentMedium=Si LambdaRequested=4.25 S1H=1.528 S2iH=0.976 S1W=20.004 S2iW=20.000244375 a=489.54945849091285 b=-0.00023641838136746494 error_a=72046.19892232501 error_b=3.5158122875352493
IncidentMedium=Si LambdaRequested=4.25 S1H=3.016 S2iH=1.9319199999999999 S1W=20.003000000000004 S2iW=20.000164375 a=2761.264907784248 b=-0.05537054457130235 error_a=264191.38397000416 error_b=12.510086943391116
8 changes: 7 additions & 1 deletion reduction/lr_reduction/scaling_factors/LRScalingFactors.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,16 @@ def compute_dead_time_correction(self, ws, tof_min, tof_max, tof_step):
corr_ws = DeadTimeCorrection.call(InputWorkspace=ws,
InputErrorEventsWorkspace=error_ws,
Paralyzable=paralyzable,
TOFStep=tof_step,
DeadTime=deadtime,
TOFStep=deadtime_step,
TOFRange=[tof_min, tof_max],
OutputWorkspace="corr")

# Rebin to the workspace we need
corr_ws = Rebin(InputWorkspace=corr_ws, Params=[tof_min, tof_step, tof_max],
PreserveEvents=False, OutputWorkspace=str(corr_ws)
)

return corr_ws

def process_data(self, workspace, peak_range, background_range, low_res_range):
Expand Down
23 changes: 23 additions & 0 deletions reduction/test/test_scaling_factors.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,26 @@ def test_compute_sf_with_deadtime_tof_300(nexus_dir):

check_results(output_cfg, 'data/sf_197912_Si_dt_par_46_300.cfg')


def test_compute_sf_with_deadtime_tof_200(nexus_dir):
"""
Test the computation of scaling factors
"""
with amend_config(data_dir=nexus_dir):
ws = mtd_api.Load("REF_L_197912")

output_dir = '/tmp'

output_cfg = os.path.join(output_dir, "sf_197912_Si_test_dt.cfg")
if os.path.isfile(output_cfg):
os.remove(output_cfg)

output = sf_workflow.process_scaling_factors(ws, output_dir,
use_deadtime=True,
deadtime=4.6,
deadtime_tof_step=200,
paralyzable=False,
wait=False, postfix='_test_dt')
assert output is True

check_results(output_cfg, 'data/sf_197912_Si_dt_par_46_200.cfg')

0 comments on commit 4aea6b3

Please sign in to comment.