Closed jfkcooper closed 2 years ago
I changed the base to develop
instead of main
. Will look at this first thing tomorrow morning. I suggest that I write the test afterward (I suspect this is good practice so that we actually test what we think we are testing you know?)
I know this is more of a comment on my older code, but I was thinking that we could move towards something like (starting at line 210):
else:
try:
data = np.loadtxt(file_path, unpack=True)
except ValueError:
data = np.loadtxt(file_path, unpack=True, delimiter=',')
if data.shape[0] == 4:
x, y, ye, xe = data
elif data.shape[0] == 3:
x, y, ye = data
xe = np.zeros_like(ye)
else:
raise ValueError("The data must have at either 3 or 4 columns if not in the ORSO format")
name = path.split(file_path)[-1].split('.')[0]
ds = DataSet1D(name=name, x=x, y=y, ye=ye, xe=xe,
model=self.parent._model_proxy._model[0],
x_label='q (1/angstrom)',
y_label='Reflectivity')
self._data.append(ds)
Thoughts?
Yeah, this is much neater
Does it run successfully?
yes, though I dont have 4 column data to hand to test it, can you send me some?
Additionally can you rebase against the latest develop
git fetch upstream
git rebase upstream/develop
git push
(I think)
This will let the tests run.
This fixes #94 by trying to load 3 column ascii files both with tab and comma separators. No tests added, but can be written if required.