Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xy data documentation #6736

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/aiida/orm/nodes/data/array/xy.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ def set_y(
except NotExistent as exc:
raise ValueError('X array has not been set yet') from exc
# validate each of the y_arrays
for num, (y_array, y_name, y_unit) in enumerate(zip(y_arrays, y_names, y_units)):
for y_array, y_name, y_unit in zip(y_array, y_names, y_units):
self._arrayandname_validator(y_array, y_name, y_unit)
if np.shape(y_array) != np.shape(x_array):
raise ValueError(f'y_array {y_name} did not have the same shape has the x_array!')
self.set_array(f'y_array_{num}', y_array)
raise ValueError(f'y_array {y_name} does not have the same shape as the x_array!')
self.set_array(y_name, y_array)

# if the y_arrays pass the initial validation, sets each
self.base.attributes.set('y_names', y_names)
Expand Down Expand Up @@ -173,9 +173,11 @@ def get_y(self) -> list[tuple[str, 'ndarray', str]]:
except (KeyError, AttributeError):
raise NotExistent('No y units has been set yet!')
y_arrays = []
try:
for i in range(len(y_names)):
y_arrays += [self.get_array(f'y_array_{i}')]
except (KeyError, AttributeError):
raise NotExistent(f'Could not retrieve array associated with y array {y_names[i]}')
for y_name in y_names:
try:
y_array = self.get_array(y_name)
y_arrays.append((y_name, y_arrays))
except (KeyError, AttributeError):
raise NotExistent(f'Could not retrieve array associated with y array {y_name}')

return list(zip(y_names, y_arrays, y_units))
6 changes: 3 additions & 3 deletions src/aiida/transports/plugins/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -1375,9 +1375,9 @@ def rename(self, oldpath: TransportPath, newpath: TransportPath):
# why to raise an OSError if the newpath does not exist?
# ofcourse newpath shouldn't exist, that's why we are renaming it!
# issue opened here: https://github.com/aiidateam/aiida-core/issues/6725
if not self.isfile(newpath):
if not self.isdir(newpath):
raise OSError(f'Destination {newpath} does not exist')

if self.isfile(newpath) or self.isdir(newpath):
raise OSError(f'Destination {newpath} already exist')

return self.sftp.rename(oldpath, newpath)

Expand Down