def test_export(self):
        """assert export works"""
        input_file = self.input_filename
        o_handler = VDriveToMtex(filename=input_file)
        o_handler.load()
        o_handler.sort_raw_data()
        o_handler.interpolation()

        self.assertRaises(ValueError, o_handler.export)

        output_file_name = os.path.join(self.export_folder,
                                        self.export_filename)
        o_handler.export(filename=output_file_name)

        def _read_ascii(filename=''):
            f = open(filename, 'r')
            text = []
            for line in f:
                text.append(line)
            f.close()
            return text

        text_created = _read_ascii(output_file_name)
        text_expected = [
            "*Dump of file:XQG", "*Sample: VULCAN",
            "*Corrected, rescaled data * Phi range    0.00 -  360.00 Step    5.00",
            "*Pole figure: 111", "*Khi =   0.00",
            "0.8126  0.8126  0.8126  0.8126  0.8126  0.8126  0.8126  0.8126",
            "0.8126  0.8126  0.8126  0.8126  0.8126  0.8126  0.8126  0.8126"
        ]

        for _returned, _expected in zip(text_created[0:7], text_expected):
            self.assertTrue(_returned.strip() == _expected)
Пример #2
0
def vdrive_handler_to_mtex():

    args = parser.parse_args()

    o_vdrive = VDriveHandler(filename=args.input)
    o_vdrive.run()
    o_vdrive.export(filename=args.intermediate_output)

    o_handler = VDriveToMtex(filename=args.intermediate_output)
    o_handler.run()
    o_handler.export(filename=args.output)
Пример #3
0
def test1():
    # vdrive_filename.txt -> vulcan.rpf
    from bem.texture.preparation.vdrive_handler import VDriveHandler
    from bem.texture.preparation.vdrive_to_mtex import VDriveToMtex
    o_vdrive = VDriveHandler(filename = infile)
    o_vdrive.run()
    o_vdrive.export(filename = interm)

    o_handler = VDriveToMtex(interm)
    o_handler.run()
    o_handler.export(filename = rpffile)
    return