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


Python FileFinder.getFullPath方法代码示例

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


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

示例1: _run

# 需要导入模块: from mantid.api import FileFinder [as 别名]
# 或者: from mantid.api.FileFinder import getFullPath [as 别名]
    def _run(self):
        '''Defines the workflow for the test'''
        self.tolerance = 1e-3
        self.samples = [sample[:-4] for sample in self.samples]

        # Load files into Mantid
        for sample in self.samples:
            LoadNexus(sample, OutputWorkspace=sample)
        LoadNexus(FileFinder.getFullPath(self.resolution), OutputWorkspace=self.resolution)

        _, iqt_ws = TransformToIqt(SampleWorkspace=self.samples[0],
                                   ResolutionWorkspace=self.resolution,
                                   EnergyMin=self.e_min,
                                   EnergyMax=self.e_max,
                                   BinReductionFactor=self.num_bins,
                                   DryRun=False,
                                   NumberOfIterations=200)

        # Test IqtFit Sequential
        iqtfitSeq_ws, params, fit_group = IqtFitSequential(InputWorkspace=iqt_ws, Function=self.func,
                                                           StartX=self.startx, EndX=self.endx,
                                                           SpecMin=0, SpecMax=self.spec_max)

        self.result_names = [iqt_ws.name(),
                             iqtfitSeq_ws[0].name()]

        # Remove workspaces from Mantid
        for sample in self.samples:
            DeleteWorkspace(sample)
        DeleteWorkspace(params)
        DeleteWorkspace(fit_group)
        DeleteWorkspace(self.resolution)
开发者ID:samueljackson92,项目名称:mantid,代码行数:34,代码来源:ISISIndirectInelastic.py

示例2: _create_peaks_workspace

# 需要导入模块: from mantid.api import FileFinder [as 别名]
# 或者: from mantid.api.FileFinder import getFullPath [as 别名]
    def _create_peaks_workspace(self):
        """Create a dummy peaks workspace"""
        path = FileFinder.getFullPath("IDFs_for_UNIT_TESTING/MINITOPAZ_Definition.xml")
        inst = LoadEmptyInstrument(Filename=path)
        ws = CreatePeaksWorkspace(inst, 0)
        DeleteWorkspace(inst)
        SetUB(ws, 1, 1, 1, 90, 90, 90)

        # Add a bunch of random peaks that happen to fall on the
        # detetor bank defined in the IDF
        center_q = np.array([-5.1302,2.5651,3.71809])
        qs = []
        for i in np.arange(0, 1, 0.1):
            for j in np.arange(-0.5, 0, 0.1):
                q = center_q.copy()
                q[1] += j
                q[2] += i
                qs.append(q)

        # Add the peaks to the PeaksWorkspace with dummy values for intensity,
        # Sigma, and HKL
        for q in qs:
            peak = ws.createPeak(q)
            peak.setIntensity(100)
            peak.setSigmaIntensity(10)
            peak.setHKL(1, 1, 1)
            ws.addPeak(peak)

        return ws
开发者ID:DanNixon,项目名称:mantid,代码行数:31,代码来源:SaveReflectionsTest.py

示例3: cleanup

# 需要导入模块: from mantid.api import FileFinder [as 别名]
# 或者: from mantid.api.FileFinder import getFullPath [as 别名]
 def cleanup(self):
     Files = ["TOPAZ_3132.hkl",
     "TOPAZ_3132FFT.hkl"]
     for file in Files:
         absfile = FileFinder.getFullPath(file)
         if os.path.exists(absfile):
             os.remove(absfile)
     return True
开发者ID:nimgould,项目名称:mantid,代码行数:10,代码来源:Diffraction_Workflow_Test.py

示例4: find_data

