Skip to content

Commit

Permalink
Fixed mistake in #115 and e5952b5
Browse files Browse the repository at this point in the history
Tought I made a column stack, but it turns out that `hstack` and `vstack` didn't do what I want :/.
  • Loading branch information
fzeiser committed Mar 27, 2020
1 parent a2e5f10 commit e5f7e52
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ompy/filehandling.py
Expand Up @@ -284,25 +284,29 @@ def load_txt_2D(path: Union[str, Path]


def load_numpy_1D(path: Union[str, Path]) -> Tuple[np.ndarray, np.ndarray]:
E, values = np.load(path)
vec = np.load(path)
E = vec[:, 0]
values = vec[:, 1]
return values, E


def save_numpy_1D(values: np.ndarray, E: np.ndarray,
path: Union[str, Path]) -> None:
mat = np.vstack((E, values))
mat = np.column_stack((E, values))
np.save(path, mat)


def load_txt_1D(path: Union[str, Path]) -> Tuple[np.ndarray, np.ndarray]:
E, values = np.loadtxt(path)
vec = np.loadtxt(path)
E = vec[:, 0]
values = vec[:, 1]
return values, E


def save_txt_1D(values: np.ndarray, E: np.ndarray,
path: Union[str, Path], header='E[keV] values') -> None:
""" E default in keV """
mat = np.vstack((E, values))
mat = np.column_stack([E, values])
np.savetxt(path, mat, header=header)


Expand Down

0 comments on commit e5f7e52

Please sign in to comment.