def mst_calculation(ifg_paths_or_instance, params): if isinstance(ifg_paths_or_instance, list): ifgs = pre_prepare_ifgs(ifg_paths_or_instance, params) mst_grid = mst.mst_parallel(ifgs, params) else: nan_conversion = params[cf.NAN_CONVERSION] assert isinstance(ifg_paths_or_instance, matlab_mst._IfgListPyRate) ifgs = ifg_paths_or_instance.ifgs for i in ifgs: if not i.mm_converted: i.nodata_value = params[cf.NO_DATA_VALUE] i.convert_to_mm() ifg_instance_updated, epoch_list = \ get_nml(ifg_paths_or_instance, nodata_value=params[cf.NO_DATA_VALUE], nan_conversion=nan_conversion) mst_grid = matlab_mst._matlab_mst_bool(ifg_instance_updated) # write mst output to a file mst_mat_binary_file = join(params[cf.OUT_DIR], 'mst_mat') np.save(file=mst_mat_binary_file, arr=mst_grid) for i in ifgs: i.close() return mst_grid
def test_mst_multiprocessing(self): self.params[cf.PARALLEL] = True original_mst = mst.mst_boolean_array(self.ifgs) parallel_mst = mst.mst_parallel(self.ifgs, params=self.params) np.testing.assert_array_equal(original_mst, parallel_mst)