当前位置: 首页>>代码示例>>Python>>正文


Python SANSadd2.add_runs方法代码示例

本文整理汇总了Python中SANSadd2.add_runs方法的典型用法代码示例。如果您正苦于以下问题:Python SANSadd2.add_runs方法的具体用法?Python SANSadd2.add_runs怎么用?Python SANSadd2.add_runs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SANSadd2的用法示例。


在下文中一共展示了SANSadd2.add_runs方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: runTest

# 需要导入模块: import SANSadd2 [as 别名]
# 或者: from SANSadd2 import add_runs [as 别名]
    def runTest(self):

        i.SANS2DTUBES()
        i.MaskFile('USER_SANS2D_143ZC_2p4_4m_M4_Knowles_12mm.txt')
        i.SetDetectorOffsets('REAR', -16.0, 58.0, 0.0, 0.0, 0.0, 0.0)
        i.SetDetectorOffsets('FRONT', -44.0, -20.0, 47.0, 0.0, 1.0, 1.0)
        i.Gravity(False)
        i.Set1D()

        # add files (SAMPLE and CAN)
        time_shifts=[1]
        import SANSadd2
        SANSadd2.add_runs(('28827','28797'),'SANS2DTUBES', '.nxs',
                          rawTypes=('.add','.raw','.s*'), lowMem=False,
                          saveAsEvent=True, isOverlay = True, time_shifts = time_shifts)
        SANSadd2.add_runs(('28823','28793'),'SANS2DTUBES', '.nxs',
                          rawTypes=('.add','.raw','.s*'), lowMem=False,
                          saveAsEvent=True, isOverlay = True, time_shifts = time_shifts)

        i.AssignSample(r'SANS2D00028797-add.nxs', reload = True)
        i.AssignCan(r'SANS2D00028793-add.nxs', reload = True)
        i.TransmissionSample(r'SANS2D00028808.nxs', r'SANS2D00028784.nxs')
        i.TransmissionCan(r'SANS2D00028823.nxs', r'SANS2D00028784.nxs')

        i.WavRangeReduction()
开发者ID:DanNixon,项目名称:mantid,代码行数:27,代码来源:SANS2DReductionGUIAdded.py

示例2: runTest

# 需要导入模块: import SANSadd2 [as 别名]
# 或者: from SANSadd2 import add_runs [as 别名]
    def runTest(self):
    #here we are testing the LOQ setup
        ici.LOQ()
    #rear detector
        ici.Detector("main-detector-bank")
    #test batch mode, although only the analysis from the last line is checked
    # Find the file , this should really be in the BatchReduce reduction step

        f = open(self.csv_file,'w')
        print("sample_sans,99630-add,output_as, %s"%self.output_file, file=f)
        f.close()
        runnum = '99630'
        sansadd.add_runs((runnum, runnum),'LOQ','.RAW')

        ici.Set1D()
        ici.MaskFile('MASK.094AA')
        batch.BatchReduce(self.csv_file, 'nxs', plotresults=False, saveAlgs={'SaveNexus':'nxs'})

        print(' reduction without')

        ici._refresh_singleton()

        ici.LOQ()
        ici.Detector("main-detector-bank")
        ici.Set1D()
        ici.MaskFile('MASK.094AA')
        LOQ99630 = Load(runnum)
        LOQ99630 += LOQ99630
        ici.AssignSample(LOQ99630, reload=False)
        self.result = ici.WavRangeReduction()
开发者ID:DanNixon,项目名称:mantid,代码行数:32,代码来源:LOQAddBatch.py

示例3: test_that_subtracts_correct_added_file_type

# 需要导入模块: import SANSadd2 [as 别名]
# 或者: from SANSadd2 import add_runs [as 别名]
    def test_that_subtracts_correct_added_file_type(self):
        # Arrange
        use_time = False
        use_mean = False
        use_mon = False
        mon_number = None

        # Create added workspace and have it saved out
        import SANSadd2
        SANSadd2.add_runs(('SANS2D00028827_removed_spectra.nxs','SANS2D00028797_removed_spectra.nxs'),'SANS2DTUBES', '.nxs',
                          rawTypes=('.add','.raw','.s*'), lowMem=False,
                          saveAsEvent=True, isOverlay = False)
        run_number = r'SANS2D00028797_removed_spectra-add.nxs'
        settings = []
        setting = self._get_dark_run_settings_object(run_number, use_time, use_mean, use_mon, mon_number)
        settings.append(setting)

        # Act + Assert
        is_event_ws = True
        scatter_workspace, monitor_workspace = self._do_test_valid(settings, is_event_ws, run_number)
        expected_num_spectr_ws = 20 - 9 + 1
        self.assertTrue(scatter_workspace.getNumberHistograms() == expected_num_spectr_ws, "Should have 8 spectra")

        # Since in this test we use the same file for the scatterer and the dark run, we expect
        # that the detectors are 0. This is because we subtract bin by bin when using UAMP
        all_entries_zero = lambda ws, index : all([0.0 == element for element in ws.dataY(index)])

        for i in range(0, scatter_workspace.getNumberHistograms()):
            self.assertTrue(all_entries_zero(scatter_workspace, i), "Detector entries should all be 0")

        # The monitors should not be affected, but we only have data in ws_index 0-3
        for i in [0,3]:
            self.assertFalse(all_entries_zero(monitor_workspace, i), "Monitor entries should not all be 0")

        os.remove(os.path.join(config['defaultsave.directory'],run_number))