# 需要导入模块: from mantid.api import FileFinder [as 别名]
# 或者: from mantid.api.FileFinder import getFullPath [as 别名]
def find_data(file, instrument='', allow_multiple=False):
    """
        Finds a file path for the specified data set, which can either be:
            - a run number
            - an absolute path
            - a file name
        @param file: file name or part of a file name
        @param instrument: if supplied, FindNeXus will be tried as a last resort
    """
    # First, assume a file name
    file = str(file).strip()

    # If we allow multiple files, users may use ; as a separator,
    # which is incompatible with the FileFinder
    n_files = 1
    if allow_multiple:
        file=file.replace(';',',')
        toks = file.split(',')
        n_files = len(toks)

    instrument = str(instrument)
    file_path = FileFinder.getFullPath(file)
    if os.path.isfile(file_path):
        return file_path

    # Second, assume a run number and pass the instrument name as a hint
    try:
        # FileFinder doesn't like dashes...
        instrument=instrument.replace('-','')
        f = FileFinder.findRuns(instrument+file)
        if os.path.isfile(f[0]):
            if allow_multiple:
                # Mantid returns its own list object type, so make a real list out if it
                if len(f)==n_files:
                    return [i for i in f]
            else:
                return f[0]
    except:
        # FileFinder couldn't make sense of the the supplied information
        pass

    # Third, assume a run number, without instrument name to take care of list of full paths
    try:
        f = FileFinder.findRuns(file)
        if os.path.isfile(f[0]):
            if allow_multiple:
                # Mantid returns its own list object type, so make a real list out if it
                if len(f)==n_files:
                    return [i for i in f]
            else:
                return f[0]
    except:
        # FileFinder couldn't make sense of the the supplied information
        pass

    # If we didn't find anything, raise an exception
    Logger('find_data').error("\n\nCould not find a file for %s: check your reduction parameters\n\n" % str(file))
    raise RuntimeError("Could not find a file for %s" % str(file))
开发者ID:DanNixon,项目名称:mantid,代码行数:60,代码来源:find_data.py

示例5: do_cleanup

# 需要导入模块: from mantid.api import FileFinder [as 别名]
# 或者: from mantid.api.FileFinder import getFullPath [as 别名]
def do_cleanup():
    Files = ["PG3_9829.gsa",
    "PG3_9829.py",
    "PG3_9830.gsa",
    "PG3_9830.py"]
    for file in Files:
        absfile = FileFinder.getFullPath(file)
        if os.path.exists(absfile):
            os.remove(absfile)
    return True
开发者ID:mantidproject,项目名称:systemtests,代码行数:12,代码来源:SNSPowderRedux.py

示例6: do_cleanup

# 需要导入模块: from mantid.api import FileFinder [as 别名]
# 或者: from mantid.api.FileFinder import getFullPath [as 别名]
def do_cleanup():
    Files = ["BioSANS_test_data_reduction.log",
             "BioSANS_test_data_Iq.xml",
             "BioSANS_test_data_Iq.txt",
             "BioSANS_test_data_Iqxy.dat"]
    for filename in Files:
        absfile = FileFinder.getFullPath(filename)
        if os.path.exists(absfile):
            os.remove(absfile)
    return True
开发者ID:DanNixon,项目名称:mantid,代码行数:12,代码来源:HFIREffAPIv2.py

示例7: runTest

# 需要导入模块: from mantid.api import FileFinder [as 别名]
# 或者: from mantid.api.FileFinder import getFullPath [as 别名]
    def runTest(self):
        UseCompatibilityMode()
        SANS2D()
        Set1D()
        Detector("rear-detector")
        MaskFile('MASKSANS2Doptions.091A')
        Gravity(True)

        csv_file = FileFinder.getFullPath('SANS2D_periodTests.csv')

        BatchReduce(csv_file, 'nxs', plotresults=False, saveAlgs={'SaveCanSAS1D': 'xml', 'SaveNexus': 'nxs'})
        os.remove(os.path.join(config['defaultsave.directory'], '5512p7_SANS2DBatch.xml'))
开发者ID:DanNixon,项目名称:mantid,代码行数:14,代码来源:SANS2DBatchTest_V2.py

示例8: runTest

# 需要导入模块: from mantid.api import FileFinder [as 别名]
# 或者: from mantid.api.FileFinder import getFullPath [as 别名]
    def runTest(self):
        UseCompatibilityMode()
        SANS2D()
        Set1D()
        Detector("rear-detector")
        MaskFile('MASKSANS2Doptions.091A')
        Gravity(True)

        csv_file = FileFinder.getFullPath('SANS2D_multiPeriodTests.csv')

        BatchReduce(csv_file, 'nxs', saveAlgs={})
        self.reduced = '5512_SANS2DBatch'
