def testHydroTxtToOPMDConverter(self): """ Test the conversion of esther output to openPMD conform hdf5 file.""" # Get sample file. esther_output = generateTestFilePath('hydroTests') # Convert. convertTxtToOPMD(esther_output) # New file name. opmd_h5_file = esther_output + '/output.opmd.h5' # Make sure we clean up after test. self.__files_to_remove.append(opmd_h5_file) # Check new file was generated. self.assertTrue(os.path.isfile(opmd_h5_file)) # Validate the new file. g = opmd_validator.open_file(opmd_h5_file) # Setup result array. result_array = numpy.array([0, 0]) result_array += opmd_validator.check_root_attr(g, False) # Go through all the iterations, checking both the particles. # and the meshes. extensions = {'ED-PIC': False, 'HYDRO1D': True} result_array += opmd_validator.check_iterations(g, False, extensions) # Assert that no errors nor warnings were issued. self.assertEqual(result_array[0], 0) self.assertEqual(result_array[1], 0)
def testHydroTxtToOPMDConverter(self): """ Test the conversion of esther output to openPMD conform hdf5 file.""" # Get sample file. esther_output = generateTestFilePath('hydroTests') # Convert. convertTxtToOPMD(esther_output) # New file name. opmd_h5_file = esther_output + '.opmd.h5' # Make sure we clean up after test. self.__files_to_remove.append(opmd_h5_file) # Check new file was generated. self.assertTrue( os.path.isfile( opmd_h5_file ) ) # Validate the new file. g = opmd_validator.open_file(opmd_h5_file) # Setup result array. result_array = numpy.array([0, 0]) result_array += opmd_validator.check_root_attr(g, False) # Go through all the iterations, checking both the particles. # and the meshes. extensions = {'ED-PIC': False, 'HYDRO1D': True} result_array += opmd_validator.check_iterations(g,False,extensions) # Assert that no errors nor warnings were issued. self.assertEqual( result_array[0], 0 ) self.assertEqual( result_array[1], 0 )
def testWpgToOPMDLegacyConverter(self): """ Test the conversion of wpg output to openPMD conform file, omitting the openpmd-api.""" # Get sample file. h5_input = generateTestFilePath('prop_out/prop_out_0000011.h5') # Convert. convertToOPMDLegacy(h5_input) # New file name. opmd_h5_file = h5_input.replace(".h5", ".opmd.h5") # Make sure we clean up after test. self.__files_to_remove.append(opmd_h5_file) # Check new file was generated. self.assertTrue(os.path.isfile(opmd_h5_file)) # Validate the new file. g = opmd_validator.open_file(opmd_h5_file) # Setup result array. result_array = numpy.array([0, 0]) result_array += opmd_validator.check_root_attr(g, False) # Go through all the iterations, checking both the particles and the meshes extensions = {'ED-PIC': False, 'HYDRO1D': False} result_array += opmd_validator.check_iterations(g, False, extensions) # Assert that no errors nor warnings were issued. self.assertEqual(result_array[0], 0) self.assertEqual(result_array[1], 0)