Ticket #3377 (closed: fixed)

Opened 9 years ago

Last modified 5 years ago

Add a function to shift a log time by some number of proton pulses

Reported by: Russell Taylor Owned by: Peter Peterson
Priority: major Milestone: Iteration 30
Component: Mantid Keywords:
Cc: granrothge@… Blocked By:
Blocking: Tester: Michael Reuter

Description

From Garrett:

I need a function that changes a log time by a number of n proton pulses. This is not equivalent to shift by an amount of time as the time between proton pulses is not constant as the source frequency varies.

Attachments

ShiftLogTime.png​ (298.5 KB) - added by Vickie Lynch 9 years ago.

Change History

comment:1 Changed 9 years ago by Russell Taylor

  • Status changed from new to assigned
  • Owner set to Peter Peterson
  • Cc granrothge@… added

For info, the script that Garrett is currently using to diagnose this. Apparently, Jim also has some code that does what's required.

import numpy as np
runnums=[10304,10305]
subrun=[2,1]

idx=0
wkspcnms=[]
for rn in runnums:
    datafile="/SNS/SEQ/IPTS-3786/data/SEQ_%d_event.nxs" %rn
    chopfile="/SNS/SEQ/IPTS-3786/shared/chop_data/chopper_%d_%d.dat" %(rn,subrun[idx])
    pulseidfile="/SNS/SEQ/IPTS-3786/0/%d/preNeXus/SEQ_%d_pulseid.dat" %(rn,rn)
    wkspcnms.append("SEQ_%d_event" %rn)    
    Load(Filename=datafile,OutputWorkspace=wkspcnms[idx],LoadMonitors="1")
    LoadLogsForSNSPulsedMagnet(Workspace=wkspcnms[idx],DelayTimeFilename=chopfile,PulseIDFilename=pulseidfile)
    idx=idx+1
Plus(wkspcnms[0],wkspcnms[1],"sum_raw")

time_shifts=np.arange(-3.,4.)
for shft in time_shifts:
    shft_wks="sum_%g" %shft
    on_wks="on_%g" %shft
    grp_wks="grp_%g" %shft
    det_1_wks="det_1%g" %shft
    sum_wks="one_spec%g" %shft
    time_off=str(shft*16.6667e-3)
    grp_lst=range(60481,60488)
    grp_lst.extend(range(60609,60617))
    grp_lst.extend(range(60738,60744))
    det1lst=range(60609,60617)
    ChangePulsetime("sum_raw",shft_wks,TimeOffset=time_off)
    FilterByLogValue(InputWorkspace=shft_wks,OutputWorkspace=on_wks,LogName="PulsedMagnetDelay3",MinimumValue="8000",MaximumValue="10000",TimeTolerance="0.009",LogBoundary="Left")
    ConvertUnits(InputWorkspace=on_wks,OutputWorkspace=on_wks,Target="dSpacing")
    Rebin(InputWorkspace=on_wks,OutputWorkspace=on_wks,Params="0.8,0.02,9",PreserveEvents="0")
    GroupDetectors(InputWorkspace=on_wks,OutputWorkspace=grp_wks,WorkspaceIndexList=grp_lst)
    GroupDetectors(InputWorkspace=on_wks,OutputWorkspace=det_1_wks,WorkspaceIndexList=det1lst)
    SumSpectra(InputWorkspace=grp_wks,OutputWorkspace=sum_wks,IncludeMonitors="0")
    SumSpectra(InputWorkspace=det_1_wks,OutputWorkspace=det_1_wks,IncludeMonitors="0")

comment:2 Changed 9 years ago by Peter Peterson

In [14305]:

Adding another function to allow changing timeseriesproperties a bit faster. Refs #3377.

comment:3 Changed 9 years ago by Peter Peterson

In [14306]:

Adding the new algorithm for shifting log times. Refs #3377.

comment:4 Changed 9 years ago by Peter Peterson

  • Status changed from assigned to accepted

comment:5 Changed 9 years ago by Peter Peterson

  • Status changed from accepted to verify
  • Resolution set to fixed

As far as I know the last commit fixed it.

comment:6 Changed 9 years ago by Vickie Lynch

  • Status changed from verify to verifying
  • Tester set to Vickie Lynch

Changed 9 years ago by Vickie Lynch

comment:7 Changed 9 years ago by Vickie Lynch

When I execute ShiftLogTime, the resulting log starts at the same time, but is shorted by 7813 indices. Maybe I did something wrong since the test works. See attached screenshot.

comment:8 Changed 9 years ago by Vickie Lynch

  • Status changed from verifying to verify
  • Tester Vickie Lynch deleted

comment:9 Changed 9 years ago by Michael Reuter

  • Status changed from verify to verifying
  • Tester set to Michael Reuter

comment:10 Changed 9 years ago by Michael Reuter

  • Status changed from verifying to closed

I discussed this with Pete and this is the exact behavior expected from the algorithm.

comment:11 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue ​4224

Note: See TracTickets for help on using tickets.