1 | from mantid.simpleapi import * |
---|
2 | import ISISCommandInterface as ici |
---|
3 | import isis_instrument |
---|
4 | |
---|
5 | # create a dummy instrument setup, here starting up with LARMOR |
---|
6 | # the values below are probably somewhat ga ga |
---|
7 | class BILBY(isis_instrument.LARMOR): |
---|
8 | WAV_RANGE_MIN = 2.5 |
---|
9 | WAV_RANGE_MAX = 12.0 |
---|
10 | |
---|
11 | def on_load_sample(self, ws_name, beamcentre, isSample): |
---|
12 | print ws_name |
---|
13 | ws = mtd[ws_name] |
---|
14 | out = Rebin(ws, '30500,500,38500', False) |
---|
15 | RenameWorkspace(out, OutputWorkspace=ws_name) |
---|
16 | def setDetector(self, name): |
---|
17 | bank = self.get_low_angle_detector() |
---|
18 | bank._shape = bank._DectShape(20, 3072, True, 61440) |
---|
19 | bank.set_first_spec_num(0) |
---|
20 | return self.setDefaultDetector() |
---|
21 | def get_TOFs(self, nm): |
---|
22 | return 30500, 38500 |
---|
23 | def move_components(self, ws, bx, by): |
---|
24 | return [0,0], [-bx, -by] |
---|
25 | |
---|
26 | def curr_detector_position(self, ws_name): |
---|
27 | return [0,0] |
---|
28 | |
---|
29 | ici.ReductionSingleton().set_instrument(BILBY()) |
---|
30 | |
---|
31 | # load a random mask file |
---|
32 | ici.MaskFile('MaskSANS2DReductionGUI.txt') |
---|
33 | |
---|
34 | # load mcstas event data |
---|
35 | ici.AssignSample('BBY0000014.tar') |
---|
36 | |
---|
37 | # set detector. PLEASE NOTE IT WOULD BE BETTER IF LoadBBY ASSSIGNED SOME |
---|
38 | # UNIQUE NAME FOR EACH BANK |
---|
39 | ici.Detector('bank') |
---|
40 | |
---|
41 | # manual set sample info since this is not set in this nexus file |
---|
42 | # This is NOT PRETTY. BETTER IF THE LoadBBY add sample information |
---|
43 | # Here just done as below for testing |
---|
44 | ici.ReductionSingleton().get_sample().geometry.height = 1.0 |
---|
45 | ici.ReductionSingleton().get_sample().geometry.width = 1.0 |
---|
46 | ici.ReductionSingleton().get_sample().geometry.thickness = 1.0 |
---|
47 | print ici.ReductionSingleton().get_sample().geometry.shape |
---|
48 | print ici.ReductionSingleton().get_sample().geometry.height |
---|
49 | print ici.ReductionSingleton().get_sample().geometry.width |
---|
50 | print ici.ReductionSingleton().get_sample().geometry.thickness |
---|
51 | |
---|
52 | ici.WavRangeReduction(2.2, 12 ) |
---|