picometer 0.5.1__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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: picometer
3
- Version: 0.5.1
3
+ Version: 0.6.0
4
4
  Summary: Precisely define and calculate measurements across multiple crystal structures
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -126,6 +126,7 @@ The following instructions are currently supported by picometer:
126
126
  - `load` model from a cif file, given `filename` or mapping syntax:
127
127
  `{path: filename.cif, block: cif_block}`.
128
128
  - `write` table with all evaluations to a csv file.
129
+ - `read` table with previous evaluation (to append further).
129
130
  - **Selection instructions**
130
131
  - `select` atoms, groups, or shapes to be used; use raw element names
131
132
  or provide symmetry relation / recenter using mapping syntax, for example:
@@ -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:
@@ -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.1"
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"
File without changes
File without changes
File without changes
File without changes