开发者ID:DanNixon,项目名称:mantid,代码行数:14,代码来源:SANS2DMultiPeriod_V2.py

示例9: __init__

# 需要导入模块: from mantid.api import FileFinder [as 别名]
# 或者: from mantid.api.FileFinder import getFullPath [as 别名]
    def __init__(self):
        ISISIndirectInelasticConvFit.__init__(self)
        self.sample = 'osi97935_graphite002_red.nxs'
        self.resolution = FileFinder.getFullPath('osi97935_graphite002_res.nxs')
        #ConvFit fit function
        self.func = 'name=LinearBackground,A0=0,A1=0;(composite=Convolution,FixResolution=true,NumDeriv=true;'\
                    'name=Resolution,Workspace=\"%s\";name=Lorentzian,Amplitude=2,PeakCentre=0,FWHM=0.05)' % self.resolution
        self.startx = -0.2
        self.endx = 0.2
        self.bg = 'Fit Linear'
        self.spectra_min = 0
        self.spectra_max = 41
        self.ties = False

        self.result_names = ['osi97935_graphite002_conv_1LFitL_s0_to_41_Result']
开发者ID:liyulun,项目名称:mantid,代码行数:17,代码来源:ISISIndirectInelastic.py

示例10: __verifyRequiredFile

# 需要导入模块: from mantid.api import FileFinder [as 别名]
# 或者: from mantid.api.FileFinder import getFullPath [as 别名]
    def __verifyRequiredFile(self, filename):
        '''Return True if the specified file name is findable by Mantid.'''
        from mantid.api import FileFinder

        # simple way is just getFullPath which never uses archive search
        if os.path.exists(FileFinder.getFullPath(filename)):
            return True

        # try full findRuns which will use archive search if it is turned on
        try:
            candidates = FileFinder.findRuns(filename)
            for item in candidates:
                if os.path.exists(item):
                    return True
        except RuntimeError, e:
            return False
开发者ID:mantidproject,项目名称:systemtests,代码行数:18,代码来源:stresstesting.py

示例11: do_cleanup

# 需要导入模块: from mantid.api import FileFinder [as 别名]
# 或者: from mantid.api.FileFinder import getFullPath [as 别名]
def do_cleanup():
    Files = ["PG3_9829.getn",
             "PG3_9829.gsa",
             "PG3_9829.py",
             'sum_PG3_9829.gsa',
             'sum_PG3_9829.py',
             "PG3_9830.gsa",
             "PG3_9830.py",
             "PG3_4844-1.dat",
             "PG3_4844.getn",
             "PG3_4844.gsa",
             "PG3_4844.py",
             "PG3_4866.gsa"]
    for filename in Files:
        absfile = FileFinder.getFullPath(filename)
        if os.path.exists(absfile):
            os.remove(absfile)
    return True
开发者ID:samueljackson92,项目名称:mantid,代码行数:20,代码来源:SNSPowderRedux.py

示例12: runTest

# 需要导入模块: from mantid.api import FileFinder [as 别名]
# 或者: from mantid.api.FileFinder import getFullPath [as 别名]
    def runTest(self):
        UseCompatibilityMode()
        LOQ()
        Detector("main-detector-bank")
        csv_file = FileFinder.getFullPath('batch_input.csv')

        Set1D()
        MaskFile('MASK.094AA')
        Gravity(True)

        BatchReduce(csv_file, 'raw', plotresults=False, saveAlgs={'SaveCanSAS1D': 'xml', 'SaveNexus': 'nxs'})

        LoadNexus(Filename='54433sans.nxs', OutputWorkspace='result')
        Plus(LHSWorkspace='result', RHSWorkspace='99630sanotrans', OutputWorkspace= 'result')

        os.remove(os.path.join(config['defaultsave.directory'],'54433sans.nxs'))
        os.remove(os.path.join(config['defaultsave.directory'],'99630sanotrans.nxs'))
        os.remove(os.path.join(config['defaultsave.directory'],'54433sans.xml'))
        os.remove(os.path.join(config['defaultsave.directory'],'99630sanotrans.xml'))
