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


Python Loader.load方法代码示例

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


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

示例1: nxcansas_writer

# 需要导入模块: from sas.sascalc.dataloader.loader import Loader [as 别名]
# 或者: from sas.sascalc.dataloader.loader.Loader import load [as 别名]
class nxcansas_writer(unittest.TestCase):

    def setUp(self):
        self.loader = Loader()
        self.writer = NXcanSASWriter()
        self.read_file_1d = "cansas1d.xml"
        self.write_file_1d = "export1d.h5"
        self.read_file_2d = "exp18_14_igor_2dqxqy.dat"
        self.write_file_2d = "export2d.h5"

        self.data_1d = self.loader.load(self.read_file_1d)[0]

        self.data_2d = self.loader.load(self.read_file_2d)[0]
        self.data_2d.detector[0].name = ''
        self.data_2d.source.radiation = 'neutron'

    def test_write_1d(self):
        self.writer.write([self.data_1d], self.write_file_1d)
        data = self.loader.load(self.write_file_1d)
        self.assertTrue(len(data) == 1)
        data = data[0]
        self.assertTrue(len(data.x) == len(self.data_1d.x))
        self.assertTrue(len(data.y) == len(self.data_1d.y))
        self.assertTrue(len(data.dy) == len(self.data_1d.dy))
        self._check_metadata(data, self.data_1d)

    def test_write_2d(self):
        self.writer.write([self.data_2d], self.write_file_2d)
        data = self.loader.load(self.write_file_2d)
        self.assertTrue(len(data) == 1)
        data = data[0]
        self.assertTrue(len(data.data) == len(self.data_2d.data))
        self.assertTrue(len(data.qx_data) == len(self.data_2d.qx_data))
        self.assertTrue(len(data.qy_data) == len(self.data_2d.qy_data))
        self._check_metadata(data, self.data_2d)

    def _check_metadata(self, written, correct):
        self.assertTrue(written.title == correct.title)
        self.assertTrue(written.sample.name == correct.sample.name)
        self.assertAlmostEqual(written.sample.thickness, correct.sample.thickness)
        self.assertAlmostEqual(written.sample.temperature, correct.sample.temperature)
        self.assertTrue(written.instrument == correct.instrument)
        self.assertTrue(len(written.detector) == len(correct.detector))
        for i in range(len(written.detector)):
            written_det = written.detector[i]
            correct_det = correct.detector[i]
            self.assertAlmostEqual(written_det.distance, correct_det.distance)
            self.assertTrue(written_det.name == correct_det.name)
        self.assertTrue(written.source.radiation == correct.source.radiation)

    def tearDown(self):
        if os.path.isfile(self.write_file_1d):
            os.remove(self.write_file_1d)
        if os.path.isfile(self.write_file_2d):
            os.remove(self.write_file_2d)
开发者ID:lewisodriscoll,项目名称:sasview,代码行数:57,代码来源:utest_nxcansas_writer.py

示例2: test_old_cansas_files

# 需要导入模块: from sas.sascalc.dataloader.loader import Loader [as 别名]
# 或者: from sas.sascalc.dataloader.loader.Loader import load [as 别名]
 def test_old_cansas_files(self):
     reader1 = XMLreader(self.cansas1d, self.schema_1_0)
     self.assertTrue(reader1.validate_xml())
     file_loader = Loader()
     file_loader.load(self.cansas1d)
     reader2 = XMLreader(self.cansas1d_units, self.schema_1_0)
     self.assertTrue(reader2.validate_xml())
     reader3 = XMLreader(self.cansas1d_badunits, self.schema_1_0)
     self.assertTrue(reader3.validate_xml())
     reader4 = XMLreader(self.cansas1d_slit, self.schema_1_0)
     self.assertTrue(reader4.validate_xml())
开发者ID:rprospero,项目名称:sasview,代码行数:13,代码来源:utest_cansas.py

示例3: test_double_trans_spectra

# 需要导入模块: from sas.sascalc.dataloader.loader import Loader [as 别名]
# 或者: from sas.sascalc.dataloader.loader.Loader import load [as 别名]
 def test_double_trans_spectra(self):
     xmlreader = XMLreader(self.isis_1_1_doubletrans, self.schema_1_1)
     self.assertTrue(xmlreader.validate_xml())
     reader = Loader()
     data = reader.load(self.isis_1_1_doubletrans)
     for item in data:
         self._check_data(item)
开发者ID:rprospero,项目名称:sasview,代码行数:9,代码来源:utest_cansas.py

示例4: load_data

# 需要导入模块: from sas.sascalc.dataloader.loader import Loader [as 别名]
# 或者: from sas.sascalc.dataloader.loader.Loader import load [as 别名]
def load_data(filename):
    """
    Load data using a sasview loader.
    """
    from sas.sascalc.dataloader.loader import Loader
    loader = Loader()
    data = loader.load(filename)
    if data is None:
        raise IOError("Data %r could not be loaded" % filename)
    return data
开发者ID:bmaranville,项目名称:sasmodels,代码行数:12,代码来源:data.py

示例5: test_cansas_xml

# 需要导入模块: from sas.sascalc.dataloader.loader import Loader [as 别名]
# 或者: from sas.sascalc.dataloader.loader.Loader import load [as 别名]
 def test_cansas_xml(self):
     xmlreader = XMLreader(self.isis_1_1, self.schema_1_1)
     valid = xmlreader.validate_xml()
     xmlreader.set_processing_instructions()
     self.assertTrue(valid)
     reader_generic = Loader()
     dataloader = reader_generic.load(self.isis_1_1)
     reader_cansas = Reader()
     cansasreader = reader_cansas.read(self.isis_1_1)
     for i in range(len(dataloader)):
         self._check_data(dataloader[i])
         self._check_data_1_1(dataloader[i])
         self._check_data(cansasreader[i])
         self._check_data_1_1(cansasreader[i])
         reader_generic.save(self.write_1_1_filename, dataloader[i], None)
         reader2 = Loader()
         self.assertTrue(os.path.isfile(self.write_1_1_filename))
         return_data = reader2.load(self.write_1_1_filename)
         written_data = return_data[0]
         self._check_data(written_data)
     if os.path.isfile(self.write_1_1_filename):
         os.remove(self.write_1_1_filename)
开发者ID:rprospero,项目名称:sasview,代码行数:24,代码来源:utest_cansas.py

示例6: testLoader

# 需要导入模块: from sas.sascalc.dataloader.loader import Loader [as 别名]
# 或者: from sas.sascalc.dataloader.loader.Loader import load [as 别名]
class testLoader(unittest.TestCase):
    
    def setUp(self):
        self.L=Loader()
        self.L.find_plugins('../plugins')
            
    def testplugin(self):
        """ 
            test loading with a test reader only 
            found in the plugins directory
        """
        output = self.L.load('test_data.test')
        self.assertEqual(output.x[0], 1234.)
开发者ID:ianhi,项目名称:sasview,代码行数:15,代码来源:testplugings.py

示例7: test_cansas_xml

# 需要导入模块: from sas.sascalc.dataloader.loader import Loader [as 别名]
# 或者: from sas.sascalc.dataloader.loader.Loader import load [as 别名]
 def test_cansas_xml(self):
     filename = "isis_1_1_write_test.xml"
     xmlreader = XMLreader(self.isis_1_1, self.schema_1_1)
     valid = xmlreader.validate_xml()
     xmlreader.set_processing_instructions()
     self.assertTrue(valid)
     fo = open(self.isis_1_1)
     str = fo.read()
     reader_generic = Loader()
     dataloader = reader_generic.load(self.isis_1_1)
     reader_cansas = Reader()
     cansasreader = reader_cansas.read(self.isis_1_1)
     for i in range(len(dataloader)):
         self._check_data(dataloader[i])
         self._check_data_1_1(dataloader[i])
         self._check_data(cansasreader[i])
         self._check_data_1_1(cansasreader[i])
         reader_generic.save(filename, dataloader[i], None)
         fo = open(filename)
         str = fo.read()
         reader2 = Loader()
         return_data = reader2.load(filename)
         written_data = return_data[0]
         self._check_data(written_data)
开发者ID:ianhi,项目名称:sasview,代码行数:26,代码来源:utest_cansas.py

示例8: abs_reader

