picometer 0.1.1__tar.gz → 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 Daniel Tchoń
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Daniel Tchoń
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: picometer
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Precisely define and calculate measurements across multiple crystal structures
5
5
  License: MIT
6
6
  Author: Daniel Tchoń
@@ -10,11 +10,12 @@ Classifier: Programming Language :: Python :: 3
10
10
  Classifier: Programming Language :: Python :: 3.10
11
11
  Classifier: Programming Language :: Python :: 3.11
12
12
  Classifier: Programming Language :: Python :: 3.12
13
- Requires-Dist: hikari-toolkit (==0.2.3)
14
- Requires-Dist: numpy (>=2.1.2)
15
- Requires-Dist: pandas (>=2.2.3)
16
- Requires-Dist: pyyaml (>=6.0.2)
17
- Requires-Dist: uncertainties (>=3.2.2)
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Requires-Dist: hikari-toolkit (>=0.2.3)
15
+ Requires-Dist: numpy (>=2)
16
+ Requires-Dist: pandas (>=2)
17
+ Requires-Dist: pyyaml (>=5)
18
+ Requires-Dist: uncertainties (>=3)
18
19
  Description-Content-Type: text/markdown
19
20
 
20
21
  # picometer
@@ -150,7 +151,7 @@ The following instructions are currently supported by picometer:
150
151
  Interested in contributing? Check out the
151
152
  [contributing guidelines](CONTRIBUTING.md).
152
153
  Please note that this project is released with
153
- a [Code of Conduct](CONDUCT.md).
154
+ a [Code of Conduct](CODE_OF_CONDUCT).
154
155
  By contributing to this project, you agree to abide by its terms.
155
156
 
156
157
 
