picometer 0.5.0__tar.gz → 0.6.0__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,8 +1,9 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: picometer
3
- Version: 0.5.0
3
+ Version: 0.6.0
4
4
  Summary: Precisely define and calculate measurements across multiple crystal structures
5
5
  License: MIT
6
+ License-File: LICENSE
6
7
  Author: Daniel Tchoń
7
8
  Requires-Python: >=3.10
8
9
  Classifier: License :: OSI Approved :: MIT License
@@ -11,6 +12,7 @@ Classifier: Programming Language :: Python :: 3.10
11
12
  Classifier: Programming Language :: Python :: 3.11
12
13
  Classifier: Programming Language :: Python :: 3.12
13
14
  Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Programming Language :: Python :: 3.14
14
16
  Requires-Dist: hikari-toolkit (>=0.2.3)
15
17
  Requires-Dist: numpy (>=2)
16
18
  Requires-Dist: pandas (>=2)
@@ -124,6 +126,7 @@ The following instructions are currently supported by picometer:
124
126
  - `load` model from a cif file, given `filename` or mapping syntax:
125
127
  `{path: filename.cif, block: cif_block}`.
126
128
  - `write` table with all evaluations to a csv file.
129
+ - `read` table with previous evaluation (to append further).
127
130
  - **Selection instructions**
128
131
  - `select` atoms, groups, or shapes to be used; use raw element names
129
132
  or provide symmetry relation / recenter using mapping syntax, for example:
@@ -141,8 +144,7 @@ The following instructions are currently supported by picometer:
141
144
  - fit `plane` to the currect atom / centroid selection;
142
145
  - **Evaluation instructions**
143
146
  - write out fractional `coordinates` of currently selected centroids or atoms.
144
- - write out `displacement` parameters of currently selected centroids or atoms
145
- (note: currently does not correctly handle symmetry transformations).
147
+ - write out `displacement` parameters of currently selected centroids or atoms.
146
148
  - measure `distance` between 2 selected objects; if the selection includes
147
149
  groups of atoms, measure closes distance to the group of atoms.
148
150
  - measure `angle` between 2–3 selected objects: planes, lines, or (ordered) atoms.
@@ -104,6 +104,7 @@ The following instructions are currently supported by picometer:
104
104
  - `load` model from a cif file, given `filename` or mapping syntax:
105
105
  `{path: filename.cif, block: cif_block}`.
106
106
  - `write` table with all evaluations to a csv file.
107
+ - `read` table with previous evaluation (to append further).
107
108
  - **Selection instructions**
108
109
  - `select` atoms, groups, or shapes to be used; use raw element names
109
110
  or provide symmetry relation / recenter using mapping syntax, for example:
@@ -121,8 +122,7 @@ The following instructions are currently supported by picometer:
121
122
  - fit `plane` to the currect atom / centroid selection;
122
123
  - **Evaluation instructions**
123
124
  - write out fractional `coordinates` of currently selected centroids or atoms.
124
- - write out `displacement` parameters of currently selected centroids or atoms
125
- (note: currently does not correctly handle symmetry transformations).
125
+ - write out `displacement` parameters of currently selected centroids or atoms.
126
126
  - measure `distance` between 2 selected objects; if the selection includes
127
127
  groups of atoms, measure closes distance to the group of atoms.
128
128
  - measure `angle` between 2–3 selected objects: planes, lines, or (ordered) atoms.
@@ -0,0 +1,8 @@
1
+ # read version from installed package
2
+ from importlib.metadata import PackageNotFoundError, version
3
+
4
+
5
+ try:
6
+ __version__ = version('picometer')
7
+ except PackageNotFoundError:
8
+ __version__ = '0+unknown'
@@ -176,7 +176,9 @@ class AtomSet(Shape):
176
176
  uij = self.fract_uij # shape: (n_atoms, 3, 3)
177
177
  mask = ~np.isnan(uij).all(axis=(1, 2)) # atoms with defined Uij
178
178
  if np.any(mask):
179
- uij_rot = (s := symm_op.tf) @ uij[mask] @ s.T
179
+ abc_r = [self.base.a_r, self.base.b_r, self.base.c_r]
180
+ k = np.diag([1 / a for a in abc_r]) @ symm_op.tf @ np.diag(abc_r)
181
+ uij_rot = k @ uij[mask] @ k.T
180
182
  data.loc[mask, 'U11'] = uij_rot[:, 0, 0]
181
183
  data.loc[mask, 'U22'] = uij_rot[:, 1, 1]
182
184
  data.loc[mask, 'U33'] = uij_rot[:, 2, 2]
@@ -407,6 +407,32 @@ class DihedralInstructionHandler(SerialInstructionHandler):
407
407
  logger.info(f'Evaluated dihedral {label}: {dihedral} for model state {ms_key}')
408
408
 
409
409
 
410
+ class ReadInstructionHandler(BaseInstructionHandler):
411
+ name = 'read'
412
+ kwargs = dict(path=Path)
413
+
414
+ def handle(self, instruction: Instruction) -> None:
415
+ path = Path(instruction.kwargs['path'])
416
+ paths = [path] if path.is_file() else sorted(glob(str(path)))
417
+ for path in paths:
418
+ self._read_table(str(path))
419
+
420
+ def _read_table(self, path: str) -> None:
421
+ old = self.processor.evaluation_table
422
+ new = pd.read_csv(path, index_col=0)
423
+
424
+ if old.empty:
425
+ self.processor.evaluation_table = new
426
+ else:
427
+ index = old.index.union(new.index)
428
+ columns = old.columns.union(new.columns)
429
+ old = old.reindex(index=index, columns=columns)
430
+ old.update(new)
431
+ self.processor.evaluation_table = old
432
+
433
+ logger.info(f'Loaded evaluation table from {path}')
434
+
435
+
410
436
  class WriteInstructionHandler(BaseInstructionHandler):
411
437
  name = 'write'
412
438
  kwargs = dict(path=Path)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "picometer"
3
- version = "0.5.0"
3
+ version = "0.6.0"
4
4
  description = "Precisely define and calculate measurements across multiple crystal structures"
5
5
  authors = ["Daniel Tchoń"]
6
6
  license = "MIT"
@@ -1,4 +0,0 @@
1
- # read version from installed package
2
- from importlib.metadata import version
3
-
4
- __version__ = version("picometer")
File without changes
File without changes
File without changes