nomad_camels.nomad_integration package
Submodules
nomad_camels.nomad_integration.entry_selection module
- class nomad_camels.nomad_integration.entry_selection.EntrySelector(parent=None, selection='Sample')
Bases:
QDialog
- accept(self) None
- entry_change()
- entry_filtering()
- get_current_entry_data(include_metadata=False)
- staticMetaObject = PySide6.QtCore.QMetaObject("EntrySelector" inherits "QDialog": )
- update_entries()
nomad_camels.nomad_integration.file_uploading module
- class nomad_camels.nomad_integration.file_uploading.UploadDialog(parent=None, file_set='', upload_path='')
Bases:
QDialog
UI widget to handle uploading data to NOMAD.
- accept() None
“Before calling the super method, the upload is done.
- staticMetaObject = PySide6.QtCore.QMetaObject("UploadDialog" inherits "QDialog": )
nomad_camels.nomad_integration.nomad_communication module
This module provides functions for communicating with NOMAD.
- nomad_camels.nomad_integration.nomad_communication.check_response(response, fail_info='')
Checks the given response from NOMAD and raises an Exception if the request did not work.
- Parameters:
response (requests.Response) – Response from the server. Its status code will be checked.
fail_info (str) – (Default value = ‘’) If this string is not empty, it will display as the first part of the raised exception. Useful to specify, what went wrong.
- nomad_camels.nomad_integration.nomad_communication.correct_timestamp(file_path)
Corrects the timestamp in the file path to be compatible with NOMAD. Replaces the plus symbol with p.
- nomad_camels.nomad_integration.nomad_communication.ensure_login(parent=None)
Is always the first function to be called. Thus this function updates possible changes in the used NOMAD URL. If the URL is different to the last used one, logout_of_nomad is called. Then, if token is empty, login_to_nomad is called.
- Parameters:
parent (QWidget) – the parent widget for the login dialog of login_to_nomad
- nomad_camels.nomad_integration.nomad_communication.get_entries(parent=None, owner='user')
Retrieves the entries of the currently logged in user.
- Parameters:
parent (QWidget) – the parent widget for the login dialog of login_to_nomad (if needed)
owner (str) – The owner of the entries. Allowed values are ‘public’, ‘all’, ‘visible’, ‘shared’, ‘user’, ‘staging’, ‘admin’. Default is ‘user’.
- nomad_camels.nomad_integration.nomad_communication.get_user_information(parent=None)
Retrieves the information of the logged in user.
- Parameters:
parent (QWidget) – the parent widget for the login dialog of login_to_nomad (if needed)
- Return type:
the response’s data, i.e. the user information
- nomad_camels.nomad_integration.nomad_communication.get_user_upload_names(parent=None)
Provides a list of the uploads belonging to the logged in user by their name.
- Parameters:
parent (QWidget) – the parent widget for the login dialog of login_to_nomad
- Returns:
the names of the uploads belonging to the user
- Return type:
list[str]
- nomad_camels.nomad_integration.nomad_communication.get_user_uploads(parent=None)
Provides the uploads of the logged in user. If there is no login token, login_to_nomad will be called.
- Parameters:
parent (QWidget) – the parent widget for the login dialog of login_to_nomad
- Return type:
the user’s uploads
- nomad_camels.nomad_integration.nomad_communication.login_to_nomad(parent=None)
Opens a login dialog and uses the resulting username/password to login to NOMAD. The received authentication token is saved to the module’s global variable token.
- Parameters:
parent (QWidget) – the parent widget for the login dialog
- Return type:
the authentication token
- nomad_camels.nomad_integration.nomad_communication.logout_of_nomad()
Resets the global token to an empty string, thus logging out of NOMAD.
- nomad_camels.nomad_integration.nomad_communication.make_correct_url(url=None)
- nomad_camels.nomad_integration.nomad_communication.upload_file(file, upload_name, upload_path='CAMELS_data', overwrite_if_exists=True, parent=None)
Uploads a file into a given NOMAD upload.
- Parameters:
file (str, path) – the path of the file that should be uploaded
upload_name (str) – the upload_name or upload_id of the upload, where the file should go
upload_path (str) – (Default value = ‘CAMELS_data’) the path inside the upload on NOMAD where the file should go
overwrite_if_exists (bool) – (Default value = True) if set to True , overwrites the file if it already exists
parent (QWidget) – the parent widget for the login dialog of login_to_nomad (if needed)