# 需要导入模块: from sas.sascalc.dataloader.loader import Loader [as 别名]
# 或者: from sas.sascalc.dataloader.loader.Loader import load [as 别名]
class abs_reader(unittest.TestCase):
    
    def setUp(self):
        self.loader = Loader()
        
    def test_checkdata(self):
        """
            Test .DAT file loaded as IGOR/DAT 2D Q_map
        """
        f = self.loader.load("exp18_14_igor_2dqxqy.dat")
        # The length of the data is 10
        self.assertEqual(len(f.qx_data),  36864)
        self.assertEqual(f.qx_data[0],-0.03573497)
        self.assertEqual(f.qx_data[36863],0.2908819)
        self.assertEqual(f.Q_unit, '1/A')
        self.assertEqual(f.I_unit, '1/cm')
        
        self.assertEqual(f.meta_data['loader'],"IGOR/DAT 2D Q_map")
开发者ID:pkienzle,项目名称:sasview,代码行数:20,代码来源:utest_red2d_reader.py

示例9: test_save_cansas_v1_0

# 需要导入模块: from sas.sascalc.dataloader.loader import Loader [as 别名]
# 或者: from sas.sascalc.dataloader.loader.Loader import load [as 别名]
 def test_save_cansas_v1_0(self):
     filename = "isis_1_0_write_test.xml"
     xmlreader = XMLreader(self.isis_1_0, self.schema_1_0)
     valid = xmlreader.validate_xml()
     self.assertTrue(valid)
     reader_generic = Loader()
     dataloader = reader_generic.load(self.isis_1_0)
     reader_cansas = Reader()
     cansasreader = reader_cansas.read(self.isis_1_0)
     for i in range(len(dataloader)):
         self._check_data(dataloader[i])
         self._check_data(cansasreader[i])
         reader_generic.save(filename, dataloader[i], None)
         reader2 = Reader()
         return_data = reader2.read(filename)
         written_data = return_data[0]
         xmlwrite = XMLreader(filename, self.schema_1_0)
         valid = xmlreader.validate_xml()
         self.assertTrue(valid)
         self._check_data(written_data)
开发者ID:ianhi,项目名称:sasview,代码行数:22,代码来源:utest_cansas.py

示例10: test_save_cansas_v1_0

# 需要导入模块: from sas.sascalc.dataloader.loader import Loader [as 别名]
# 或者: from sas.sascalc.dataloader.loader.Loader import load [as 别名]
 def test_save_cansas_v1_0(self):
     xmlreader = XMLreader(self.isis_1_0, self.schema_1_0)
     self.assertTrue(xmlreader.validate_xml())
     reader_generic = Loader()
     dataloader = reader_generic.load(self.isis_1_0)
     reader_cansas = Reader()
     cansasreader = reader_cansas.read(self.isis_1_0)
     for i in range(len(dataloader)):
         self._check_data(dataloader[i])
         self._check_data(cansasreader[i])
         reader_generic.save(self.write_1_0_filename, dataloader[i], None)
         reader2 = Reader()
         self.assertTrue(os.path.isfile(self.write_1_0_filename))
         return_data = reader2.read(self.write_1_0_filename)
         written_data = return_data[0]
         xmlreader = XMLreader(self.write_1_0_filename, self.schema_1_0)
         self.assertTrue(xmlreader.validate_xml())
         self._check_data(written_data)
     if os.path.isfile(self.write_1_0_filename):
         os.remove(self.write_1_0_filename)
开发者ID:rprospero,项目名称:sasview,代码行数:22,代码来源:utest_cansas.py

示例11: DataReader

# 需要导入模块: from sas.sascalc.dataloader.loader import Loader [as 别名]
# 或者: from sas.sascalc.dataloader.loader.Loader import load [as 别名]
class DataReader(CalcThread):
    """
        Load a data given a filename
    """
    def __init__(self, path, completefn=None,
                 updatefn=None,
                 yieldtime=0.01,
                 worktime=0.01
                 ):
        CalcThread.__init__(self, completefn,
                 updatefn,
                 yieldtime,
                 worktime)
        self.path = path
        #Instantiate a loader 
        self.loader = Loader()
        self.starttime = 0

    def isquit(self):
        """
             @raise KeyboardInterrupt: when the thread is interrupted
        """
        try:
            CalcThread.isquit(self)
        except KeyboardInterrupt:
            raise KeyboardInterrupt


    def compute(self):
        """
            read some data
        """
        self.starttime = time.time()
        try:
            data = self.loader.load(self.path)
            self.complete(data=data)
        except KeyboardInterrupt:
            # Thread was interrupted, just proceed and re-raise.
            # Real code should not print, but this is an example...
            raise