@@ -1,157 +1,157 @@
1
- # picometer
2
-
3
- [![PyPI version](https://img.shields.io/pypi/v/picometer)](https://pypi.org/project/picometer/)
4
- [![Python version](https://img.shields.io/pypi/pyversions/picometer.svg)](https://www.python.org/downloads/)
5
- [![codecov](https://codecov.io/gh/Baharis/picometer/graph/badge.svg?token=bWGMArFAR8)](https://codecov.io/gh/Baharis/picometer)
6
- [![CodeFactor](https://www.codefactor.io/repository/github/baharis/picometer/badge)](https://www.codefactor.io/repository/github/baharis/picometer)
7
- [![Documentation Status](https://readthedocs.org/projects/picometer/badge/?version=stable)](https://picometer.readthedocs.io/en/stable/?badge=stable)
8
- [![Gitmoji](https://img.shields.io/badge/gitmoji-%20😜%20😍-FFDD67.svg)](https://gitmoji.dev)
9
- [![tests](https://github.com/Baharis/picometer/actions/workflows/ci-cd.yml/badge.svg?branch=master)](https://github.com/Baharis/picometer/actions/workflows/ci-cd.yml)
10
-
11
- Picometer is a Python 3.10+ package which allows to define
12
- and calculate various metrics across multiple crystal structures
13
- in a clear and reproducible fashion.
14
- It is supposed to be used in tandem with a GUI program
15
- such as [Mercury](https://www.ccdc.cam.ac.uk/solutions/software/mercury/)
16
- or [Olex2](https://www.olexsys.org/olex2/)
17
- and applied on a series of cif files with consistent labelling.
18
-
19
- This is a software for you if you have ever:
20
- - Misclicked and lost your 250-atom selection,
21
- - Tried to fit or calculate metrics for any plane or line,
22
- - Spent a day measuring distances and angles in tens of similar structures,
23
- - Had to redo measurements because of an offensively minor change,
24
-
25
- Instead of relying on a graphical interface, picometer reads settings
26
- and instructions from an input [`.yaml`](https://en.wikipedia.org/wiki/YAML)
27
- file to probe one or many consistently-named structures concurrently.
28
- The results are output in a form
29
- of a [`.csv`](https://en.wikipedia.org/wiki/Comma-separated_values) file,
30
- which can be then opened in a spreadsheet editor for further analysis.
31
- Because of that, picometer is a handy tool to save time
32
- on dumb repeatable labor and focus on what really matters.
33
-
34
-
35
- ## Installation
36
-
37
- If you are installing python solely to run picometer or are not concerned
38
- about introducing additional dependencies,
39
- installing picometer is as simple as running:
40
- ```commandline
41
- pip install picometer
42
- ```
43
-
44
- However, it is advised to install picometer in a designated
45
- [virtual environment](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/#create-and-use-virtual-environments).
46
- This is best achieved by following the linked instructions,
47
- but can be otherwise summarised as follows:
48
- 1) Make sure you have Python 3.10+ installed:
49
- `python --version`
50
- 2) Create a virtual environment using i.e. venv:
51
- `python -m venv /path/to/virtual_environment`
52
- 3) Activate your virtual environment:
53
- - Windows: `\path\to\virtual_environment\Scripts\activate`
54
- - Unix/macOS: `source /path/to/virtual_environment/bin/activate`
55
- 4) Install `picometer` and its dependencies: `pip install picometer`
56
-
57
-
58
- The code is currently updated with an intention to be available for download
59
- directly from pip:
60
- ```bash
61
- $ pip install picometer
62
- ```
63
-
64
-
65
- ## Usage
66
-
67
- Whenever you want to use picometer, first re-activate the virtual environment
68
- created during installation following instructions therein.
69
- Running the program with no arguments produces the help string.
70
-
71
- ```shell
72
- python -m picometer
73
- ```
74
- ```text
75
- usage: picometer [-h] filename
76
-
77
- Precisely define and measure across multiple crystal structures
78
-
79
- positional arguments:
80
- filename Path to yaml file with routine settings and instructions
81
-
82
- options:
83
- -h, --help show this help message and exit
84
-
85
- Author: Daniel Tchoń, baharis @ GitHub
86
- ```
87
-
88
- Picometer inputs its settings and instructions from an input
89
- [`.yaml`](https://en.wikipedia.org/wiki/YAML) file.
90
- The file can contain a dictionary of `settings`,
91
- as well as a list of `instructions`.
92
- The list of instructions, called also a "routine", must include
93
- only single-element maps in the `- instruction: detail`
94
- or `- instruction: {details}` format.
95
- Examples of instruction files are available in the `tests` directory.
96
- The easiest way to generate your file is to prepare it based
97
- on the example provided.
98
-
99
-
100
- ## Instructions
101
-
102
- The following instructions are currently supported by picometer:
103
- - **Input/output instructions**
104
- - `load` model from a cif file, given `filename` or mapping syntax:
105
- `{path: filename.cif, block: cif_block}`.
106
- - `write` table with all evaluations to a csv file.
107
- - **Selection instructions**
108
- - `select` atoms, groups, or shapes to be used; use raw element names
109
- or provide symmetry relation / recenter using mapping syntax, for example:
110
- `{label: C(11), symm: x;-y;z+1/2, at: Fe(1)}`.
111
- By default, selection is cleared after calling `select` with no arguments
112
- or calling an aggregating or evaluating instruction.
113
- - `recenter` selection around a new centroid;
114
- this action is applied to every selected item individually,
115
- so to recenter fixed group of atoms, `group` them first and recenter
116
- this group - otherwise you will recenter individual atoms instead.
117
- - **Aggregation instructions**
118
- - `group` current selection into a new object with fixed elements.
119
- - fit `centroid` to the current atom / centroid selection;
120
- - fit `line` to the current atom / centroid selection;
121
- - fit `plane` to the currect atom / centroid selection;
122
- - **Evaluation instructions**
123
- - measure `distance` between 2 selected objects; if the selection includes
124
- groups of atoms, measure closes distance to the group of atoms.
125
- - measure `angle` between 2–6 selected objects; if the selection includes
126
- (ordered) atoms, calculate direct or dihedral angle between presumed bonds.
127
-
128
-
129
- ## Contributing
130
-
131
- Interested in contributing? Check out the
132
- [contributing guidelines](CONTRIBUTING.md).
133
- Please note that this project is released with
134
- a [Code of Conduct](CONDUCT.md).
135
- By contributing to this project, you agree to abide by its terms.
136
-
137
-
138
- ## License
139
-
140
- `picometer` was created by Daniel Tchoń.
141
- It is licensed under the terms of the [MIT license](LICENSE).
142
-
143
-
144
- ## Credits
145
-
146
- This software has been written as a hobby project of Daniel Tchoń
147
- (email: dtchon at lbl dot gov, or other address currectly available on
148
- https://dtools.pl/about/).
149
- All contributions and suggestions are heartily welcome!
150
-
151
- `picometer` was created with the help of
152
- [`cookiecutter`](https://cookiecutter.readthedocs.io/en/latest/)
153
- and the `py-pkgs-cookiecutter` [template](https://github.com/py-pkgs/py-pkgs-cookiecutter).
154
- It is published with the help of
155
- [`poetry`](https://python-poetry.org/),
156
- [Python Semantic Versioning](https://python-semantic-release.readthedocs.io/en/latest/),
157
- and [Gitmoji](https://gitmoji.dev/).
1
+ # picometer
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/picometer)](https://pypi.org/project/picometer/)
4
+ [![Python version](https://img.shields.io/pypi/pyversions/picometer.svg)](https://www.python.org/downloads/)
5
+ [![codecov](https://codecov.io/gh/Baharis/picometer/graph/badge.svg?token=bWGMArFAR8)](https://codecov.io/gh/Baharis/picometer)
6
+ [![CodeFactor](https://www.codefactor.io/repository/github/baharis/picometer/badge)](https://www.codefactor.io/repository/github/baharis/picometer)
7
+ [![Documentation Status](https://readthedocs.org/projects/picometer/badge/?version=stable)](https://picometer.readthedocs.io/en/stable/?badge=stable)
8
+ [![Gitmoji](https://img.shields.io/badge/gitmoji-%20😜%20😍-FFDD67.svg)](https://gitmoji.dev)
9
+ [![tests](https://github.com/Baharis/picometer/actions/workflows/ci-cd.yml/badge.svg?branch=master)](https://github.com/Baharis/picometer/actions/workflows/ci-cd.yml)
10
+
11
+ Picometer is a Python 3.10+ package which allows to define
12
+ and calculate various metrics across multiple crystal structures
13
+ in a clear and reproducible fashion.
14
+ It is supposed to be used in tandem with a GUI program
15
+ such as [Mercury](https://www.ccdc.cam.ac.uk/solutions/software/mercury/)
16
+ or [Olex2](https://www.olexsys.org/olex2/)
17
+ and applied on a series of cif files with consistent labelling.
18
+
19
+ This is a software for you if you have ever:
20
+ - Misclicked and lost your 250-atom selection,
21
+ - Tried to fit or calculate metrics for any plane or line,
22
+ - Spent a day measuring distances and angles in tens of similar structures,
23
+ - Had to redo measurements because of an offensively minor change,
24
+
25
+ Instead of relying on a graphical interface, picometer reads settings
26
+ and instructions from an input [`.yaml`](https://en.wikipedia.org/wiki/YAML)
27
+ file to probe one or many consistently-named structures concurrently.
28
+ The results are output in a form
29
+ of a [`.csv`](https://en.wikipedia.org/wiki/Comma-separated_values) file,
30
+ which can be then opened in a spreadsheet editor for further analysis.
31
+ Because of that, picometer is a handy tool to save time
32
+ on dumb repeatable labor and focus on what really matters.
33
+
34
+
35
+ ## Installation
36
+
37
+ If you are installing python solely to run picometer or are not concerned
38
+ about introducing additional dependencies,
39
+ installing picometer is as simple as running:
40
+ ```commandline
41
+ pip install picometer
42
+ ```
43
+
44
+ However, it is advised to install picometer in a designated
45
+ [virtual environment](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/#create-and-use-virtual-environments).
46
+ This is best achieved by following the linked instructions,
47
+ but can be otherwise summarised as follows:
48
+ 1) Make sure you have Python 3.10+ installed:
49
+ `python --version`
50
+ 2) Create a virtual environment using i.e. venv:
51
+ `python -m venv /path/to/virtual_environment`
52
+ 3) Activate your virtual environment:
53
+ - Windows: `\path\to\virtual_environment\Scripts\activate`
54
+ - Unix/macOS: `source /path/to/virtual_environment/bin/activate`
55
+ 4) Install `picometer` and its dependencies: `pip install picometer`
56
+
57
+
58
+ The code is currently updated with an intention to be available for download
59
+ directly from pip:
60
+ ```bash
61
+ $ pip install picometer
62
+ ```
63
+
64
+
65
+ ## Usage
66
+
67
+ Whenever you want to use picometer, first re-activate the virtual environment
68
+ created during installation following instructions therein.
69
+ Running the program with no arguments produces the help string.
70
+
71
+ ```shell
72
+ python -m picometer
73
+ ```
74
+ ```text
75
+ usage: picometer [-h] filename
76
+
77
+ Precisely define and measure across multiple crystal structures
78
+
79
+ positional arguments:
80
+ filename Path to yaml file with routine settings and instructions
81
+
82
+ options:
83
+ -h, --help show this help message and exit
84
+
85
+ Author: Daniel Tchoń, baharis @ GitHub
86
+ ```
87
+
88
+ Picometer inputs its settings and instructions from an input
89
+ [`.yaml`](https://en.wikipedia.org/wiki/YAML) file.
90
+ The file can contain a dictionary of `settings`,
91
+ as well as a list of `instructions`.
92
+ The list of instructions, called also a "routine", must include
93
+ only single-element maps in the `- instruction: detail`
94
+ or `- instruction: {details}` format.
95
+ Examples of instruction files are available in the `tests` directory.
96
+ The easiest way to generate your file is to prepare it based
97
+ on the example provided.
98
+
99
+
100
+ ## Instructions
101
+
102
+ The following instructions are currently supported by picometer:
103
+ - **Input/output instructions**
104
+ - `load` model from a cif file, given `filename` or mapping syntax:
105
+ `{path: filename.cif, block: cif_block}`.
106
+ - `write` table with all evaluations to a csv file.
107
+ - **Selection instructions**
108
+ - `select` atoms, groups, or shapes to be used; use raw element names
109
+ or provide symmetry relation / recenter using mapping syntax, for example:
110
+ `{label: C(11), symm: x;-y;z+1/2, at: Fe(1)}`.
111
+ By default, selection is cleared after calling `select` with no arguments
112
+ or calling an aggregating or evaluating instruction.
113
+ - `recenter` selection around a new centroid;
114
+ this action is applied to every selected item individually,
115
+ so to recenter fixed group of atoms, `group` them first and recenter
116
+ this group - otherwise you will recenter individual atoms instead.
117
+ - **Aggregation instructions**
118
+ - `group` current selection into a new object with fixed elements.
119
+ - fit `centroid` to the current atom / centroid selection;
120
+ - fit `line` to the current atom / centroid selection;
121
+ - fit `plane` to the currect atom / centroid selection;
122
+ - **Evaluation instructions**
123
+ - measure `distance` between 2 selected objects; if the selection includes
124
+ groups of atoms, measure closes distance to the group of atoms.
125
+ - measure `angle` between 2–6 selected objects; if the selection includes
126
+ (ordered) atoms, calculate direct or dihedral angle between presumed bonds.
127
+
128
+
129
+ ## Contributing
130
+
131
+ Interested in contributing? Check out the
132
+ [contributing guidelines](CONTRIBUTING.md).
133
+ Please note that this project is released with
134
+ a [Code of Conduct](CODE_OF_CONDUCT).
135
+ By contributing to this project, you agree to abide by its terms.
136
+
137
+
138
+ ## License
139
+
140
+ `picometer` was created by Daniel Tchoń.
141
+ It is licensed under the terms of the [MIT license](LICENSE).
142
+
143
+
144
+ ## Credits
145
+
146
+ This software has been written as a hobby project of Daniel Tchoń
147
+ (email: dtchon at lbl dot gov, or other address currectly available on
148
+ https://dtools.pl/about/).
149
+ All contributions and suggestions are heartily welcome!
150
+
151
+ `picometer` was created with the help of
152
+ [`cookiecutter`](https://cookiecutter.readthedocs.io/en/latest/)
153
+ and the `py-pkgs-cookiecutter` [template](https://github.com/py-pkgs/py-pkgs-cookiecutter).
154
+ It is published with the help of
155
+ [`poetry`](https://python-poetry.org/),
156
+ [Python Semantic Versioning](https://python-semantic-release.readthedocs.io/en/latest/),
157
+ and [Gitmoji](https://gitmoji.dev/).
@@ -1,4 +1,4 @@
1
- # read version from installed package
2
- from importlib.metadata import version
3
-
4
- __version__ = version("picometer")
1
+ # read version from installed package
2
+ from importlib.metadata import version
3
+
4
+ __version__ = version("picometer")
@@ -1,29 +1,29 @@
1
- from argparse import ArgumentParser, Namespace
2
- from picometer.routine import Routine
3
- from picometer.process import process
4
- import sys
5
-
6
-
7
- def parse_args() -> Namespace:
8
- """Parse provided arguments if program was run directly from the CLI"""
9
- desc = 'Precisely define and measure across multiple crystal structures'
10
- author = 'Author: Daniel Tchoń, baharis @ GitHub'
11
- ap = ArgumentParser(prog='picometer', description=desc, epilog=author)
12
- ap.add_argument('filename', help='Path to yaml file with routine '
13
- 'settings and instructions')
14
- if len(sys.argv) == 1:
15
- ap.print_help(sys.stderr)
16
- sys.exit(1)
17
- return ap.parse_args()
18
-
19
-
20
- def main() -> int:
21
- args = parse_args()
22
- if filename := args.filename:
23
- routine = Routine.from_yaml(filename)
24
- process(routine)
25
- return 0
26
-
27
-
28
- if __name__ == '__main__':
29
- sys.exit(main())
1
+ from argparse import ArgumentParser, Namespace
2
+ from picometer.routine import Routine
3
+ from picometer.process import process
4
+ import sys
5
+
6
+
7
+ def parse_args() -> Namespace:
8
+ """Parse provided arguments if program was run directly from the CLI"""
9
+ desc = 'Precisely define and measure across multiple crystal structures'
10
+ author = 'Author: Daniel Tchoń, baharis @ GitHub'
11
+ ap = ArgumentParser(prog='picometer', description=desc, epilog=author)
12
+ ap.add_argument('filename', help='Path to yaml file with routine '
13
+ 'settings and instructions')
14
+ if len(sys.argv) == 1:
15
+ ap.print_help(sys.stderr)
16
+ sys.exit(1)
17
+ return ap.parse_args()
18
+
19
+
20
+ def main() -> int:
21
+ args = parse_args()
22
+ if filename := args.filename:
23
+ routine = Routine.from_yaml(filename)
24
+ process(routine)
25
+ return 0
26
+
27
+
28
+ if __name__ == '__main__':
29
+ sys.exit(main())