From e6243f554e49ee9017b7f3be699aa7560ac9014e Mon Sep 17 00:00:00 2001 From: Mathieu Doucet Date: Fri, 8 Mar 2024 09:02:08 -0500 Subject: [PATCH] fix algo import --- reduction/lr_reduction/event_reduction.py | 25 +++--- reduction/notebooks/workflow.ipynb | 99 +++++++++++------------ reduction/test/test_dead_time.py | 19 +++-- 3 files changed, 75 insertions(+), 68 deletions(-) diff --git a/reduction/lr_reduction/event_reduction.py b/reduction/lr_reduction/event_reduction.py index cecc5ed..b8d6dd7 100644 --- a/reduction/lr_reduction/event_reduction.py +++ b/reduction/lr_reduction/event_reduction.py @@ -7,6 +7,7 @@ import numpy as np from . import background +from . import DeadTimeCorrection def get_wl_range(ws): @@ -241,22 +242,22 @@ def get_dead_time_correction(self): tof_min = self._ws_sc.getTofMin() tof_max = self._ws_sc.getTofMax() - corr_ws = SingleReadoutDeadTimeCorrection(InputWorkspace=self._ws_sc, - DeadTime=self.DEAD_TIME, - TOFStep=self.DEAD_TIME_TOF_STEP, - Paralyzable=self.paralyzable, - TOFRange=[tof_min, tof_max], - OutputWorkspace="corr") + corr_ws = DeadTimeCorrection.call(InputWorkspace=self._ws_sc, + DeadTime=self.DEAD_TIME, + TOFStep=self.DEAD_TIME_TOF_STEP, + Paralyzable=self.paralyzable, + TOFRange=[tof_min, tof_max], + OutputWorkspace="corr") corr_sc = corr_ws.readY(0) wl_bins = corr_ws.readX(0) / self.constant # Direct beam workspace - corr_ws = SingleReadoutDeadTimeCorrection(InputWorkspace=self._ws_db, - DeadTime=self.DEAD_TIME, - TOFStep=self.DEAD_TIME_TOF_STEP, - Paralyzable=self.paralyzable, - TOFRange=[tof_min, tof_max], - OutputWorkspace="corr") + corr_ws = DeadTimeCorrection.call(InputWorkspace=self._ws_db, + DeadTime=self.DEAD_TIME, + TOFStep=self.DEAD_TIME_TOF_STEP, + Paralyzable=self.paralyzable, + TOFRange=[tof_min, tof_max], + OutputWorkspace="corr") corr_db = corr_ws.readY(0) # Flip the correction since we are going from TOF to Q diff --git a/reduction/notebooks/workflow.ipynb b/reduction/notebooks/workflow.ipynb index d22818c..ad7a840 100644 --- a/reduction/notebooks/workflow.ipynb +++ b/reduction/notebooks/workflow.ipynb @@ -12,11 +12,11 @@ "execution_count": 1, "metadata": { "execution": { - "iopub.execute_input": "2024-03-08T13:52:42.623917Z", - "iopub.status.busy": "2024-03-08T13:52:42.623510Z", - "iopub.status.idle": "2024-03-08T13:52:43.265412Z", - "shell.execute_reply": "2024-03-08T13:52:43.264674Z", - "shell.execute_reply.started": "2024-03-08T13:52:42.623896Z" + "iopub.execute_input": "2024-03-08T14:01:07.144441Z", + "iopub.status.busy": "2024-03-08T14:01:07.144070Z", + "iopub.status.idle": "2024-03-08T14:01:07.796688Z", + "shell.execute_reply": "2024-03-08T14:01:07.796054Z", + "shell.execute_reply.started": "2024-03-08T14:01:07.144422Z" }, "tags": [] }, @@ -44,11 +44,11 @@ "execution_count": 2, "metadata": { "execution": { - "iopub.execute_input": "2024-03-08T13:52:43.892833Z", - "iopub.status.busy": "2024-03-08T13:52:43.892493Z", - "iopub.status.idle": "2024-03-08T13:52:44.714217Z", - "shell.execute_reply": "2024-03-08T13:52:44.713558Z", - "shell.execute_reply.started": "2024-03-08T13:52:43.892815Z" + "iopub.execute_input": "2024-03-08T14:01:07.798312Z", + "iopub.status.busy": "2024-03-08T14:01:07.797810Z", + "iopub.status.idle": "2024-03-08T14:01:08.582215Z", + "shell.execute_reply": "2024-03-08T14:01:08.581745Z", + "shell.execute_reply.started": "2024-03-08T14:01:07.798293Z" }, "tags": [] }, @@ -72,11 +72,11 @@ "execution_count": 3, "metadata": { "execution": { - "iopub.execute_input": "2024-03-08T13:52:45.257468Z", - "iopub.status.busy": "2024-03-08T13:52:45.257039Z", - "iopub.status.idle": "2024-03-08T13:52:45.260505Z", - "shell.execute_reply": "2024-03-08T13:52:45.259968Z", - "shell.execute_reply.started": "2024-03-08T13:52:45.257448Z" + "iopub.execute_input": "2024-03-08T14:01:09.036645Z", + "iopub.status.busy": "2024-03-08T14:01:09.036400Z", + "iopub.status.idle": "2024-03-08T14:01:09.039159Z", + "shell.execute_reply": "2024-03-08T14:01:09.038760Z", + "shell.execute_reply.started": "2024-03-08T14:01:09.036625Z" }, "tags": [] }, @@ -100,17 +100,18 @@ "execution_count": 4, "metadata": { "execution": { - "iopub.execute_input": "2024-03-08T13:52:46.129304Z", - "iopub.status.busy": "2024-03-08T13:52:46.129130Z", - "iopub.status.idle": "2024-03-08T13:52:46.449310Z", - "shell.execute_reply": "2024-03-08T13:52:46.448362Z", - "shell.execute_reply.started": "2024-03-08T13:52:46.129288Z" + "iopub.execute_input": "2024-03-08T14:01:09.093272Z", + "iopub.status.busy": "2024-03-08T14:01:09.093063Z", + "iopub.status.idle": "2024-03-08T14:01:09.365008Z", + "shell.execute_reply": "2024-03-08T14:01:09.364410Z", + "shell.execute_reply.started": "2024-03-08T14:01:09.093256Z" }, "tags": [] }, "outputs": [], "source": [ "import importlib\n", + "import lr_reduction\n", "from lr_reduction import workflow\n", "from lr_reduction import template\n", "from lr_reduction import output\n", @@ -123,11 +124,11 @@ "execution_count": 5, "metadata": { "execution": { - "iopub.execute_input": "2024-03-08T13:52:48.067566Z", - "iopub.status.busy": "2024-03-08T13:52:48.067272Z", - "iopub.status.idle": "2024-03-08T13:53:03.315487Z", - "shell.execute_reply": "2024-03-08T13:53:03.314503Z", - "shell.execute_reply.started": "2024-03-08T13:52:48.067547Z" + "iopub.execute_input": "2024-03-08T14:01:09.366446Z", + "iopub.status.busy": "2024-03-08T14:01:09.365789Z", + "iopub.status.idle": "2024-03-08T14:01:25.807895Z", + "shell.execute_reply": "2024-03-08T14:01:25.806756Z", + "shell.execute_reply.started": "2024-03-08T14:01:09.366424Z" }, "tags": [] }, @@ -185,14 +186,14 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 6, "metadata": { "execution": { - "iopub.execute_input": "2024-03-07T18:54:38.824105Z", - "iopub.status.busy": "2024-03-07T18:54:38.823533Z", - "iopub.status.idle": "2024-03-07T18:54:48.835710Z", - "shell.execute_reply": "2024-03-07T18:54:48.834905Z", - "shell.execute_reply.started": "2024-03-07T18:54:38.824083Z" + "iopub.execute_input": "2024-03-08T14:01:25.811641Z", + "iopub.status.busy": "2024-03-08T14:01:25.811469Z", + "iopub.status.idle": "2024-03-08T14:01:28.335294Z", + "shell.execute_reply": "2024-03-08T14:01:28.334217Z", + "shell.execute_reply.started": "2024-03-08T14:01:25.811622Z" }, "tags": [] }, @@ -201,26 +202,22 @@ "name": "stdout", "output_type": "stream", "text": [ - "wl=4.25; ths=-0.599733; thi=-0.00812677; No offset\n", - "Background on both sides: [133 135] [148 150]\n", - "Dead time correction: [0.753782 -> 0.938569] at [0.0487517 -> 0.0220792]\n", - "Normalization options: True True\n", - "Template data was passed instead of a file path: template data not saved\n", - "wl=4.25; ths=-1.18271; thi=-0.00812677; No offset\n", - "Background on both sides: [133 135] [148 150]\n", - "Dead time correction: [0.749746 -> 0.92837] at [0.099448 -> 0.0441559]\n", - "Normalization options: True True\n", - "Template data was passed instead of a file path: template data not saved\n", - "wl=4.25; ths=-2.34284; thi=-0.00812677; No offset\n", - "Background on both sides: [131 133] [149 151]\n", - "Dead time correction: [0.753723 -> 0.937186] at [0.194985 -> 0.0865754]\n", - "Normalization options: True True\n", - "Template data was passed instead of a file path: template data not saved\n", - "wl=4.25; ths=-4.63906; thi=-0.00812677; No offset\n", - "Background on both sides: [131 133] [149 151]\n", - "Dead time correction: [0.7496 -> 0.928125] at [0.389949 -> 0.173141]\n", - "Normalization options: True True\n", - "Template data was passed instead of a file path: template data not saved\n" + "wl=4.25; ths=-0.599733; thi=-0.00812677; No offset\n" + ] + }, + { + "ename": "NameError", + "evalue": "name 'SingleReadoutDeadTimeCorrection' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[6], line 20\u001b[0m\n\u001b[1;32m 18\u001b[0m template_data \u001b[38;5;241m=\u001b[39m template\u001b[38;5;241m.\u001b[39mread_template(template_path, sequence_number)\n\u001b[1;32m 19\u001b[0m template_data\u001b[38;5;241m.\u001b[39mdead_time \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n\u001b[0;32m---> 20\u001b[0m \u001b[43mworkflow\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mreduce\u001b[49m\u001b[43m(\u001b[49m\u001b[43mws\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtemplate_data\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moutput_dir\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdata_dir\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43maverage_overlap\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/git/LiquidsReflectometer/reduction/lr_reduction/workflow.py:29\u001b[0m, in \u001b[0;36mreduce\u001b[0;34m(ws, template_file, output_dir, average_overlap, q_summing, bck_in_q, is_live, functional_background)\u001b[0m\n\u001b[1;32m 16\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 17\u001b[0m \u001b[38;5;124;03m Function called by reduce_REFL.py, which lives in /SNS/REF_L/shared/autoreduce\u001b[39;00m\n\u001b[1;32m 18\u001b[0m \u001b[38;5;124;03m and is called by the automated reduction workflow.\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 26\u001b[0m \u001b[38;5;124;03m along constant-Q lines rather than along TOF/pixel boundaries.\u001b[39;00m\n\u001b[1;32m 27\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 28\u001b[0m \u001b[38;5;66;03m# Call the reduction using the template\u001b[39;00m\n\u001b[0;32m---> 29\u001b[0m qz_mid, refl, d_refl, meta_data \u001b[38;5;241m=\u001b[39m \u001b[43mtemplate\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mprocess_from_template_ws\u001b[49m\u001b[43m(\u001b[49m\u001b[43mws\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtemplate_file\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 30\u001b[0m \u001b[43m \u001b[49m\u001b[43mq_summing\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mq_summing\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 31\u001b[0m \u001b[43m \u001b[49m\u001b[43mtof_weighted\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mq_summing\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 32\u001b[0m \u001b[43m \u001b[49m\u001b[43mclean\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mq_summing\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 33\u001b[0m \u001b[43m \u001b[49m\u001b[43mbck_in_q\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbck_in_q\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 34\u001b[0m \u001b[43m \u001b[49m\u001b[43mfunctional_background\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfunctional_background\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 35\u001b[0m \u001b[43m \u001b[49m\u001b[43minfo\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m 37\u001b[0m \u001b[38;5;66;03m# Save partial results\u001b[39;00m\n\u001b[1;32m 38\u001b[0m coll \u001b[38;5;241m=\u001b[39m output\u001b[38;5;241m.\u001b[39mRunCollection()\n", + "File \u001b[0;32m~/git/LiquidsReflectometer/reduction/lr_reduction/template.py:232\u001b[0m, in \u001b[0;36mprocess_from_template_ws\u001b[0;34m(ws_sc, template_data, q_summing, tof_weighted, bck_in_q, clean, info, normalize, theta_value, ws_db, functional_background)\u001b[0m\n\u001b[1;32m 218\u001b[0m event_refl \u001b[38;5;241m=\u001b[39m event_reduction\u001b[38;5;241m.\u001b[39mEventReflectivity(ws_sc, ws_db,\n\u001b[1;32m 219\u001b[0m signal_peak\u001b[38;5;241m=\u001b[39mpeak, signal_bck\u001b[38;5;241m=\u001b[39mpeak_bck,\n\u001b[1;32m 220\u001b[0m norm_peak\u001b[38;5;241m=\u001b[39mnorm_peak, norm_bck\u001b[38;5;241m=\u001b[39mnorm_bck,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 228\u001b[0m functional_background\u001b[38;5;241m=\u001b[39mfunctional_background,\n\u001b[1;32m 229\u001b[0m instrument\u001b[38;5;241m=\u001b[39mevent_reduction\u001b[38;5;241m.\u001b[39mEventReflectivity\u001b[38;5;241m.\u001b[39mINSTRUMENT_4B)\n\u001b[1;32m 231\u001b[0m \u001b[38;5;66;03m# R(Q)\u001b[39;00m\n\u001b[0;32m--> 232\u001b[0m qz, refl, d_refl \u001b[38;5;241m=\u001b[39m \u001b[43mevent_refl\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mspecular\u001b[49m\u001b[43m(\u001b[49m\u001b[43mq_summing\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mq_summing\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtof_weighted\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtof_weighted\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 233\u001b[0m \u001b[43m \u001b[49m\u001b[43mbck_in_q\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbck_in_q\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mclean\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mclean\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnormalize\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mnormalize\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 234\u001b[0m qz_mid \u001b[38;5;241m=\u001b[39m (qz[:\u001b[38;5;241m-\u001b[39m\u001b[38;5;241m1\u001b[39m] \u001b[38;5;241m+\u001b[39m qz[\u001b[38;5;241m1\u001b[39m:])\u001b[38;5;241m/\u001b[39m\u001b[38;5;241m2.0\u001b[39m\n\u001b[1;32m 236\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mNormalization options: \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m%\u001b[39m (normalize, template_data\u001b[38;5;241m.\u001b[39mscaling_factor_flag))\n", + "File \u001b[0;32m~/git/LiquidsReflectometer/reduction/lr_reduction/event_reduction.py:293\u001b[0m, in \u001b[0;36mEventReflectivity.specular\u001b[0;34m(self, q_summing, tof_weighted, bck_in_q, clean, normalize)\u001b[0m\n\u001b[1;32m 290\u001b[0m \u001b[38;5;66;03m# First, let's compute the dead-time correction if we need it\u001b[39;00m\n\u001b[1;32m 291\u001b[0m \u001b[38;5;66;03m# We do this first because the specular calls below may modify the input workspace\u001b[39;00m\n\u001b[1;32m 292\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdead_time:\n\u001b[0;32m--> 293\u001b[0m dead_time_corr \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_dead_time_correction\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 295\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m tof_weighted:\n\u001b[1;32m 296\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mspecular_weighted(q_summing\u001b[38;5;241m=\u001b[39mq_summing, bck_in_q\u001b[38;5;241m=\u001b[39mbck_in_q)\n", + "File \u001b[0;32m~/git/LiquidsReflectometer/reduction/lr_reduction/event_reduction.py:244\u001b[0m, in \u001b[0;36mEventReflectivity.get_dead_time_correction\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 241\u001b[0m tof_min \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_ws_sc\u001b[38;5;241m.\u001b[39mgetTofMin()\n\u001b[1;32m 242\u001b[0m tof_max \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_ws_sc\u001b[38;5;241m.\u001b[39mgetTofMax()\n\u001b[0;32m--> 244\u001b[0m corr_ws \u001b[38;5;241m=\u001b[39m \u001b[43mSingleReadoutDeadTimeCorrection\u001b[49m(InputWorkspace\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_ws_sc,\n\u001b[1;32m 245\u001b[0m DeadTime\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mDEAD_TIME,\n\u001b[1;32m 246\u001b[0m TOFStep\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mDEAD_TIME_TOF_STEP,\n\u001b[1;32m 247\u001b[0m Paralyzable\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mparalyzable,\n\u001b[1;32m 248\u001b[0m TOFRange\u001b[38;5;241m=\u001b[39m[tof_min, tof_max],\n\u001b[1;32m 249\u001b[0m OutputWorkspace\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcorr\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 250\u001b[0m corr_sc \u001b[38;5;241m=\u001b[39m corr_ws\u001b[38;5;241m.\u001b[39mreadY(\u001b[38;5;241m0\u001b[39m)\n\u001b[1;32m 251\u001b[0m wl_bins \u001b[38;5;241m=\u001b[39m corr_ws\u001b[38;5;241m.\u001b[39mreadX(\u001b[38;5;241m0\u001b[39m) \u001b[38;5;241m/\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mconstant\n", + "\u001b[0;31mNameError\u001b[0m: name 'SingleReadoutDeadTimeCorrection' is not defined" ] } ], diff --git a/reduction/test/test_dead_time.py b/reduction/test/test_dead_time.py index 462a17f..86fd71d 100644 --- a/reduction/test/test_dead_time.py +++ b/reduction/test/test_dead_time.py @@ -1,6 +1,6 @@ import os import numpy as np -#from lr_reduction.DeadTimeCorrection import SingleReadoutDeadTimeCorrection +from lr_reduction.DeadTimeCorrection import SingleReadoutDeadTimeCorrection import mantid import mantid.simpleapi as mtd_api @@ -18,8 +18,12 @@ def test_deadtime(nexus_dir): with amend_config(data_dir=nexus_dir): ws = mtd_api.Load("REF_L_198409") - corr_ws = SingleReadoutDeadTimeCorrection(InputWorkspace=ws) - + algo = SingleReadoutDeadTimeCorrection() + algo.PyInit() + algo.setProperty("InputWorkspace", ws) + algo.setProperty("OutputWorkspace", "dead_time_corr") + algo.PyExec() + corr_ws = algo.getProperty('OutputWorkspace').value corr = corr_ws.readY(0) for c in corr: assert(c>0) @@ -33,8 +37,13 @@ def test_deadtime_paralyzable(nexus_dir): with amend_config(data_dir=nexus_dir): ws = mtd_api.Load("REF_L_198409") - corr_ws = SingleReadoutDeadTimeCorrection(InputWorkspace=ws, - Paralyzable=True) + algo = SingleReadoutDeadTimeCorrection() + algo.PyInit() + algo.setProperty("InputWorkspace", ws) + algo.setProperty("Paralyzable", True) + algo.setProperty("OutputWorkspace", "dead_time_corr") + algo.PyExec() + corr_ws = algo.getProperty('OutputWorkspace').value corr = corr_ws.readY(0) with open("dc.txt", 'w') as fd: fd.write(str(corr))