A package containing file readers for XRD raw files.
Project description
fairmat-readers-xrd
A package developed by FAIRmat and collaborators that contains file readers for various X-ray diffraction (XRD) file formats.
Install and use
To use the readers, install the package using pip
and import the read_file
function. It will check the file extension and, using an appropriate file
reader, return a Python dictionary containing the data.
pip install fairmat-readers-xrd
from fairmat_readers_xrd import read_file
file_path = "<filepath>.xrdml"
data_dict = read_file(file_path)
You can also import individual file readers.
from fairmat_readers_xrd import read_panalytical_xrdml
file_path = "<filepath>.xrdml"
data_dict = read_panalytical_xrdml(file_path)
Currently, the following file extensions are supported:
File Extension | Corresponding Reader Function |
---|---|
.xrdml |
read_panalytical_xrdml |
.rasx |
read_rigaku_rasx |
.brml |
read_bruker_brml |
Development
The package is still under development. To contribute, start with simply raising an issue on the repo.
Contributing code
In case you want to contribute a piece of code, or a whole new reader, clone the repo in your local and start a virtual Python environment inside the directory.
git clone git@github.com:FAIRmat-NFDI/readers-xrd.git
cd readers-xrd
python3.9 -m venv .pyenv
source .pyenv/bin/activate
Then install the package in editable mode (-e flag), with dev
dependencies.
You can also run the pytest
to confirm all went well.
As a recommended practice, you can also install the pre-commit hook for linting (more on
this here).
python -m pip install --upgrade pip
pip install -e .[dev]
pytest
pre-commit install
Now you can start tinkering around on a new branch (or a fork).
If you want to contribute the code back to the upstream, simply create a
Pull Request (PR),
and we will get back to you. As a good practice, add tests for new readers and
make sure existing tests (pytest
) are passing before creating PR.
Ruff
We have placed GitHub actions for checking the linting. This can lead to your PR failing
the CI tests in case your code is not correctly linted or formatted.
Best way to avoid this is to use Ruff for
automatic linting and formatting.
This is already part of the dev
environment and you can run Ruff before committing:
ruff check --fix
ruff format
Ruff pre-commit hook
Additionally, we also provide pre-commit hook for Ruff. This will run Ruff every time you try to commit and raise errors (and provide fixes) in case your code needs linting or formatting. You simply have to add these fixes and commit again.
To use this pre-commit hook, make sure to run the following in the terminal after you clone the repo:
pre-commit install
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file fairmat_readers_xrd-0.0.5.tar.gz
.
File metadata
- Download URL: fairmat_readers_xrd-0.0.5.tar.gz
- Upload date:
- Size: 6.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e0b53063e0aba0a93fe5689cbef75c4da5ca1ddb77788a013955bc40aa96198 |
|
MD5 | 02b6234d697256759db141b37729abf5 |
|
BLAKE2b-256 | 22a92d9f7ca0262103e5339cc64af8e486e22ba0529242bb0c08f13aa4db3d33 |
File details
Details for the file fairmat_readers_xrd-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: fairmat_readers_xrd-0.0.5-py3-none-any.whl
- Upload date:
- Size: 22.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ead7364d2cd7568f41c02339817d7c061c252032170c63c92fd8d76feeb968c |
|
MD5 | 7bf0b570f0343286bce84038f65c7d0e |
|
BLAKE2b-256 | ad00a65fd27667472843cd0f2179a249b60e9ad9d621faf513b5c557dea910ab |