def test_export_edi_files(self): path3 = make_temp_dir(self.__class__.__name__ + "_export_edi_files_no_interp", base_dir=self._temp_dir) path4 = make_temp_dir(self.__class__.__name__ + "_export_edi_files_interp", base_dir=self._temp_dir) # Note that this test relies on the fact that the input edi files all have the same periods. # EDI files generated based on the periods as in the input edi files should be identical # to those produced with interpolation turned on or off. # no interp self.edi_collection.export_edi_files(path3) # interp mto = self.edi_collection.mt_obj_list[0] plist = 1. / mto.Z.freq self.edi_collection.export_edi_files(path4, period_list=plist) for fn in glob.glob('%s/*.edi' % (path3)): f1 = os.path.join(path3, fn) f2 = os.path.join(path4, fn) assert filecmp.cmp(f1, f2)
def setUp(self): self.model_epsg = 28355 #self._temp_dir = make_temp_dir(self.__name__) self._temp_dir = make_temp_dir("TestModEM_Model_tmp") # directory to save created input files self._output_dir = make_temp_dir(self._testMethodName, base_dir=self._temp_dir) self._model_dir = os.path.join(SAMPLE_DIR, 'ModEM') self._sgrid_fn = os.path.join(SAMPLE_DIR, 'gocad', 'ModEM_Model_File.sg') self._model_fn = os.path.join(self._model_dir, 'ModEM_Model_File.rho') self._data_fn = os.path.join(self._model_dir, 'ModEM_Data.dat')
def setUpClass(cls): """ Reset building matplotlib plot and generate tempdir inputfiles """ reset_matplotlib() cls._temp_dir = make_temp_dir(cls.__name__)
def setUp(self): # for each test, setup a different output dir self._output_dir = make_temp_dir(self._testMethodName, base_dir=self._temp_dir) # set the dir to the output from the previously correct run self._expected_output_dir = os.path.normpath( os.path.join(os.path.join(self._temp_dir, 'expected_data_output'), self._testMethodName)) # unzip expected output files tfn = os.path.join(os.path.dirname(__file__), 'test_data.expected.tar.gz') tf = tarfile.open(tfn) output_dir = self._expected_output_dir for member in tf.getmembers(): if (member.isreg()): if (self._testMethodName in member.name): member.name = os.path.basename( member.name) # remove the path by resetting it tf.extract(member, output_dir) # extract # end if # end if # end for if not os.path.isdir(self._expected_output_dir): self._expected_output_dir = None
def setUp(self): # directory to save created input files self._output_dir = make_temp_dir(self._testMethodName, base_dir=self._temp_dir) self._expected_output_dir = os.path.join(SAMPLE_DIR, 'ModEM') if not os.path.isdir(self._expected_output_dir): self._expected_output_dir = None
def setUp(self): # set the dir to the output from the previously correct run self._expected_output_dir = os.path.join(SAMPLE_DIR, 'Occam2d') if not os.path.isdir(self._expected_output_dir): self._expected_output_dir = None # directory to save created input files self._output_dir = make_temp_dir('Occam2d', self._temp_dir)
def setUp(self): # directory to save created input files self._output_dir = make_temp_dir(self._testMethodName, base_dir=self._temp_dir) # set the dir to the output from the previously correct run self._expected_output_dir = os.path.join(SAMPLE_DIR, 'ModEM') if not os.path.isdir(self._expected_output_dir): self._expected_output_dir = None
def setUp(self): # for each test, setup a different output dir self._output_dir = make_temp_dir(self._testMethodName, base_dir=self._temp_dir) # set the dir to the output from the previously correct run self._expected_output_dir = os.path.normpath( os.path.join(os.path.join(self._temp_dir, 'expected_data_output'), self._testMethodName)) if not os.path.isdir(self._expected_output_dir): self._expected_output_dir = None
def test_read_write(): # path2edi = 'data/AMT/15125A_spe.edi' output_dir = make_temp_dir(__name__) path2edi = os.path.normpath( os.path.join(TEST_MTPY_ROOT, 'data/AMT/15125A_imp.edi')) edi_obj = Edi(edi_fn=path2edi) # change the latitude edi_obj.lat = 45.7869 new_edi_fn = os.path.join(output_dir, os.path.basename(path2edi)) ret_edi = edi_obj.write_edi_file(new_edi_fn=new_edi_fn) print(ret_edi)
def setUpClass(cls): cls._temp_dir = make_temp_dir(cls.__name__)
def setUpClass(cls): plt.clf() cls._temp_dir = make_temp_dir(cls.__name__)
def test_create_phase_tensor_csv(self): path = make_temp_dir(self.__class__.__name__ + "_phase_tensor_csv", base_dir=self._temp_dir) self.edi_collection.create_phase_tensor_csv(path)
def test_create_mt_station_gdf(self): path = make_temp_dir(self.__class__.__name__ + "_mt_station_gdf", base_dir=self._temp_dir) self.edi_collection.create_mt_station_gdf(path)
def setUpClass(cls): reset_matplotlib() cls._temp_dir = make_temp_dir(cls.__name__)
def setUpClass(cls): _thread_lock.acquire() reset_matplotlib() cls._temp_dir = make_temp_dir(cls.__name__.split('.')[-1])
def setUpClass(cls): # setup temp dir cls._temp_dir = make_temp_dir(cls.__name__)
def test_create_phase_tensor_csv_with_image(self): path2 = make_temp_dir(self.__class__.__name__ + "_phase_tensor_csv_with_image", base_dir=self._temp_dir) self.edi_collection.create_phase_tensor_csv_with_image(path2)