开发者ID:mantidproject,项目名称:mantid,代码行数:21,代码来源:SANSLOQBatch_V2.py

示例13: import

# 需要导入模块: from mantid.api import FileFinder [as 别名]
# 或者: from mantid.api.FileFinder import getFullPath [as 别名]
#pylint: disable=invalid-name,attribute-defined-outside-init
"""
The tests here are ports from the original SANS2DReductionGUI.py test suite. Not all tests can be ported since they
include details about the ReductionSingleton
"""

from __future__ import (absolute_import, division, print_function)
import systemtesting
from mantid.kernel import (config)
from mantid.api import (FileFinder)
from mantid.simpleapi import RenameWorkspace
from sans.command_interface.ISISCommandInterface import (BatchReduce, SANS2D, MaskFile, AssignSample, AssignCan,
                                                         TransmissionSample, TransmissionCan, WavRangeReduction,
                                                         UseCompatibilityMode, FindBeamCentre)

MASKFILE = FileFinder.getFullPath('MaskSANS2DReductionGUI.txt')
BATCHFILE = FileFinder.getFullPath('sans2d_reduction_gui_batch.csv')


class SANS2DMinimalBatchReductionTest_V2(systemtesting.MantidSystemTest):
    """Minimal script to perform full reduction in batch mode
    """
    def __init__(self):
        super(SANS2DMinimalBatchReductionTest_V2, self).__init__()
        config['default.instrument'] = 'SANS2D'
        self.tolerance_is_rel_err = True
        self.tolerance = 1.0e-2

    def runTest(self):
        UseCompatibilityMode()
        SANS2D()
开发者ID:mantidproject,项目名称:mantid,代码行数:33,代码来源:SANS2DReductionGUI_V2.py

示例14: ISISPowderDiffraction

# 需要导入模块: from mantid.api import FileFinder [as 别名]
# 或者: from mantid.api.FileFinder import getFullPath [as 别名]
# pylint: disable=no-init

from mantid.api import FileFinder
from mantid.simpleapi import *
from mantid import config
import os.path
import stresstesting
import sys
F_DIR = FileFinder.getFullPath("PowderISIS")
sys.path.append(F_DIR)
import cry_ini
import cry_focus

class ISISPowderDiffraction(stresstesting.MantidStressTest):

    def requiredFiles(self):
        return set(["hrp39191.raw", "hrp39187.raw", "hrp43022.raw", "hrpd/test/GrpOff/hrpd_new_072_01.cal",
                "hrpd/test/GrpOff/hrpd_new_072_01_corr.cal", "hrpd/test/cycle_09_2/Calibration/van_s1_old-0.nxs",
                "hrpd/test/cycle_09_2/Calibration/van_s1_old-1.nxs",
                "hrpd/test/cycle_09_2/Calibration/van_s1_old-2.nxs", "hrpd/test/cycle_09_2/tester/mtd.pref"])
    def _clean_up_files(self, filenames, directories):
        try:
            for file in filenames:
                path = os.path.join(directories[0], file)
                os.remove(path)
        except OSError, ose:
            print 'could not delete generated file : ', ose.filename


    def runTest(self):
        dirs = config['datasearch.directories'].split(';')
开发者ID:stothe2,项目名称:mantid,代码行数:33,代码来源:ISISPowderDiffractionTest.py

示例15: setUp

# 需要导入模块: from mantid.api import FileFinder [as 别名]
# 或者: from mantid.api.FileFinder import getFullPath [as 别名]
 def setUp(self):
     self._function = 'Voigt'
     self._parameter_file = FileFinder.getFullPath("IP0005.par")
     self._calibrated_params = self.load_ip_file()
     self._mode = 'FoilOut'
     self._energy_estimates = np.array([ENERGY_ESTIMATE])
开发者ID:mantidproject,项目名称:scripts,代码行数:8,代码来源:CalibrateVesuvioTest.py


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