pypsbuilder 2.4.2__tar.gz → 2.5.1__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.
Files changed (67) hide show
  1. {pypsbuilder-2.4.2 → pypsbuilder-2.5.1}/CHANGELOG.md +9 -1
  2. pypsbuilder-2.5.1/PKG-INFO +95 -0
  3. {pypsbuilder-2.4.2 → pypsbuilder-2.5.1}/README.md +21 -19
  4. pypsbuilder-2.5.1/pyproject.toml +68 -0
  5. {pypsbuilder-2.4.2 → pypsbuilder-2.5.1}/pypsbuilder/__init__.py +3 -2
  6. {pypsbuilder-2.4.2 → pypsbuilder-2.5.1}/pypsbuilder/psbuilders.py +6 -3
  7. {pypsbuilder-2.4.2 → pypsbuilder-2.5.1}/pypsbuilder/psclasses.py +18 -6
  8. {pypsbuilder-2.4.2 → pypsbuilder-2.5.1}/pypsbuilder/psexplorer.py +40 -24
  9. {pypsbuilder-2.4.2 → pypsbuilder-2.5.1}/pypsbuilder/tcapi.py +688 -482
  10. {pypsbuilder-2.4.2 → pypsbuilder-2.5.1}/pypsbuilder/tcinit.py +98 -93
  11. pypsbuilder-2.5.1/pypsbuilder/tests/test_pclasses.py +279 -0
  12. pypsbuilder-2.5.1/pypsbuilder/ui/addinv.ui +113 -0
  13. pypsbuilder-2.5.1/pypsbuilder/ui/adduni.ui +119 -0
  14. pypsbuilder-2.5.1/pypsbuilder/ui/compile_ui.sh +9 -0
  15. pypsbuilder-2.5.1/pypsbuilder/ui/ptbuilder.ui +1265 -0
  16. pypsbuilder-2.5.1/pypsbuilder/ui/pxbuilder.ui +1245 -0
  17. pypsbuilder-2.5.1/pypsbuilder/ui/txbuilder.ui +1251 -0
  18. pypsbuilder-2.5.1/pypsbuilder/ui/uniguess.ui +85 -0
  19. {pypsbuilder-2.4.2 → pypsbuilder-2.5.1}/pypsbuilder/ui_addinv.py +5 -3
  20. {pypsbuilder-2.4.2 → pypsbuilder-2.5.1}/pypsbuilder/ui_adduni.py +8 -4
  21. {pypsbuilder-2.4.2 → pypsbuilder-2.5.1}/pypsbuilder/ui_ptbuilder.py +271 -88
  22. {pypsbuilder-2.4.2 → pypsbuilder-2.5.1}/pypsbuilder/ui_pxbuilder.py +268 -87
  23. {pypsbuilder-2.4.2 → pypsbuilder-2.5.1}/pypsbuilder/ui_txbuilder.py +268 -87
  24. {pypsbuilder-2.4.2 → pypsbuilder-2.5.1}/pypsbuilder/ui_uniguess.py +8 -4
  25. pypsbuilder-2.4.2/MANIFEST.in +0 -11
  26. pypsbuilder-2.4.2/PKG-INFO +0 -294
  27. pypsbuilder-2.4.2/docs/Makefile +0 -20
  28. pypsbuilder-2.4.2/docs/api/pypsbuilder.psclasses.Dogmin.rst +0 -31
  29. pypsbuilder-2.4.2/docs/api/pypsbuilder.psclasses.InvPoint.rst +0 -34
  30. pypsbuilder-2.4.2/docs/api/pypsbuilder.psclasses.PTsection.rst +0 -41
  31. pypsbuilder-2.4.2/docs/api/pypsbuilder.psclasses.PXsection.rst +0 -41
  32. pypsbuilder-2.4.2/docs/api/pypsbuilder.psclasses.TCResult.rst +0 -30
  33. pypsbuilder-2.4.2/docs/api/pypsbuilder.psclasses.TCResultSet.rst +0 -35
  34. pypsbuilder-2.4.2/docs/api/pypsbuilder.psclasses.TXsection.rst +0 -41
  35. pypsbuilder-2.4.2/docs/api/pypsbuilder.psclasses.UniLine.rst +0 -36
  36. pypsbuilder-2.4.2/docs/api/pypsbuilder.psexplorer.PTPS.rst +0 -77
  37. pypsbuilder-2.4.2/docs/api/pypsbuilder.psexplorer.PXPS.rst +0 -74
  38. pypsbuilder-2.4.2/docs/api/pypsbuilder.psexplorer.TXPS.rst +0 -74
  39. pypsbuilder-2.4.2/docs/api/pypsbuilder.tcapi.TC34API.rst +0 -58
  40. pypsbuilder-2.4.2/docs/api/pypsbuilder.tcapi.TC35API.rst +0 -57
  41. pypsbuilder-2.4.2/docs/api.rst +0 -104
  42. pypsbuilder-2.4.2/docs/authors.rst +0 -12
  43. pypsbuilder-2.4.2/docs/command-line.rst +0 -168
  44. pypsbuilder-2.4.2/docs/conf.py +0 -181
  45. pypsbuilder-2.4.2/docs/index.rst +0 -41
  46. pypsbuilder-2.4.2/docs/installation.rst +0 -43
  47. pypsbuilder-2.4.2/docs/psbuilders-tutorial.rst +0 -238
  48. pypsbuilder-2.4.2/docs/psexplorer-tutorial.rst +0 -250
  49. pypsbuilder-2.4.2/pypsbuilder/tests/test_pclasses.py +0 -265
  50. pypsbuilder-2.4.2/pypsbuilder.egg-info/PKG-INFO +0 -294
  51. pypsbuilder-2.4.2/pypsbuilder.egg-info/SOURCES.txt +0 -56
  52. pypsbuilder-2.4.2/pypsbuilder.egg-info/dependency_links.txt +0 -1
  53. pypsbuilder-2.4.2/pypsbuilder.egg-info/entry_points.txt +0 -9
  54. pypsbuilder-2.4.2/pypsbuilder.egg-info/not-zip-safe +0 -1
  55. pypsbuilder-2.4.2/pypsbuilder.egg-info/requires.txt +0 -6
  56. pypsbuilder-2.4.2/pypsbuilder.egg-info/top_level.txt +0 -1
  57. pypsbuilder-2.4.2/setup.cfg +0 -19
  58. pypsbuilder-2.4.2/setup.py +0 -51
  59. {pypsbuilder-2.4.2 → pypsbuilder-2.5.1}/AUTHORS.md +0 -0
  60. {pypsbuilder-2.4.2 → pypsbuilder-2.5.1}/CONTRIBUTING.md +0 -0
  61. {pypsbuilder-2.4.2 → pypsbuilder-2.5.1}/LICENSE +0 -0
  62. {pypsbuilder-2.4.2 → pypsbuilder-2.5.1}/pypsbuilder/images/__init__.py +0 -0
  63. {pypsbuilder-2.4.2 → pypsbuilder-2.5.1}/pypsbuilder/images/ptbuilder.png +0 -0
  64. {pypsbuilder-2.4.2 → pypsbuilder-2.5.1}/pypsbuilder/images/pxbuilder.png +0 -0
  65. {pypsbuilder-2.4.2 → pypsbuilder-2.5.1}/pypsbuilder/images/pypsbuilder.png +0 -0
  66. {pypsbuilder-2.4.2 → pypsbuilder-2.5.1}/pypsbuilder/images/txbuilder.png +0 -0
  67. {pypsbuilder-2.4.2 → pypsbuilder-2.5.1}/pypsbuilder/tests/__init__.py +0 -0
@@ -1,9 +1,17 @@
1
1
  # Changelog
2
2
  All notable pypsbuilder changes.
3
3
 
4
+ ## [2.5.0] - 2024-12-13
5
+ Fully refactored tp pyproject.toml
6
+
7
+ ## [2.5.0] - 2024-12-13
8
+ ### Fixed
9
+ - fix for coe-q
10
+
4
11
  ## [2.4.2] - 2024-04-23
5
12
  ### Fixed
6
13
  - another fix of and-ky-sill triple point linking
14
+
7
15
  ## [2.4.1] - 2024-03-07
8
16
  ### Fixed
9
17
  - fixed and-ky-sill triple point uniline suggestions
@@ -59,7 +67,7 @@ All notable pypsbuilder changes.
59
67
  - latest THERMOCALC 3.50 compatibility
60
68
 
61
69
  ### Added
62
- - isopleths quadratic surface fit method added
70
+ - isopleths quadratic surface fit method added
63
71
  - isopleths figure and savefig options added
64
72
 
65
73
  ## [2.2.2] - 2021-01-25
@@ -0,0 +1,95 @@
1
+ Metadata-Version: 2.1
2
+ Name: pypsbuilder
3
+ Version: 2.5.1
4
+ Summary: THERMOCALC front-end for constructing and analyzing PT pseudosections
5
+ Home-page: https://github.com/ondrolexa/pypsbuilder
6
+ License: MIT
7
+ Keywords: petrology,THERMOCALC
8
+ Author: Ondrej Lexa
9
+ Author-email: lexa.ondrej@gmail.com
10
+ Requires-Python: >=3.9,<4.0
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Classifier: Topic :: Scientific/Engineering
22
+ Classifier: Topic :: Utilities
23
+ Requires-Dist: matplotlib (>=3.6,<4.0)
24
+ Requires-Dist: networkx (>=3.2,<4.0)
25
+ Requires-Dist: numpy (>=1.20,<2.0)
26
+ Requires-Dist: pyqt5 (>=5.15,<6.0)
27
+ Requires-Dist: scipy (>=1.10,<2.0)
28
+ Requires-Dist: shapely (>=2.0,<3.0)
29
+ Requires-Dist: tqdm (>=4.0,<5.0)
30
+ Project-URL: Documentation, https://pypsbuilder.readthedocs.io
31
+ Project-URL: Repository, https://github.com/ondrolexa/pypsbuilder
32
+ Description-Content-Type: text/markdown
33
+
34
+ # pypsbuilder
35
+
36
+ ![master](https://github.com/ondrolexa/pypsbuilder/actions/workflows/master.yml/badge.svg)
37
+ [![Documentation Status](https://readthedocs.org/projects/pypsbuilder/badge/?version=latest)](https://pypsbuilder.readthedocs.io/en/latest/?badge=latest)
38
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/ondrolexa/pypsbuilder/blob/master/LICENSE)
39
+ [![GitHub release (latest by date)](https://img.shields.io/github/v/release/ondrolexa/pypsbuilder)](https://github.com/ondrolexa/pypsbuilder/releases/latest)
40
+ [![Twitter](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&url=https%3A%2F%2Fgithub.com%2Fondrolexa%2Fpypsbuilder)](https://twitter.com/intent/tweet?text=Wow:&url=https%3A%2F%2Fgithub.com%2Fondrolexa%2Fpypsbuilder)
41
+
42
+ Not that simplistic THERMOCALC front-end for constructing and visualizations of P-T, T-X and P-X pseudosections
43
+
44
+ ## How to install
45
+
46
+ Easiest way to install **pypsbuilder** is to use pip:
47
+
48
+ pip install pypsbuilder
49
+
50
+ or if you downloaded pypsbuilder repository, run in unzipped folder:
51
+
52
+ pip install .
53
+
54
+ #### Install master version
55
+
56
+ You can install latest version from master branch on GitHub:
57
+
58
+ pip install https://github.com/ondrolexa/pypsbuilder/archive/master.zip
59
+
60
+ #### Upgrade existing installation
61
+
62
+ To upgrade an already installed **pypsbuilder** to the latest release:
63
+
64
+ pip install --upgrade pypsbuilder
65
+
66
+ or to latest master version:
67
+
68
+ pip install --upgrade https://github.com/ondrolexa/pypsbuilder/archive/master.zip
69
+
70
+ ### Install using conda or mamba
71
+
72
+ Create environment from the included `environment.yml` file:
73
+
74
+ conda env create -f environment.yml
75
+
76
+ or
77
+
78
+ mamba env create -f environment.yml
79
+
80
+ Then activate the new environment:
81
+
82
+ conda activate pyps
83
+
84
+ or
85
+
86
+ mamba activate pyps
87
+
88
+ ## Documentation and tutorials
89
+
90
+ Check documentation and tutorials on RTD [https://pypsbuilder.readthedocs.io/en/latest/](https://pypsbuilder.readthedocs.io/en/latest/)
91
+
92
+ ## License
93
+
94
+ pypsbuilder is free software: you can redistribute it and/or modify it under the terms of the MIT License. A copy of this license is provided in ``LICENSE`` file.
95
+
@@ -10,23 +10,7 @@ Not that simplistic THERMOCALC front-end for constructing and visualizations of
10
10
 
11
11
  ## How to install
12
12
 
13
- Easiest way to install **pypsbuilder** is to use conda/mamba package management system. Create environment from the included `environment.yml` file:
14
-
15
- conda env create -f environment.yml
16
-
17
- or
18
-
19
- mamba env create -f environment.yml
20
-
21
- Then activate the new environment:
22
-
23
- conda activate pyps
24
-
25
- or
26
-
27
- mamba activate pyps
28
-
29
- and install pypsbuilder using pip:
13
+ Easiest way to install **pypsbuilder** is to use pip:
30
14
 
31
15
  pip install pypsbuilder
32
16
 
@@ -34,13 +18,13 @@ or if you downloaded pypsbuilder repository, run in unzipped folder:
34
18
 
35
19
  pip install .
36
20
 
37
- ### Install master version
21
+ #### Install master version
38
22
 
39
23
  You can install latest version from master branch on GitHub:
40
24
 
41
25
  pip install https://github.com/ondrolexa/pypsbuilder/archive/master.zip
42
26
 
43
- ### Upgrade existing installation
27
+ #### Upgrade existing installation
44
28
 
45
29
  To upgrade an already installed **pypsbuilder** to the latest release:
46
30
 
@@ -50,6 +34,24 @@ or to latest master version:
50
34
 
51
35
  pip install --upgrade https://github.com/ondrolexa/pypsbuilder/archive/master.zip
52
36
 
37
+ ### Install using conda or mamba
38
+
39
+ Create environment from the included `environment.yml` file:
40
+
41
+ conda env create -f environment.yml
42
+
43
+ or
44
+
45
+ mamba env create -f environment.yml
46
+
47
+ Then activate the new environment:
48
+
49
+ conda activate pyps
50
+
51
+ or
52
+
53
+ mamba activate pyps
54
+
53
55
  ## Documentation and tutorials
54
56
 
55
57
  Check documentation and tutorials on RTD [https://pypsbuilder.readthedocs.io/en/latest/](https://pypsbuilder.readthedocs.io/en/latest/)
@@ -0,0 +1,68 @@
1
+ [tool.poetry]
2
+ name = "pypsbuilder"
3
+ version = "2.5.1"
4
+ description = "THERMOCALC front-end for constructing and analyzing PT pseudosections"
5
+ authors = ["Ondrej Lexa <lexa.ondrej@gmail.com>"]
6
+ readme = "README.md"
7
+ license = "MIT"
8
+ repository = "https://github.com/ondrolexa/pypsbuilder"
9
+ documentation = "https://pypsbuilder.readthedocs.io"
10
+ keywords = ["petrology", "THERMOCALC"]
11
+ classifiers = [
12
+ "Development Status :: 4 - Beta",
13
+ "Intended Audience :: Science/Research",
14
+ "Programming Language :: Python :: 3 :: Only",
15
+ "Topic :: Scientific/Engineering",
16
+ "Topic :: Utilities",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.9",
19
+ "Programming Language :: Python :: 3.10",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ ]
23
+ include = ["AUTHORS.md", "CHANGELOG.md", "CONTRIBUTING.md"]
24
+
25
+
26
+ [tool.poetry.dependencies]
27
+ python = "^3.9"
28
+ numpy = "^1.20"
29
+ matplotlib = "^3.6"
30
+ pyqt5 = "^5.15"
31
+ scipy = "^1.10"
32
+ networkx = "^3.2"
33
+ shapely = "^2.0"
34
+ tqdm = "^4.0"
35
+
36
+ [tool.poetry.group.dev.dependencies]
37
+ pytest = "^7.4"
38
+ black = "^24"
39
+
40
+ [tool.poetry.scripts]
41
+ ptbuilder = "pypsbuilder.psbuilders:ptbuilder"
42
+ txbuilder = "pypsbuilder.psbuilders:txbuilder"
43
+ pxbuilder = "pypsbuilder.psbuilders:pxbuilder"
44
+ psshow = "pypsbuilder.psexplorer:ps_show"
45
+ psiso = "pypsbuilder.psexplorer:ps_iso"
46
+ psgrid = "pypsbuilder.psexplorer:ps_grid"
47
+ psdrawpd = "pypsbuilder.psexplorer:ps_drawpd"
48
+ tcinit = "pypsbuilder.tcinit:tcprojinit"
49
+
50
+ [build-system]
51
+ requires = ["poetry-core"]
52
+ build-backend = "poetry.core.masonry.api"
53
+
54
+ [tool.black]
55
+ line-length = 88
56
+ include = '\.pyi?$'
57
+ exclude = '''
58
+ /(
59
+ \.toml
60
+ |\.sh
61
+ |\.git
62
+ |\.ini
63
+ )/
64
+ '''
65
+
66
+ [[tool.poetry.source]]
67
+ name = "pypi-public"
68
+ url = "https://pypi.org/simple/"
@@ -1,5 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
+ import importlib.metadata
3
4
  from pypsbuilder.psexplorer import PTPS, TXPS, PXPS
4
5
  from pypsbuilder.psclasses import (
5
6
  InvPoint,
@@ -22,7 +23,7 @@ __all__ = (
22
23
  "get_tcapi",
23
24
  )
24
25
 
25
- __version__ = "2.4.2"
26
+ __version__ = importlib.metadata.version("pypsbuilder")
26
27
  __author__ = "Ondrej Lexa"
27
- __copyright__ = "© Ondrej Lexa 2024"
28
+ __copyright__ = "© Ondrej Lexa 2016-2024"
28
29
  __email__ = "lexa.ondrej@gmail.com"
@@ -1,4 +1,5 @@
1
1
  """Visual pseudosection builder for THERMOCALC."""
2
+
2
3
  # author: Ondrej Lexa
3
4
  # website: https://github.com/ondrolexa/pypsbuilder
4
5
 
@@ -14,7 +15,7 @@ from pathlib import Path
14
15
  from datetime import datetime
15
16
  import itertools
16
17
 
17
- from pkg_resources import resource_filename
18
+ import importlib.resources as ires
18
19
  from PyQt5 import QtCore, QtGui, QtWidgets
19
20
  from PyQt5.QtCore import QT_VERSION_STR
20
21
  from PyQt5.Qt import PYQT_VERSION_STR
@@ -94,7 +95,9 @@ class BuildersBase(QtWidgets.QMainWindow):
94
95
  res = QtWidgets.QDesktopWidget().screenGeometry()
95
96
  self.resize(min(1280, res.width() - 10), min(720, res.height() - 10))
96
97
  self.setWindowTitle(self.builder_name)
97
- window_icon = resource_filename("pypsbuilder", app_icons[self.builder_name])
98
+ window_icon = str(
99
+ ires.files("pypsbuilder").joinpath(app_icons[self.builder_name])
100
+ )
98
101
  self.setWindowIcon(QtGui.QIcon(window_icon))
99
102
  self.__changed = False
100
103
  self.about_dialog = AboutDialog(self.builder_name, __version__, __copyright__)
@@ -5097,7 +5100,7 @@ class TopologyGraph(QtWidgets.QDialog):
5097
5100
  def __init__(self, ps, parent=None):
5098
5101
  super(TopologyGraph, self).__init__(parent)
5099
5102
  self.setWindowTitle("Topology graph")
5100
- window_icon = resource_filename("pypsbuilder", "images/pypsbuilder.png")
5103
+ window_icon = str(ires.files("pypsbuilder").joinpath("images/pypsbuilder.png"))
5101
5104
  self.setWindowIcon(QtGui.QIcon(window_icon))
5102
5105
  self.setWindowFlags(
5103
5106
  QtCore.Qt.WindowMinMaxButtonsHint | QtCore.Qt.WindowCloseButtonHint
@@ -4,6 +4,7 @@ This module contains classes and tools providing API to THERMOCALC, parsing of
4
4
  outputs and storage of calculated invariant points and univariant lines.
5
5
 
6
6
  """
7
+
7
8
  # author: Ondrej Lexa
8
9
  # website: https://github.com/ondrolexa/pypsbuilder
9
10
 
@@ -473,9 +474,11 @@ class TCResult:
473
474
  phases = head.split()[1:]
474
475
  # fixed width parsing !!!
475
476
  valsf = [
476
- float(vals[6:][12 * i : 12 * (i + 1)].strip())
477
- if vals[6:][12 * i : 12 * (i + 1)].strip() != ""
478
- else 0.0
477
+ (
478
+ float(vals[6:][12 * i : 12 * (i + 1)].strip())
479
+ if vals[6:][12 * i : 12 * (i + 1)].strip() != ""
480
+ else 0.0
481
+ )
479
482
  for i in range(len(phases))
480
483
  ]
481
484
  for phase, val in zip(phases, valsf):
@@ -484,9 +487,11 @@ class TCResult:
484
487
  head, vals = factor.split("\n")
485
488
  phases = head.split()[1:]
486
489
  valsf = [
487
- float(vals[6:][12 * i : 12 * (i + 1)].strip())
488
- if vals[6:][12 * i : 12 * (i + 1)].strip() != ""
489
- else 0.0
490
+ (
491
+ float(vals[6:][12 * i : 12 * (i + 1)].strip())
492
+ if vals[6:][12 * i : 12 * (i + 1)].strip() != ""
493
+ else 0.0
494
+ )
490
495
  for i in range(len(phases))
491
496
  ]
492
497
  for phase, val in zip(phases, valsf):
@@ -934,6 +939,13 @@ class SectionBase:
934
939
  phases = self.unilines[unilist[0]].phases.difference(
935
940
  self.unilines[unilist[0]].out
936
941
  )
942
+ if frozenset(phases) in shapes: # switch polymorph
943
+ for pp in polymorphs:
944
+ if self.unilines[unilist[0]].out.issubset(pp):
945
+ phases = self.unilines[unilist[0]].phases.difference(
946
+ pp.difference(self.unilines[unilist[0]].out)
947
+ )
948
+ break
937
949
  shapes[frozenset(phases)] = poly
938
950
  unilists[frozenset(phases)] = unilist
939
951
  elif frozenset(phases) in shapes:
@@ -17,6 +17,7 @@ Example:
17
17
  >>> pt.show()
18
18
 
19
19
  """
20
+
20
21
  # author: Ondrej Lexa 2020
21
22
  # website: https://github.com/ondrolexa/pypsbuilder
22
23
 
@@ -636,12 +637,13 @@ class PS:
636
637
  mn, mx = sys.float_info.max, -sys.float_info.max
637
638
  recs = OrderedDict()
638
639
  for key in self:
639
- d = self.collect_data(key, phase, expr, which=which)
640
- z = d["data"]
641
- if z:
642
- recs[key] = d
643
- mn = min(mn, min(z))
644
- mx = max(mx, max(z))
640
+ if phase.split("(")[0] in key:
641
+ d = self.collect_data(key, phase, expr, which=which)
642
+ z = d["data"]
643
+ if z:
644
+ recs[key] = d
645
+ mn = min(mn, min(z))
646
+ mx = max(mx, max(z))
645
647
  # res = self.grid.gridcalcs[self.grid.masks[key]]
646
648
  # if len(res) > 0:
647
649
  # if phase in res[0]['data']:
@@ -948,7 +950,7 @@ class PS:
948
950
  cgd = {}
949
951
  mn, mx = sys.float_info.max, -sys.float_info.max
950
952
  for ix, grid in self.grids.items():
951
- gd = np.empty(grid.xg.shape)
953
+ gd = np.empty(grid.xg.shape, dtype=float)
952
954
  gd[:] = np.nan
953
955
  for key in grid.masks:
954
956
  results = grid.gridcalcs[grid.masks[key] & (grid.status == 1)]
@@ -989,9 +991,12 @@ class PS:
989
991
  self,
990
992
  *args,
991
993
  interpolation=None,
994
+ colors=None,
992
995
  label=False,
993
996
  skiplabels=0,
994
997
  labelfs=6,
998
+ logerr=True,
999
+ maxerr=10,
995
1000
  geterror=False,
996
1001
  getpt=False,
997
1002
  fig=None,
@@ -1001,6 +1006,8 @@ class PS:
1001
1006
  smooth=0,
1002
1007
  alpha=0.5,
1003
1008
  lw=2,
1009
+ filename=None,
1010
+ save_kw={},
1004
1011
  ):
1005
1012
  """Function to plot root squared error of calculated and estimated values.
1006
1013
 
@@ -1013,6 +1020,7 @@ class PS:
1013
1020
  interpolation (str): matplotlib imshow interpolation method.
1014
1021
  Default None.
1015
1022
  label (bool): Whether to label divariant fields. Default False.
1023
+ logerr (bool): When True, plot logarithms of error. Default True
1016
1024
  geterror (bool): When True, calculated RMSE array is returned. Otherwise
1017
1025
  error is plotted. Deafult False
1018
1026
  getpt (bool): When True return tuple of (p, T, err) where error is minimal.
@@ -1022,6 +1030,8 @@ class PS:
1022
1030
  fig (Figure): If not None, axes are added to fig and returned.
1023
1031
  Default None
1024
1032
  fig_kw: dict passed to subplots method.
1033
+ filename: If not None, figure is saved to file
1034
+ save_kw: dict passed to savefig method.
1025
1035
  isopleths (bool): When True, searched isopleths are shown. Default False
1026
1036
  which (int): Bitopt defining from where data are collected. 0 bit -
1027
1037
  invariant points, 1 bit - uniariant lines and 2 bit - GridData
@@ -1038,7 +1048,8 @@ class PS:
1038
1048
  if len(args) % 3 == 0:
1039
1049
  if self.gridded:
1040
1050
  err = []
1041
- prop_cycle = plt.rcParams["axes.prop_cycle"]
1051
+ if colors is None:
1052
+ colors = list(mcolors.TABLEAU_COLORS.keys())[: len(args) // 3]
1042
1053
  for phase, expr, val in zip(args[::3], args[1::3], args[2::3]):
1043
1054
  if self.check_phase_expr(phase, expr):
1044
1055
  err.append(
@@ -1052,6 +1063,7 @@ class PS:
1052
1063
  )
1053
1064
 
1054
1065
  err = np.sqrt(sum(err)) / len(err)
1066
+ err[err > maxerr] = np.nan
1055
1067
  r, c = np.unravel_index(np.nanargmin(err), err.shape)
1056
1068
  p = self.yspace[r]
1057
1069
  T = self.xspace[c]
@@ -1073,13 +1085,16 @@ class PS:
1073
1085
  origin="lower",
1074
1086
  alpha=alpha,
1075
1087
  )
1076
- ax.contour(self.xspace, self.yspace, err, colors="w")
1088
+ if logerr:
1089
+ ax.contour(self.xspace, self.yspace, np.log(err), colors="w")
1090
+ else:
1091
+ ax.contour(self.xspace, self.yspace, err, colors="w")
1077
1092
  if isopleths:
1078
1093
  for phase, expr, val, cc in zip(
1079
1094
  args[::3],
1080
1095
  args[1::3],
1081
1096
  args[2::3],
1082
- prop_cycle.by_key()["color"],
1097
+ colors,
1083
1098
  ):
1084
1099
  if self.check_phase_expr(phase, expr):
1085
1100
  ax = self.isopleths_vector(
@@ -1093,9 +1108,14 @@ class PS:
1093
1108
  ax.set_ylim(self.yrange)
1094
1109
  fig.colorbar(im)
1095
1110
 
1096
- ax.set_title(f"RMSE - MinErr={minerr:g} at {T} {p}")
1111
+ ax.set_title(f"RMSE - MinErr={minerr:g} at {T:g} {p:g}")
1097
1112
  fig.tight_layout()
1098
- plt.show()
1113
+
1114
+ if filename is not None:
1115
+ plt.savefig(filename, **save_kw)
1116
+ plt.close(fig)
1117
+ else:
1118
+ plt.show()
1099
1119
  else:
1100
1120
  print("Not yet gridded...")
1101
1121
  else:
@@ -1762,10 +1782,10 @@ class PS:
1762
1782
 
1763
1783
  Example:
1764
1784
  >>> pt.overlap_isopleths(
1765
- 'g', 'xMgX', (0.07, 0.13),
1766
1785
  'g', 'xFeX', (0.51, 0.65),
1767
- 'g', 'xCaX', (0.06, 0.15),
1786
+ 'g', 'xMgX', (0.07, 0.13),
1768
1787
  'g', 'xMnX', (0.16, 0.27),
1788
+ 'g', 'xCaX', (0.06, 0.15),
1769
1789
  )
1770
1790
  """
1771
1791
  if len(args) % 3 == 0:
@@ -1779,10 +1799,7 @@ class PS:
1779
1799
  show = kwargs.get("show", None)
1780
1800
  colors = kwargs.get("colors", None)
1781
1801
  if colors is None:
1782
- cc = list(mcolors.TABLEAU_COLORS.keys())
1783
- cixs = np.random.choice(
1784
- range(len(cc)), size=len(args) // 3, replace=False
1785
- )
1802
+ colors = list(mcolors.TABLEAU_COLORS.keys())[: len(args) // 3]
1786
1803
  handles = []
1787
1804
  if fig is None:
1788
1805
  if ax is None:
@@ -1796,7 +1813,7 @@ class PS:
1796
1813
  show = False
1797
1814
  ax = fig.add_subplot()
1798
1815
  for phase, expr, levels, color in zip(
1799
- args[::3], args[1::3], args[2::3], cixs
1816
+ args[::3], args[1::3], args[2::3], colors
1800
1817
  ):
1801
1818
  ax = self.isopleths(
1802
1819
  phase,
@@ -1804,20 +1821,19 @@ class PS:
1804
1821
  levels=levels,
1805
1822
  colorbar=False,
1806
1823
  filled_over=True,
1807
- colors=[cc[color]],
1824
+ colors=[color],
1808
1825
  alpha=alpha,
1809
1826
  show=False,
1810
1827
  ax=ax,
1811
1828
  )
1812
- handles.append(
1813
- mpatches.Patch(color=cc[color], alpha=alpha, label=expr)
1814
- )
1829
+ handles.append(mpatches.Patch(color=color, alpha=alpha, label=expr))
1815
1830
  self.add_overlay(ax)
1816
1831
  ax.legend(handles=handles)
1817
1832
  # coords
1818
1833
  ax.format_coord = self.format_coord
1819
1834
  # connect button press
1820
1835
  # cid = fig.canvas.mpl_connect('button_press_event', self.onclick)
1836
+ ax.set_title(self.name)
1821
1837
  if filename is not None:
1822
1838
  plt.savefig(filename, **save_kw)
1823
1839
  plt.close(fig)
@@ -2381,7 +2397,7 @@ class PS:
2381
2397
  self.common_grid_and_masks()
2382
2398
  # interpolate on common grid
2383
2399
  recs, mn, mx = self.merge_data(phase, expr, which=which)
2384
- gd = np.empty(self.xg.shape)
2400
+ gd = np.empty(self.xg.shape, dtype=float)
2385
2401
  gd[:] = np.nan
2386
2402
  for key in recs:
2387
2403
  xmin, ymin, xmax, ymax = self.shapes[key].bounds