Esempio n. 1
0
 def test(self):
     from mcstas2.utils.parsers.McStasInstrumentParser import McStasInstrumentParser
     parser = McStasInstrumentParser()
     path = os.path.join(
         mcvine_resources,
         "instruments/VULCAN/resources/vulcan_asbuilt_L2d.instr")
     text = open(path).read()
     instrument = parser.parse(text)
     return
Esempio n. 2
0
 def test(self):
     from mcstas2.utils.parsers.McStasInstrumentParser import McStasInstrumentParser
     parser = McStasInstrumentParser()
     path = os.path.join(
         mcvine_resources, 
         "instruments/VULCAN/mcstas/vulcan_asbuilt_L2d.instr"
         )
     text = open(path).read()
     instrument = parser.parse(text)
     return
Esempio n. 3
0
    def run(self, input):
        text = open(input).read()
        from mcstas2.utils.parsers.McStasInstrumentParser import McStasInstrumentParser
        parser = McStasInstrumentParser()
        instrument = parser.parse(text)
        
        fname = os.path.basename(input)
        instrname, ext = os.path.splitext(fname)

        instrument.name = instrname
        try:
            self._render(instrument)
        except:
            import traceback
            traceback.print_exc()
            print
            self._onError()
        return
Esempio n. 4
0
    def run(self, input):
        text = open(input).read()
        from mcstas2.utils.parsers.McStasInstrumentParser import McStasInstrumentParser
        parser = McStasInstrumentParser()
        instrument = parser.parse(text)

        fname = os.path.basename(input)
        instrname, ext = os.path.splitext(fname)

        instrument.name = instrname
        try:
            self._render(instrument)
        except:
            import traceback
            traceback.print_exc()
            print
            self._onError()
        return