Skip to content

Upload *.xrdml data with author and sample info to NOMAD.

License

Notifications You must be signed in to change notification settings

PDI-Berlin/xrd_talaria

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NOMAD Talaria - XRD File Uploader to NOMAD via API

Overview

api.py script is designed to upload XRDML files to the NOMAD. You can change endpoint to your local NOMAD Oasis or to general NOMAD. It provides a simple command-line interface for users to authenticate, select a directory containing XRDML files, and upload the files to the NOMAD Lab API.

Usage

  1. Clone the repository and navigate to the project directory.
  2. Run the script using python api.py.
  3. Enter your NOMAD Lab username and password when prompted.
  4. Select a directory containing XRDML files to upload.
  5. Enter the sample name (Load Sample) for the files being uploaded.
  6. The script will upload the files to the NOMAD and prompt you if you want to upload another set of growth.
  7. Repeat steps 4-6 until you have uploaded all desired files.

Configuration

The script uses a YAML configuration file (config.yml) to store user settings. The configuration file is created automatically when you run the script for the first time.

  • directory_path: The path to the directory containing XRDML files to upload.

Classes and Functions

xrdml Class

  • modify_xrdml(file_path, user_name, sample_id): Modifies an XRDML file by updating the author name and sample ID.

nomad_api Class

  • authenticate(username, password): Authenticates a user with the NOMAD Lab API and retrieves an access token.
  • get_username_me(api_token): Retrieves the username of the authenticated user.
  • upload_files(directory_path, token, sample_id): Uploads multiple XRDML files from a specified directory to the NOMAD Lab API.
  • upload_file(file_path, token): Uploads a single file to the NOMAD Lab API.
  • get_upload_id(token): Uploads a file and retrieves its upload ID from the NOMAD Lab API.

get_directory_path(config, username): Gets the directory path for file uploads from the user or configuration.

save_config(config): Saves the configuration dictionary to a YAML file.

Notes

  • TEST_api_gui was an attempt to write a GUI program for the api.py script. It is abandoned but yet you can use it for basic fucntionalities and it is a proof of concept.
  • TEST_compress.py was to test the idea to upload the modified *.xrdml file as main and original *.xrdml data and other files as a *.7z zip file.
  • TEST_os_file_time.py was to test the idea if we can align the time of growth with time the *.xrdml file is created.

About

Upload *.xrdml data with author and sample info to NOMAD.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages