Skip to content

Commit

Permalink
fix loop fit
Browse files Browse the repository at this point in the history
  • Loading branch information
Rama Vasudevan committed Nov 9, 2023
1 parent 5864d59 commit da14791
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
4 changes: 2 additions & 2 deletions BGlib/be/analysis/be_loop_fitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def _read_data_chunk(self):
0]
else:
this_forc_spec_inds = np.ones(
shape=self.h5_main.h5_spec_inds.shape[1], dtype=np.bool)
shape=self.h5_main.h5_spec_inds.shape[1], dtype=bool)

if self._num_forcs:
this_forc_dc_vec = get_unit_values(
Expand Down Expand Up @@ -495,7 +495,7 @@ def _read_guess_chunk(self):
np.where(self._h5_guess.h5_spec_inds[forc_pos] == forc_ind)[0]
else:
this_forc_spec_inds = np.ones(
shape=self._h5_guess.h5_spec_inds.shape[1], dtype=np.bool)
shape=self._h5_guess.h5_spec_inds.shape[1], dtype=bool)

this_forc_2d = self._guess[:, this_forc_spec_inds]
if self.verbose and self.mpi_rank == 0:
Expand Down
30 changes: 30 additions & 0 deletions tests/be/test_be_module.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import unittest
import sys
import os
sys.path.append("../BGlib/")
import BGlib.be as belib
import pyUSID as usid
import h5py

class TestLoadDataset(unittest.TestCase):

def test_bepfm_dataset(self):
#this file is actually a corrupted BEPFM file for which the translator has an auto fix
#So we need to download the original file, see if the following works, then delete
#TODO: Host hte original file somewhere, use wget

input_file_path = r'/Users/rvv/Downloads/PTO_a32/BEPFM_1um_afterBEPS_0039.h5'
(data_dir, filename) = os.path.split(input_file_path)
# No translation here
h5_path = input_file_path
force = False # Set this to true to force patching of the datafile.
tl = belib.translators.LabViewH5Patcher()
tl.translate(h5_path, force_patch=force)
h5_file = h5py.File(h5_path, 'r+')
h5_main = usid.hdf_utils.find_dataset(h5_file, 'Raw_Data')[0]
#Let's see if we get the right type of file back...
assert type(h5_main) == usid.io.usi_data.USIDataset

def test_values_as_length(self):
print("OK")

0 comments on commit da14791

Please sign in to comment.