开发者ID:Mantid-Test-Account,项目名称:mantid,代码行数:37,代码来源:SANSDarkRunSubtractionTest.py

示例4: runTest

# 需要导入模块: import SANSadd2 [as 别名]
# 或者: from SANSadd2 import add_runs [as 别名]
 def runTest(self):
     # created after issue reported in #8156
     ws = Load('LOQ54432')
     self.assertTrue('Data/SystemTest/LOQ/LOQ54432.raw' in unixLikePathFromWorkspace(ws))
     ws = Load('LOQ99618.RAW')
     self.assertTrue('Data/SystemTest/LOQ/LOQ99618.RAW' in unixLikePathFromWorkspace(ws))
     add.add_runs(('LOQ54432','LOQ54432'),'LOQ','.raw')
     ws = Load('LOQ54432-add')
     file_path =  unixLikePathFromWorkspace(ws)
     logger.information("File Path from -add: "+str(file_path))
     file_path = file_path.replace('-ADD','-add') # MAC seems to report that the file is LOQ54432-ADD.nxs
     self.assertTrue('LOQ54432-add' in file_path)
     os.remove(file_path)
开发者ID:mantidproject,项目名称:mantid,代码行数:15,代码来源:LOQSANSUtilityTest.py

示例5: test_that_subtracts_correct_added_file_type_when_only_monitor_subtracted

# 需要导入模块: import SANSadd2 [as 别名]
# 或者: from SANSadd2 import add_runs [as 别名]
    def test_that_subtracts_correct_added_file_type_when_only_monitor_subtracted(self):
        # Arrange
        use_time = False
        use_mean = False
        use_mon = True
        mon_number = [2] # We are selecting detector ID 2 this corresponds to workspace index 1
        ws_index = [1]

        # Create added workspace and have it saved out
        import SANSadd2
        SANSadd2.add_runs(('SANS2D00028827_removed_spectra.nxs','SANS2D00028797_removed_spectra.nxs'),'SANS2DTUBES', '.nxs',
                          rawTypes=('.add','.raw','.s*'), lowMem=False,
                          saveAsEvent=True, isOverlay = False)
        run_number = r'SANS2D00028797_removed_spectra-add.nxs'
        settings = []
        setting = self._get_dark_run_settings_object(run_number, use_time, use_mean, use_mon, mon_number)
        settings.append(setting)

        # Act + Assert
        is_event_ws = True
        scatter_workspace, monitor_workspace = self._do_test_valid(settings, is_event_ws, run_number)

        expected_num_spectr_ws = 20 - 9 + 1 # Total number of spectra in the original workspace from 9 to 245798
        self.assertTrue(scatter_workspace.getNumberHistograms() == expected_num_spectr_ws, "Should have 8 spectra")

        # Since in this test we use the same file for the scatterer and the dark run, we expect
        # that the detectors are 0. This is because we subtract bin by bin when using UAMP
        all_entries_zero = lambda ws, index : all([0.0 == element for element in ws.dataY(index)])

        # Some spectra might be zero, so we have to check that there is something which is not zero
        all_detectors_zero = True
        for i in range(0, scatter_workspace.getNumberHistograms()):
            all_detectors_zero = all_detectors_zero & all_entries_zero(scatter_workspace, i)
        self.assertFalse(all_detectors_zero, "There should be some detectors which are not zero")

        # The monitors should not be affected, but we only have data in ws_index 0-3
        for i in [0,2,3]:
            self.assertFalse(all_entries_zero(monitor_workspace, i), "Monitor1, Monitor3, Monitor4 entries should not all be 0")

        # Monitor 2 (workspace index 1 should be 0
        for i in ws_index:
            self.assertTrue(all_entries_zero(monitor_workspace, i), "Monitor2 entries should  all be 0")

        os.remove(os.path.join(config['defaultsave.directory'],run_number))
开发者ID:Mantid-Test-Account,项目名称:mantid,代码行数:46,代码来源:SANSDarkRunSubtractionTest.py

示例6: run

# 需要导入模块: import SANSadd2 [as 别名]
# 或者: from SANSadd2 import add_runs [as 别名]
    def run(self, run_selection, settings, base_file_name):
        run_selection = self._run_selection_as_path_list(run_selection)
        binning = self._bin_settings_or_monitors(settings)
        additional_time_shifts = self._time_shifts_or_empty_string(settings)
        overlay_event_workspaces = self._is_overlay_event_workspaces_enabled(settings)
        save_as_event = self._should_save_as_event_workspaces(settings)

        file_name = base_file_name + '.nxs'
        monitors_file_name = base_file_name + '_monitors.nxs'

        SANSadd2.add_runs(
            tuple(run_selection),
            settings.instrument(),
            lowMem=True,
            binning=binning,
            isOverlay=overlay_event_workspaces,
            saveAsEvent=save_as_event,
            time_shifts=additional_time_shifts,
            outFile=file_name,
            outFile_monitors=monitors_file_name)