开发者ID:ianhi,项目名称:sasview,代码行数:42,代码来源:load_thread.py

示例12: OnLoad

# 需要导入模块: from sas.sascalc.dataloader.loader import Loader [as 别名]
# 或者: from sas.sascalc.dataloader.loader.Loader import load [as 别名]
 def OnLoad(self,event):
     path = None
     dlg = wx.FileDialog(None, "Choose a file", os.getcwd(), "", "*", wx.OPEN)
     if dlg.ShowModal() == wx.ID_OK:
         path = dlg.GetPath()
         mypath = os.path.basename(path)
         from sas.sascalc.dataloader.loader import  Loader
        
         #Instantiate a loader 
         L=Loader()
         
         #Receives data
         try:
             output=L.load(path)
         except:
             raise
        
         newplot=Data2D(image=output.data)
         newplot.setValues(output)
         self.plotpanel.add_image(newplot)
        
             
     dlg.Destroy()
开发者ID:rprospero,项目名称:sasview,代码行数:25,代码来源:test_panel2D.py

示例13: Plugin

# 需要导入模块: from sas.sascalc.dataloader.loader import Loader [as 别名]
# 或者: from sas.sascalc.dataloader.loader.Loader import load [as 别名]
class Plugin(PluginBase):

    def __init__(self):
        PluginBase.__init__(self, name="DataLoader")
        # Default location
        self._default_save_location = DEFAULT_OPEN_FOLDER
        self.loader = Loader()
        self._data_menu = None

    def populate_file_menu(self):
        """
        get a menu item and append it under file menu of the application
        add load file menu item and load folder item
        """
        # menu for data files
        data_file_hint = "load one or more data in the application"
        menu_list = [('&Load Data File(s)', data_file_hint, self.load_data)]
        gui_style = self.parent.get_style()
        style = gui_style & GUIFRAME.MULTIPLE_APPLICATIONS
        if style == GUIFRAME.MULTIPLE_APPLICATIONS:
            # menu for data from folder
            data_folder_hint = "load multiple data in the application"
            menu_list.append(('&Load Data Folder', data_folder_hint,
                              self._load_folder))
        return menu_list

    def load_data(self, event):
        """
        Load data
        """
        path = None
        self._default_save_location = self.parent._default_save_location
        if self._default_save_location is None:
            self._default_save_location = os.getcwd()

        cards = self.loader.get_wildcards()
        temp = [APPLICATION_WLIST] + PLUGINS_WLIST
        for item in temp:
            if item in cards:
                cards.remove(item)
        wlist = '|'.join(cards)
        style = wx.OPEN | wx.FD_MULTIPLE
        dlg = wx.FileDialog(self.parent,
                            "Choose a file",
                            self._default_save_location, "",
                            wlist,
                            style=style)
        if dlg.ShowModal() == wx.ID_OK:
            file_list = dlg.GetPaths()
            if len(file_list) >= 0 and file_list[0] is not None:
                self._default_save_location = os.path.dirname(file_list[0])
                path = self._default_save_location
        dlg.Destroy()

        if path is None or not file_list or file_list[0] is None:
            return
        self.parent._default_save_location = self._default_save_location
        self.get_data(file_list)

    def can_load_data(self):
        """
        if return True, then call handler to load data
        """
        return True

    def _load_folder(self, event):
        """
        Load entire folder
        """
        path = None
        self._default_save_location = self.parent._default_save_location
        if self._default_save_location is None:
            self._default_save_location = os.getcwd()
        dlg = wx.DirDialog(self.parent, "Choose a directory",
                           self._default_save_location,
                           style=wx.DD_DEFAULT_STYLE)
        if dlg.ShowModal() == wx.ID_OK:
            path = dlg.GetPath()
            self._default_save_location = path
        dlg.Destroy()
        if path is not None:
            self._default_save_location = os.path.dirname(path)
        else:
            return
        file_list = self.get_file_path(path)
        self.get_data(file_list)
        self.parent._default_save_location = self._default_save_location

    def load_error(self, error=None):
        """
        Pop up an error message.

        :param error: details error message to be displayed
        """
        if error is not None or str(error).strip() != "":
            dial = wx.MessageDialog(self.parent, str(error),
                                    'Error Loading File',
                                    wx.OK | wx.ICON_EXCLAMATION)
            dial.ShowModal()

