Code Monkey home page Code Monkey logo

diffpy.labpdfproc's Introduction

PyPi Forge PythonVersion PR

CI Codecov Black Tracking

Tools for processing x-ray powder diffraction data from laboratory sources

  • LONGER DESCRIPTION HERE

For more information about the diffpy.labpdfproc library, please consult our online documentation.

Citation

If you use diffpy.labpdfproc in a scientific publication, we would like you to cite this package as

diffpy.labpdfproc Package, https://github.com/diffpy/diffpy.labpdfproc

Installation

The preferred method is to use Miniconda Python and install from the "conda-forge" channel of Conda packages.

To add "conda-forge" to the conda channels, run the following in a terminal.

conda config --add channels conda-forge

We want to install our packages in a suitable conda environment. The following creates and activates a new environment named diffpy.labpdfproc_env

conda create -n diffpy.labpdfproc_env python=3
conda activate diffpy.labpdfproc_env

Then, to fully install diffpy.labpdfproc in our active environment, run

conda install diffpy.labpdfproc

Another option is to use pip to download and install the latest release from Python Package Index. To install using pip into your diffpy.labpdfproc_env environment, we will also have to install dependencies

pip install -r https://raw.githubusercontent.com/diffpy/diffpy.labpdfproc/main/requirements/run.txt

and then install the package

pip install diffpy.labpdfproc

If you prefer to install from sources, after installing the dependencies, obtain the source archive from GitHub. Once installed, cd into your diffpy.labpdfproc directory and run the following

pip install .

Support and Contribute

Diffpy user group is the discussion forum for general questions and discussions about the use of diffpy.labpdfproc. Please join the diffpy.labpdfproc users community by joining the Google group. The diffpy.labpdfproc project welcomes your expertise and enthusiasm!

If you see a bug or want to request a feature, please report it as an issue and/or submit a fix as a PR. You can also post it to the Diffpy user group.

Feel free to fork the project and contribute. To install diffpy.labpdfproc in a development mode, with its sources being directly used by Python rather than copied to a package directory, use the following in the root directory

pip install -e .

To ensure code quality and to prevent accidental commits into the default branch, please set up the use of our pre-commit hooks.

  1. Install pre-commit in your working environment by running conda install pre-commit.
  2. Initialize pre-commit (one time only) pre-commit install.

Thereafter your code will be linted by black and isort and checked against flake8 before you can commit. If it fails by black or isort, just rerun and it should pass (black and isort will modify the files so should pass after they are modified). If the flake8 test fails please see the error messages and fix them manually before trying to commit again.

Improvements and fixes are always appreciated.

Before contribuing, please read our Code of Conduct.

Contact

For more information on diffpy.labpdfproc please visit the project web-page or email Prof. Simon Billinge at [email protected].

diffpy.labpdfproc's People

Contributors

yucongalicechen avatar sbillinge avatar cadenmyers13 avatar till-schertenleib avatar pre-commit-ci[bot] avatar sparks29032 avatar

Watchers

 avatar  avatar  avatar

diffpy.labpdfproc's Issues

add `--is-test` to all test commands

90% of tests will pass without the --is-test flag set, but for consistency, I suggest we add this to all the tests. It will create less confusion in the future .

overload wavelength

user can specify wavelength. If it is specified have it overload the wavelength pulled from the WAVELENGTHS set

Implement input files

The functionality works like this: first it looks for a file, then it looks for a directory and glob all files in it. It also accepts wild card and a file list (default file may be like input_file_list that contains a list of things to run on).

Examples:
lpd 2.5 jins_data.chi
lpd 2.5 ./input_dir/jins_data.chi
lpd 2.5 .
lpd 2.5 ./input_dir
lpd 2.5 .chi
lpd 2.5 input_dir/
.chi
lpd 2.5 file1.chi file10.chi
lpd 2.5 input_file_list.txt

file1.chi 2.5
file2.chi 3.5 (multiple files with different muD)
-file7.chi (specify files don’t want to read)

specify an output directory name

specify an output directory name. Expected behavior: code checks the dir is there, creates it if it isn't then and writes corrected files in there. Files exists/force behavior updated for this eventuality. Default could be "_corrected" or sthg.

muD lookup table

expected behavior:
user specifies sample composition. Given known wavelength the program computes a best effort muD. at this point make muD an optional argument. if muD and composition are given muD = args.mud, but composition is written to metadata.

If possible reuse other code for parsing/handling composition. We are doing this in getx3 already. This cannot be a dependency because it is proprietary, so maybe pull that code out into diffpy.utils?

tests

tests for everything....except the argparsing.

Implement input function to handle skipped files and check ouputs and header

  • For lists and globs, the best behavior would be to read as many files as possible and skip over the others, letting the user know which have been skipped.
  • We would like to have tests for all the same sets of inputs that were used in #48 and #55 but that check that the right correced files are written to the right places (so glob the directories after the corrections are applied and check the list is as expected).
  • Also, let's make sure that the args that are written to the file headers are correct, where the parent file is correctly identified (i.e., not just the input file list saved to the header, but also the actual file that was used for that particular correction. This will have to be set inside the loop).

user input files UCs

UC 1: single file uc.

  1. Jin has measured an x-ray pattern and wants to apply the absorption correction.
  2. Jin navigates to the folder with the file in it
  3. Jin runs pdfapp giving the name of the file
  4. pdfapp computes the cve, applies it to the datafile and writes out a new data file

UC 2: single file, remote directory

  1. as UC1.1
  2. Jin cd's to his home directory
  3. as UC1.3-1.4 except he also specifies the location of the file as well as the name

check if args.input_file is specified

check if args.input_file is specified. If not, glob the inputs directory for all readable files and correct them. skip non-readable (by loadData (or DO.load when it is written). Write outputs to output directory check if files are there or not and whether force is set. Only compute cve one time and then apply it to all the files in teh glob list.

implement not implemented options in the arg parser

I added some functionality in the parser to make the app more flexible to use. These need to be implemented:

  1. specify an output directory name. Expected behavior: code checks the dir is there, creates it if it isn't then and writes corrected files in there. Files exists/force behavior updated for this eventuality. Default could be "_corrected" or sthg.
  2. specify an inputs directory name. Default is cwd.
  3. check if args.input_file is specified. If not, glob the inputs directory for all readable files and correct them. skip non-readable (by loadData (or DO.load when it is written). Write outputs to output directory check if files are there or not and whether force is set. Only compute cve one time and then apply it to all the files in teh glob list.
  4. user can specify wavelength. If it is specified have it overload the wavelength pulled from the WAVELENGTHS set
  5. allow user to specify key-value pairs. Insert these into DO.metadata. do nothing with them, but they will be written into the header of the output chi files.
  6. load all the input parameters into metada.
  7. load the name of the package and the version number into metadata
  8. load the datetime of the analysis into metadata
  9. load the username into the metadata (try and get it from system but allow user to overload that?)
  10. as above but email of user

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.