开发者ID:DanNixon,项目名称:mantid,代码行数:22,代码来源:run_summation.py

示例7: runTest

# 需要导入模块: import SANSadd2 [as 别名]
# 或者: from SANSadd2 import add_runs [as 别名]
    def runTest(self):
        UseCompatibilityMode()
        SANS2DTUBES()
        MaskFile('USER_SANS2D_143ZC_2p4_4m_M4_Knowles_12mm.txt')
        SetDetectorOffsets('REAR', -16.0, 58.0, 0.0, 0.0, 0.0, 0.0)
        SetDetectorOffsets('FRONT', -44.0, -20.0, 47.0, 0.0, 1.0, 1.0)
        Gravity(False)
        Set1D()

        # add files (SAMPLE and CAN)
        SANSadd2.add_runs(('28827', '28797'), 'SANS2DTUBES', '.nxs',
                          rawTypes=('.add', '.raw', '.s*'), lowMem=False,
                          saveAsEvent=True, isOverlay=False)
        SANSadd2.add_runs(('28823', '28793'), 'SANS2DTUBES', '.nxs',
                          rawTypes=('.add', '.raw', '.s*'), lowMem=False,
                          saveAsEvent=True, isOverlay=False)

        AssignSample(r'SANS2D00028797-add.nxs', reload=True)
        AssignCan(r'SANS2D00028793-add.nxs', reload=True)
        TransmissionSample(r'SANS2D00028808.nxs', r'SANS2D00028784.nxs')
        TransmissionCan(r'SANS2D00028823.nxs', r'SANS2D00028784.nxs')

        WavRangeReduction()
开发者ID:DanNixon,项目名称:mantid,代码行数:25,代码来源:SANS2DReductionGUIAddedTest_V2.py

示例8: SaveNexusProcessed

# 需要导入模块: import SANSadd2 [as 别名]
# 或者: from SANSadd2 import add_runs [as 别名]
# rotating SDS 6m data
SANSadd999.add_runs(path, [769,776,782])
SaveNexusProcessed("added","c:/mantidinstall/data/SANS2d10000782.nxs")


# 17/03/10 new version of adding files, writes to U:/user/processed which should be in search list, see notes in SANSadd2.py
# to find SANSadd2 may need 
import sys
sys.path.append("U:/Mantidscripts")
print sys.path
import SANSadd2

path="O:/cycle_09_5/"
path="I:/"
# 6m data
SANSadd2.add_runs(path, [3333,3339])
#SaveNexusProcessed("added","i:/SANS2d00003362-add.nxs")



import SANSadd

#path="//isis/inst$/NDXSANS2D/Instrument/cycle_09_4/"
path="N:/cycle_09_5/"
#path="I:/"
# 6m data
SANSadd.add_runs(path, [3323,3362])
SaveNexusProcessed("added","i:/SANS2d00003362-add.nxs")
SANSadd.add_runs(path, [3324,3327])
SaveNexusProcessed("added","i:/SANS2d00003327-add.nxs")
开发者ID:mantidproject,项目名称:scripts,代码行数:32,代码来源:SANSuseful8_varifocal_4m_Stone_alloy.py

示例9: SaveNexusProcessed

# 需要导入模块: import SANSadd2 [as 别名]
# 或者: from SANSadd2 import add_runs [as 别名]
# rotating SDS 6m data
SANSadd999.add_runs(path, [769,776,782])
SaveNexusProcessed("added","c:/mantidinstall/data/SANS2d10000782.nxs")


# 17/03/10 new version of adding files, writes to U:/user/processed which should be in search list, see notes in SANSadd2.py
# to find SANSadd2 may need 
import sys
sys.path.append("U:/Mantidscripts")
print sys.path
import SANSadd2

path="O:/cycle_09_5/"
path="I:/"
# 6m data
SANSadd2.add_runs(path, [3333,3339])
#SaveNexusProcessed("added","i:/SANS2d00003362-add.nxs")


# new version, simpler, writes to z:/processed/sans2d/
# beware, not passing these params through ????
path="X:/"
import SANSadd2
SANSadd2.add_runs(path,[11971,11980,11984])


# MUST DO THIS BEFORE CREATING     D_T     ELSE SUMSPECTRA FLAGS AN ERROR!  
from ISISCommandInterface import *
from math import *

wksp="12364_sans_nxs"
开发者ID:mantidproject,项目名称:scripts,代码行数:33,代码来源:SANSuseful12A_varifocal_6p5m_polymer.py


注:本文中的SANSadd2.add_runs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。