#.........这里部分代码省略.........
开发者ID:rprospero,项目名称:sasview,代码行数:103,代码来源:data_loader.py

示例14: Plugin

# 需要导入模块: from sas.sascalc.dataloader.loader import Loader [as 别名]
# 或者: from sas.sascalc.dataloader.loader.Loader import load [as 别名]
class Plugin(PluginBase):

    def __init__(self):
        PluginBase.__init__(self, name="DataLoader")
        # Default location
        self._default_save_location = DEFAULT_OPEN_FOLDER
        self.loader = Loader()
        self._data_menu = None

    def populate_file_menu(self):
        """
        get a menu item and append it under file menu of the application
        add load file menu item and load folder item
        """
        # menu for data files
        menu_list = []
        data_file_hint = "load one or more data in the application"
        menu_list = [('&Load Data File(s)', data_file_hint, self.load_data)]
        gui_style = self.parent.get_style()
        style = gui_style & GUIFRAME.MULTIPLE_APPLICATIONS
        style1 = gui_style & GUIFRAME.DATALOADER_ON
        if style == GUIFRAME.MULTIPLE_APPLICATIONS:
            # menu for data from folder
            data_folder_hint = "load multiple data in the application"
            menu_list.append(('&Load Data Folder', data_folder_hint,
                              self._load_folder))
        return menu_list

    def load_data(self, event):
        """
        Load data
        """
        path = None
        self._default_save_location = self.parent._default_save_location
        if self._default_save_location == None:
            self._default_save_location = os.getcwd()

        cards = self.loader.get_wildcards()
        temp = [APPLICATION_WLIST] + PLUGINS_WLIST
        for item in temp:
            if item in cards:
                cards.remove(item)
        wlist = '|'.join(cards)
        style = wx.OPEN | wx.FD_MULTIPLE
        dlg = wx.FileDialog(self.parent,
                            "Choose a file",
                            self._default_save_location, "",
                            wlist,
                            style=style)
        if dlg.ShowModal() == wx.ID_OK:
            file_list = dlg.GetPaths()
            if len(file_list) >= 0 and not file_list[0] is None:
                self._default_save_location = os.path.dirname(file_list[0])
                path = self._default_save_location
        dlg.Destroy()

        if path is None or not file_list or file_list[0] is None:
            return
        self.parent._default_save_location = self._default_save_location
        self.get_data(file_list)


    def can_load_data(self):
        """
        if return True, then call handler to laod data
        """
        return True


    def _load_folder(self, event):
        """
        Load entire folder
        """
        path = None
        self._default_save_location = self.parent._default_save_location
        if self._default_save_location == None:
            self._default_save_location = os.getcwd()
        dlg = wx.DirDialog(self.parent, "Choose a directory",
                           self._default_save_location,
                           style=wx.DD_DEFAULT_STYLE)
        if dlg.ShowModal() == wx.ID_OK:
            path = dlg.GetPath()
            self._default_save_location = path
        dlg.Destroy()
        if path is not None:
            self._default_save_location = os.path.dirname(path)
        else:
            return
        file_list = self.get_file_path(path)
        self.get_data(file_list)
        self.parent._default_save_location = self._default_save_location

    def load_error(self, error=None):
        """
        Pop up an error message.

        :param error: details error message to be displayed
        """
        if error is not None or str(error).strip() != "":
            dial = wx.MessageDialog(self.parent, str(error), 'Error Loading File',
#.........这里部分代码省略.........
开发者ID:ianhi,项目名称:sasview,代码行数:103,代码来源:data_loader.py

示例15: cansas_reader_xml

# 需要导入模块: from sas.sascalc.dataloader.loader import Loader [as 别名]
# 或者: from sas.sascalc.dataloader.loader.Loader import load [as 别名]
class cansas_reader_xml(unittest.TestCase):

    def setUp(self):
        self.loader = Loader()
        self.xml_valid = find("cansas_test_modified.xml")
        self.xml_invalid = find("cansas_test.xml")
        self.cansas1d_badunits = find("cansas1d_badunits.xml")
        self.cansas1d = find("cansas1d.xml")
        self.cansas1d_slit = find("cansas1d_slit.xml")
        self.cansas1d_units = find("cansas1d_units.xml")
        self.cansas1d_notitle = find("cansas1d_notitle.xml")
        self.isis_1_0 = find("ISIS_1_0.xml")
        self.isis_1_1 = find("ISIS_1_1.xml")
        self.isis_1_1_notrans = find("ISIS_1_1_notrans.xml")
        self.isis_1_1_doubletrans = find("ISIS_1_1_doubletrans.xml")
        self.schema_1_0 = find("cansas1d_v1_0.xsd")
        self.schema_1_1 = find("cansas1d_v1_1.xsd")
        self.write_1_0_filename = find("isis_1_0_write_test.xml")
        self.write_1_1_filename = find("isis_1_1_write_test.xml")

    def get_number_of_entries(self, dictionary, name, i):
        if dictionary.get(name) is not None:
            i += 1
            name = name.split("_")[0]
            name += "_{0}".format(i)
            name = self.get_number_of_entries(dictionary, name, i)
        return name

    def test_invalid_xml(self):
        """
        Should fail gracefully and send a message to logger.info()
        """
        invalid = StringIO('<a><c></b></a>')
        self.assertRaises(XMLSyntaxError, lambda: XMLreader(invalid))

    def test_xml_validate(self):
        string = "<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n"
        string += "\t<xsd:element name=\"a\" type=\"AType\"/>\n"
        string += "\t<xsd:complexType name=\"AType\">\n"
        string += "\t\t<xsd:sequence>\n"
        string += "\t\t\t<xsd:element name=\"b\" type=\"xsd:string\" />\n"
        string += "\t\t</xsd:sequence>\n"
        string += "\t</xsd:complexType>\n"
        string += "</xsd:schema>"
        f = StringIO(string)
        xmlschema_doc = etree.parse(f)
        xmlschema = etree.XMLSchema(xmlschema_doc)
        valid = etree.parse(StringIO('<a><b></b></a>'))
        invalid = etree.parse(StringIO('<a><c></c></a>'))
        self.assertTrue(xmlschema.validate(valid))
        self.assertFalse(xmlschema.validate(invalid))

    def test_real_xml(self):
        reader = XMLreader(self.xml_valid, self.schema_1_0)
        valid = reader.validate_xml()
        self.assertTrue(valid)

    def _check_data(self, data):
        self.assertTrue(data.title == "TK49 c10_SANS")
        self.assertTrue(data.x.size == 138)
        self.assertTrue(len(data.meta_data) == 3)
        self.assertTrue(data.detector[0].distance_unit == "mm")
        self.assertTrue(data.detector[1].distance_unit == "mm")
        self.assertTrue(data.detector[0].name == "HAB")
        self.assertTrue(data.detector[1].name == "main-detector-bank")
        self.assertTrue(data.detector[0].distance == 575.0)
        self.assertAlmostEqual(data.detector[1].distance, 4145.02)
        self.assertTrue(data.process[0].name == "Mantid generated CanSAS1D XML")
        self.assertTrue(data.meta_data["xmlpreprocess"] is not None)

    def _check_data_1_1(self, data):
        spectrum = data.trans_spectrum[0]
        self.assertTrue(len(spectrum.wavelength) == 138)

    def test_cansas_xml(self):
        xmlreader = XMLreader(self.isis_1_1, self.schema_1_1)
        valid = xmlreader.validate_xml()
        xmlreader.set_processing_instructions()
        self.assertTrue(valid)
        reader_generic = Loader()
        dataloader = reader_generic.load(self.isis_1_1)
        reader_cansas = Reader()
        cansasreader = reader_cansas.read(self.isis_1_1)
        for i in range(len(dataloader)):
            self._check_data(dataloader[i])
            self._check_data_1_1(dataloader[i])
            self._check_data(cansasreader[i])
            self._check_data_1_1(cansasreader[i])
            reader_generic.save(self.write_1_1_filename, dataloader[i], None)
            reader2 = Loader()
            self.assertTrue(os.path.isfile(self.write_1_1_filename))
            return_data = reader2.load(self.write_1_1_filename)
            written_data = return_data[0]
            self._check_data(written_data)
        if os.path.isfile(self.write_1_1_filename):
            os.remove(self.write_1_1_filename)

    def test_double_trans_spectra(self):
        xmlreader = XMLreader(self.isis_1_1_doubletrans, self.schema_1_1)
        self.assertTrue(xmlreader.validate_xml())
#.........这里部分代码省略.........
开发者ID:rprospero,项目名称:sasview,代码行数:103,代码来源:utest_cansas.py


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