pythonQEPest 2.0.0a2__py3-none-any.whl → 2.0.0a4__py3-none-any.whl

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 (63) hide show
  1. pythonQEPest/.env.example +3 -3
  2. pythonQEPest/__init__.py +11 -11
  3. pythonQEPest/cli/__init__.py +7 -7
  4. pythonQEPest/cli/cli.py +101 -101
  5. pythonQEPest/config/__init__.py +11 -11
  6. pythonQEPest/config/config_provider.py +9 -9
  7. pythonQEPest/config/normalise.py +12 -12
  8. pythonQEPest/config/qepest_config.py +31 -31
  9. pythonQEPest/core/__init__.py +7 -7
  10. pythonQEPest/core/qepest.py +98 -98
  11. pythonQEPest/core/qepest_meta.py +28 -28
  12. pythonQEPest/data.txt +1 -1
  13. pythonQEPest/data.txt.out +2 -2
  14. pythonQEPest/dto/QEPestData.py +21 -21
  15. pythonQEPest/dto/QEPestFile.py +34 -34
  16. pythonQEPest/dto/QEPestInput.py +60 -60
  17. pythonQEPest/dto/QEPestOutput.py +13 -13
  18. pythonQEPest/dto/__init__.py +27 -27
  19. pythonQEPest/dto/coefficients/QEPestCoefficient.py +57 -57
  20. pythonQEPest/dto/coefficients/QEPestCoefficientList.py +29 -29
  21. pythonQEPest/dto/coefficients/QEPestCoefficientNumerics.py +44 -44
  22. pythonQEPest/dto/coefficients/__init__.py +7 -7
  23. pythonQEPest/dto/normalisation/Normaliser.py +15 -15
  24. pythonQEPest/dto/pest_type/PestTypeCoefficient.py +30 -30
  25. pythonQEPest/dto/pest_type/PestTypeConfig.py +9 -9
  26. pythonQEPest/dto/pest_type/__init__.py +4 -4
  27. pythonQEPest/gui/__init__.py +7 -7
  28. pythonQEPest/gui/actions/__init__.py +9 -9
  29. pythonQEPest/gui/actions/action_clicks.py +42 -42
  30. pythonQEPest/gui/actions/actions_crud.py +131 -131
  31. pythonQEPest/gui/actions/actions_other.py +126 -126
  32. pythonQEPest/gui/elements/ButtonsFrame.py +50 -50
  33. pythonQEPest/gui/elements/DataTree.py +23 -23
  34. pythonQEPest/gui/elements/EditWindow.py +63 -63
  35. pythonQEPest/gui/elements/Menu.py +12 -12
  36. pythonQEPest/gui/elements/ResultTree.py +22 -22
  37. pythonQEPest/gui/elements/SaveButton.py +10 -10
  38. pythonQEPest/gui/elements/__init__.py +17 -17
  39. pythonQEPest/gui/gui.py +87 -87
  40. pythonQEPest/gui/gui_meta.py +17 -17
  41. pythonQEPest/gui/utility/DataManager.py +76 -76
  42. pythonQEPest/gui/utility/DataManagerMeta.py +8 -8
  43. pythonQEPest/gui/utility/__init__.py +6 -6
  44. pythonQEPest/helpers/__init__.py +17 -17
  45. pythonQEPest/helpers/check_nan.py +8 -8
  46. pythonQEPest/helpers/compute_df.py +5 -5
  47. pythonQEPest/helpers/get_num_of_cols.py +2 -2
  48. pythonQEPest/helpers/get_values_from_line.py +5 -5
  49. pythonQEPest/helpers/round_to_4digs.py +2 -2
  50. pythonQEPest/logger.py +58 -58
  51. pythonQEPest/main.py +4 -4
  52. pythonQEPest/providers/__init__.py +6 -6
  53. pythonQEPest/providers/default_provider.py +23 -23
  54. pythonQEPest/providers/json_provider.py +30 -30
  55. pythonQEPest/services/QEPestFileService.py +125 -125
  56. pythonQEPest/services/__init__.py +3 -3
  57. {pythonqepest-2.0.0a2.dist-info → pythonqepest-2.0.0a4.dist-info}/METADATA +3 -1
  58. pythonqepest-2.0.0a4.dist-info/RECORD +64 -0
  59. pythonqepest-2.0.0a4.dist-info/licenses/LICENSE +21 -0
  60. pythonQEPest/providers/txt_provider.py +0 -46
  61. pythonqepest-2.0.0a2.dist-info/RECORD +0 -64
  62. {pythonqepest-2.0.0a2.dist-info → pythonqepest-2.0.0a4.dist-info}/WHEEL +0 -0
  63. {pythonqepest-2.0.0a2.dist-info → pythonqepest-2.0.0a4.dist-info}/entry_points.txt +0 -0
pythonQEPest/.env.example CHANGED
@@ -1,4 +1,4 @@
1
- LOG_LEVEL="INFO"
2
- LOG_FILE_LOCATION="logs/app.log"
3
-
1
+ LOG_LEVEL="INFO"
2
+ LOG_FILE_LOCATION="logs/app.log"
3
+
4
4
  APP_DEBUG_ENABLE="false"
pythonQEPest/__init__.py CHANGED
@@ -1,11 +1,11 @@
1
- from pythonQEPest.core import QEPest
2
- from pythonQEPest.dto import QEPestData
3
- from pythonQEPest.dto import QEPestInput
4
- from pythonQEPest.dto import QEPestOutput
5
-
6
- __all__ = [
7
- "QEPest",
8
- "QEPestData",
9
- "QEPestInput",
10
- "QEPestOutput",
11
- ]
1
+ from pythonQEPest.core import QEPest
2
+ from pythonQEPest.dto import QEPestData
3
+ from pythonQEPest.dto import QEPestInput
4
+ from pythonQEPest.dto import QEPestOutput
5
+
6
+ __all__ = [
7
+ "QEPest",
8
+ "QEPestData",
9
+ "QEPestInput",
10
+ "QEPestOutput",
11
+ ]
@@ -1,7 +1,7 @@
1
- def main():
2
- from pythonQEPest.cli.cli import main as _main
3
-
4
- return _main()
5
-
6
-
7
- __all__ = ["main"]
1
+ def main():
2
+ from pythonQEPest.cli.cli import main as _main
3
+
4
+ return _main()
5
+
6
+
7
+ __all__ = ["main"]
pythonQEPest/cli/cli.py CHANGED
@@ -1,101 +1,101 @@
1
- from __future__ import annotations
2
-
3
- import argparse
4
- import logging
5
- from importlib.metadata import PackageNotFoundError, version
6
- from pathlib import Path
7
- from typing import Sequence
8
-
9
- from pythonQEPest.dto import QEPestFile
10
- from pythonQEPest.services.QEPestFileService import QEPestFileService
11
-
12
- logger = logging.getLogger(__name__)
13
-
14
-
15
- def _resolve_package_version() -> str:
16
- try:
17
- return version("pythonQEPest")
18
- except PackageNotFoundError:
19
- pass
20
-
21
- try:
22
- import tomllib # py3.11+
23
-
24
- pyproject = Path(__file__).resolve().parents[2] / "pyproject.toml"
25
- data = tomllib.loads(pyproject.read_text(encoding="utf-8"))
26
- return data["project"]["version"]
27
- except Exception:
28
- return "0+unknown"
29
-
30
-
31
- def build_parser() -> argparse.ArgumentParser:
32
- parser = argparse.ArgumentParser(
33
- prog="pythonqepest",
34
- description="Compute QEPest scores from a tab-separated input file.",
35
- )
36
- parser.add_argument(
37
- "-v",
38
- "--version",
39
- action="version",
40
- version=f"%(prog)s {_resolve_package_version()}",
41
- help="Show program's version number.",
42
- )
43
- parser.add_argument(
44
- "-i",
45
- "--input",
46
- default="data.txt",
47
- help="Path to input tab-separated file with "
48
- + "QEPest descriptors (default: data.txt).",
49
- )
50
-
51
- parser.add_argument(
52
- "-o",
53
- "--output",
54
- default="data.out.txt",
55
- help="Path to output tab-separated file with "
56
- + "QEPest descriptors (default: data.txt.out).",
57
- )
58
-
59
- parser.add_argument(
60
- "-f",
61
- "--format",
62
- default="txt",
63
- help="Format to output file with QEPest (json, txt).",
64
- )
65
-
66
- parser.add_argument(
67
- "--smiles",
68
- action="store_true",
69
- help="Input file contains SMILES strings "
70
- "(one per line) instead of descriptors.",
71
- )
72
- return parser
73
-
74
-
75
- def main(argv: Sequence[str] | None = None) -> int:
76
- from dotenv import load_dotenv
77
-
78
- from pythonQEPest.core.qepest import QEPest
79
- from pythonQEPest.logger import init_logger
80
-
81
- args = build_parser().parse_args(argv)
82
-
83
- load_dotenv()
84
- init_logger()
85
-
86
- logger.debug("CLI initiated")
87
- logger.info(f"CLI args: {argv}")
88
-
89
- service = QEPestFileService(
90
- qepest=QEPest(),
91
- qepest_file=QEPestFile(
92
- input_file=args.input,
93
- output_file=args.output,
94
- format=args.format,
95
- smiles=args.smiles,
96
- ),
97
- )
98
-
99
- service.read_file_and_compute_params()
100
-
101
- return 0 if not service.error else 1
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ import logging
5
+ from importlib.metadata import PackageNotFoundError, version
6
+ from pathlib import Path
7
+ from typing import Sequence
8
+
9
+ from pythonQEPest.dto import QEPestFile
10
+ from pythonQEPest.services.QEPestFileService import QEPestFileService
11
+
12
+ logger = logging.getLogger(__name__)
13
+
14
+
15
+ def _resolve_package_version() -> str:
16
+ try:
17
+ return version("pythonQEPest")
18
+ except PackageNotFoundError:
19
+ pass
20
+
21
+ try:
22
+ import tomllib # py3.11+
23
+
24
+ pyproject = Path(__file__).resolve().parents[2] / "pyproject.toml"
25
+ data = tomllib.loads(pyproject.read_text(encoding="utf-8"))
26
+ return data["project"]["version"]
27
+ except Exception:
28
+ return "0+unknown"
29
+
30
+
31
+ def build_parser() -> argparse.ArgumentParser:
32
+ parser = argparse.ArgumentParser(
33
+ prog="pythonqepest",
34
+ description="Compute QEPest scores from a tab-separated input file.",
35
+ )
36
+ parser.add_argument(
37
+ "-v",
38
+ "--version",
39
+ action="version",
40
+ version=f"%(prog)s {_resolve_package_version()}",
41
+ help="Show program's version number.",
42
+ )
43
+ parser.add_argument(
44
+ "-i",
45
+ "--input",
46
+ default="data.txt",
47
+ help="Path to input tab-separated file with "
48
+ + "QEPest descriptors (default: data.txt).",
49
+ )
50
+
51
+ parser.add_argument(
52
+ "-o",
53
+ "--output",
54
+ default="data.out.txt",
55
+ help="Path to output tab-separated file with "
56
+ + "QEPest descriptors (default: data.txt.out).",
57
+ )
58
+
59
+ parser.add_argument(
60
+ "-f",
61
+ "--format",
62
+ default="txt",
63
+ help="Format to output file with QEPest (json, txt).",
64
+ )
65
+
66
+ parser.add_argument(
67
+ "--smiles",
68
+ action="store_true",
69
+ help="Input file contains SMILES strings "
70
+ "(one per line) instead of descriptors.",
71
+ )
72
+ return parser
73
+
74
+
75
+ def main(argv: Sequence[str] | None = None) -> int:
76
+ from dotenv import load_dotenv
77
+
78
+ from pythonQEPest.core.qepest import QEPest
79
+ from pythonQEPest.logger import init_logger
80
+
81
+ args = build_parser().parse_args(argv)
82
+
83
+ load_dotenv()
84
+ init_logger()
85
+
86
+ logger.debug("CLI initiated")
87
+ logger.info(f"CLI args: {argv}")
88
+
89
+ service = QEPestFileService(
90
+ qepest=QEPest(),
91
+ qepest_file=QEPestFile(
92
+ input_file=args.input,
93
+ output_file=args.output,
94
+ format=args.format,
95
+ smiles=args.smiles,
96
+ ),
97
+ )
98
+
99
+ service.read_file_and_compute_params()
100
+
101
+ return 0 if not service.error else 1
@@ -1,11 +1,11 @@
1
- from pythonQEPest.config.qepest_default import qepest_default
2
- from pythonQEPest.config.normalise import normalise_default
3
- from pythonQEPest.config.qepest_config import QEPestConfig
4
- from pythonQEPest.config.config_provider import ConfigProvider
5
-
6
- __all__ = [
7
- "normalise_default",
8
- "qepest_default",
9
- "ConfigProvider",
10
- "QEPestConfig",
11
- ]
1
+ from pythonQEPest.config.qepest_default import qepest_default
2
+ from pythonQEPest.config.normalise import normalise_default
3
+ from pythonQEPest.config.qepest_config import QEPestConfig
4
+ from pythonQEPest.config.config_provider import ConfigProvider
5
+
6
+ __all__ = [
7
+ "normalise_default",
8
+ "qepest_default",
9
+ "ConfigProvider",
10
+ "QEPestConfig",
11
+ ]
@@ -1,9 +1,9 @@
1
- from abc import ABC, abstractmethod
2
-
3
- from pythonQEPest.config.qepest_config import QEPestConfig
4
-
5
-
6
- class ConfigProvider(ABC):
7
- @abstractmethod
8
- def load(self) -> QEPestConfig:
9
- pass
1
+ from abc import ABC, abstractmethod
2
+
3
+ from pythonQEPest.config.qepest_config import QEPestConfig
4
+
5
+
6
+ class ConfigProvider(ABC):
7
+ @abstractmethod
8
+ def load(self) -> QEPestConfig:
9
+ pass
@@ -1,12 +1,12 @@
1
- normalise_default = {
2
- "herb": (69.5849922, 94.4228257, 120.4572352, 228.1589796, 89.7012502, 276.9634213),
3
- "insect": (
4
- 78.2919965,
5
- 71.2829691,
6
- 133.9224801,
7
- 331.170104,
8
- 70.5540709,
9
- 193.0023343,
10
- ),
11
- "fung": (53.3719946, 52.773116, 73.7976536, 144.9887053, 41.4385926, 102.3024319),
12
- }
1
+ normalise_default = {
2
+ "herb": (69.5849922, 94.4228257, 120.4572352, 228.1589796, 89.7012502, 276.9634213),
3
+ "insect": (
4
+ 78.2919965,
5
+ 71.2829691,
6
+ 133.9224801,
7
+ 331.170104,
8
+ 70.5540709,
9
+ 193.0023343,
10
+ ),
11
+ "fung": (53.3719946, 52.773116, 73.7976536, 144.9887053, 41.4385926, 102.3024319),
12
+ }
@@ -1,31 +1,31 @@
1
- from typing import Optional
2
-
3
- from pydantic import BaseModel
4
-
5
- from pythonQEPest.dto.pest_type.PestTypeConfig import PestTypeConfig
6
-
7
-
8
- class QEPestConfig(BaseModel):
9
- name: Optional[str] = "HerbInsectFung"
10
- pest_types: list[PestTypeConfig]
11
-
12
- def get_pest_names(self) -> list[str]:
13
- return [pest.name for pest in self.pest_types]
14
-
15
- def get_coefficients(
16
- self, pest_name: str
17
- ) -> list[tuple[float, float, float, float]]:
18
- for pest in self.pest_types:
19
- if pest.name == pest_name:
20
- return pest.coefficients.as_set()
21
-
22
- raise ValueError(f"Pest type '{pest_name}' not found")
23
-
24
- def get_normaliser(
25
- self, pest_name: str
26
- ) -> tuple[float, float, float, float, float, float]:
27
- for pest in self.pest_types:
28
- if pest.name == pest_name:
29
- return pest.normaliser
30
-
31
- raise ValueError(f"Pest type '{pest_name}' not found")
1
+ from typing import Optional
2
+
3
+ from pydantic import BaseModel
4
+
5
+ from pythonQEPest.dto.pest_type.PestTypeConfig import PestTypeConfig
6
+
7
+
8
+ class QEPestConfig(BaseModel):
9
+ name: Optional[str] = "HerbInsectFung"
10
+ pest_types: list[PestTypeConfig]
11
+
12
+ def get_pest_names(self) -> list[str]:
13
+ return [pest.name for pest in self.pest_types]
14
+
15
+ def get_coefficients(
16
+ self, pest_name: str
17
+ ) -> list[tuple[float, float, float, float]]:
18
+ for pest in self.pest_types:
19
+ if pest.name == pest_name:
20
+ return pest.coefficients.as_set()
21
+
22
+ raise ValueError(f"Pest type '{pest_name}' not found")
23
+
24
+ def get_normaliser(
25
+ self, pest_name: str
26
+ ) -> tuple[float, float, float, float, float, float]:
27
+ for pest in self.pest_types:
28
+ if pest.name == pest_name:
29
+ return pest.normaliser
30
+
31
+ raise ValueError(f"Pest type '{pest_name}' not found")
@@ -1,7 +1,7 @@
1
- from .qepest import QEPest
2
- from .qepest_meta import QEPestMeta
3
-
4
- __all__ = [
5
- "QEPestMeta",
6
- "QEPest",
7
- ]
1
+ from .qepest import QEPest
2
+ from .qepest_meta import QEPestMeta
3
+
4
+ __all__ = [
5
+ "QEPestMeta",
6
+ "QEPest",
7
+ ]
@@ -1,98 +1,98 @@
1
- import logging
2
- import math
3
- from typing import Optional
4
-
5
- from pythonQEPest.config import ConfigProvider
6
- from pythonQEPest.core.qepest_meta import QEPestMeta
7
- from pythonQEPest.config.qepest_config import QEPestConfig
8
- from pythonQEPest.dto import QEPestData
9
-
10
- from pythonQEPest.dto.QEPestInput import QEPestInput
11
- from pythonQEPest.dto.QEPestOutput import QEPestOutput
12
- from pythonQEPest.dto.normalisation.Normaliser import Normaliser
13
- from pythonQEPest.helpers.check_nan import check_nan
14
- from pythonQEPest.helpers.compute_df import compute_df
15
- from pythonQEPest.helpers.get_values_from_line import get_values_from_line
16
- from pythonQEPest.helpers.round_to_4digs import round_to_4digs
17
- from pythonQEPest.providers import DefaultConfigProvider
18
-
19
- logger = logging.getLogger(__name__)
20
-
21
-
22
- class QEPest(QEPestMeta):
23
- def __init__(self, provider: Optional[ConfigProvider] = None, *args, **kwargs):
24
- super().__init__(*args, **kwargs)
25
-
26
- self.config: QEPestConfig
27
- self.normalisers: dict[str, Normaliser] = {}
28
- self.qex: QEPestData = QEPestData({})
29
-
30
- logger.debug("QEPest initialization")
31
-
32
- self.initialise_config(provider)
33
-
34
- logger.debug("QEPest initialization successful")
35
-
36
- def initialise_config(self, provider: Optional[ConfigProvider] = None):
37
- logger.debug("Config initialisation")
38
- if provider is None:
39
- logger.debug("Config is empty. Loading default one.")
40
- provider = DefaultConfigProvider()
41
-
42
- self.config = provider.load()
43
- logger.debug(f"Config {self.config} loaded")
44
-
45
- for pest in self.config.pest_types:
46
- self.normalisers[pest.name] = Normaliser(pest.normaliser)
47
-
48
- def _log_compute_df(
49
- self, func, index: int, lst: list[float], data_lst: list
50
- ) -> float:
51
- df_result = compute_df(lst[index], *data_lst[index])
52
- return math.log(func(df_result, index))
53
-
54
- def get_names(self) -> list[str]:
55
- return self.config.get_pest_names()
56
-
57
- def compute_params(self, data_input: QEPestInput) -> QEPestOutput:
58
- self.get_qex_values(
59
- get_values_from_line(list(data_input.model_dump().values()))
60
- )
61
- return QEPestOutput(data=self.qex, name=data_input.name)
62
-
63
- def get_qex_values(self, d: list[float]) -> QEPestData:
64
- names = self.get_names()
65
-
66
- if len(names) == 0:
67
- raise ValueError(
68
- "No pest types configured. " "Please provide a valid configuration."
69
- )
70
-
71
- qe_values = dict.fromkeys(names, 0.0)
72
-
73
- d_num = len(d)
74
- for i in range(d_num):
75
- for name in names:
76
- coeffs = self.config.get_coefficients(name)
77
- normaliser = self.normalisers[name]
78
- qe_values[name] += self._log_compute_df(
79
- func=normaliser.norm,
80
- index=i,
81
- lst=d,
82
- data_lst=coeffs,
83
- )
84
-
85
- result = [round_to_4digs(math.exp(qe_values[name] / d_num)) for name in names]
86
-
87
- result = check_nan(result)
88
-
89
- self.qex = QEPestData(
90
- {f"qe_{name}": result[idx] for idx, name in enumerate(names)}
91
- )
92
-
93
- return self.qex
94
-
95
-
96
- if __name__ == "__main__":
97
- qepest = QEPest()
98
- qepest.get_qex_values([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0])
1
+ import logging
2
+ import math
3
+ from typing import Optional
4
+
5
+ from pythonQEPest.config import ConfigProvider
6
+ from pythonQEPest.core.qepest_meta import QEPestMeta
7
+ from pythonQEPest.config.qepest_config import QEPestConfig
8
+ from pythonQEPest.dto import QEPestData
9
+
10
+ from pythonQEPest.dto.QEPestInput import QEPestInput
11
+ from pythonQEPest.dto.QEPestOutput import QEPestOutput
12
+ from pythonQEPest.dto.normalisation.Normaliser import Normaliser
13
+ from pythonQEPest.helpers.check_nan import check_nan
14
+ from pythonQEPest.helpers.compute_df import compute_df
15
+ from pythonQEPest.helpers.get_values_from_line import get_values_from_line
16
+ from pythonQEPest.helpers.round_to_4digs import round_to_4digs
17
+ from pythonQEPest.providers import DefaultConfigProvider
18
+
19
+ logger = logging.getLogger(__name__)
20
+
21
+
22
+ class QEPest(QEPestMeta):
23
+ def __init__(self, provider: Optional[ConfigProvider] = None, *args, **kwargs):
24
+ super().__init__(*args, **kwargs)
25
+
26
+ self.config: QEPestConfig
27
+ self.normalisers: dict[str, Normaliser] = {}
28
+ self.qex: QEPestData = QEPestData({})
29
+
30
+ logger.debug("QEPest initialization")
31
+
32
+ self.initialise_config(provider)
33
+
34
+ logger.debug("QEPest initialization successful")
35
+
36
+ def initialise_config(self, provider: Optional[ConfigProvider] = None):
37
+ logger.debug("Config initialisation")
38
+ if provider is None:
39
+ logger.debug("Config is empty. Loading default one.")
40
+ provider = DefaultConfigProvider()
41
+
42
+ self.config = provider.load()
43
+ logger.debug(f"Config {self.config} loaded")
44
+
45
+ for pest in self.config.pest_types:
46
+ self.normalisers[pest.name] = Normaliser(pest.normaliser)
47
+
48
+ def _log_compute_df(
49
+ self, func, index: int, lst: list[float], data_lst: list
50
+ ) -> float:
51
+ df_result = compute_df(lst[index], *data_lst[index])
52
+ return math.log(func(df_result, index))
53
+
54
+ def get_names(self) -> list[str]:
55
+ return self.config.get_pest_names()
56
+
57
+ def compute_params(self, data_input: QEPestInput) -> QEPestOutput:
58
+ self.get_qex_values(
59
+ get_values_from_line(list(data_input.model_dump().values()))
60
+ )
61
+ return QEPestOutput(data=self.qex, name=data_input.name)
62
+
63
+ def get_qex_values(self, d: list[float]) -> QEPestData:
64
+ names = self.get_names()
65
+
66
+ if len(names) == 0:
67
+ raise ValueError(
68
+ "No pest types configured. " "Please provide a valid configuration."
69
+ )
70
+
71
+ qe_values = dict.fromkeys(names, 0.0)
72
+
73
+ d_num = len(d)
74
+ for i in range(d_num):
75
+ for name in names:
76
+ coeffs = self.config.get_coefficients(name)
77
+ normaliser = self.normalisers[name]
78
+ qe_values[name] += self._log_compute_df(
79
+ func=normaliser.norm,
80
+ index=i,
81
+ lst=d,
82
+ data_lst=coeffs,
83
+ )
84
+
85
+ result = [round_to_4digs(math.exp(qe_values[name] / d_num)) for name in names]
86
+
87
+ result = check_nan(result)
88
+
89
+ self.qex = QEPestData(
90
+ {f"qe_{name}": result[idx] for idx, name in enumerate(names)}
91
+ )
92
+
93
+ return self.qex
94
+
95
+
96
+ if __name__ == "__main__":
97
+ qepest = QEPest()
98
+ qepest.get_qex_values([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0])
@@ -1,28 +1,28 @@
1
- import os
2
- from abc import abstractmethod, ABC
3
-
4
- from pydantic import BaseModel
5
-
6
- from pythonQEPest.dto import QEPestInput, QEPestOutput
7
-
8
-
9
- class QEPestMeta(ABC):
10
- def __init__(self, *args, **kwargs):
11
- self.qex: BaseModel | None = None
12
-
13
- self.col_number: int = 7
14
- self.dir: str = os.getcwd()
15
-
16
- @abstractmethod
17
- def compute_params(self, data_input: QEPestInput) -> QEPestOutput:
18
- pass
19
-
20
- @abstractmethod
21
- def get_qex_values(self, d: list[float]) -> None:
22
- pass
23
-
24
- @abstractmethod
25
- def _log_compute_df(
26
- self, func, index: int, lst: list[float], data_lst: list
27
- ) -> float:
28
- pass
1
+ import os
2
+ from abc import abstractmethod, ABC
3
+
4
+ from pydantic import BaseModel
5
+
6
+ from pythonQEPest.dto import QEPestInput, QEPestOutput
7
+
8
+
9
+ class QEPestMeta(ABC):
10
+ def __init__(self, *args, **kwargs):
11
+ self.qex: BaseModel | None = None
12
+
13
+ self.col_number: int = 7
14
+ self.dir: str = os.getcwd()
15
+
16
+ @abstractmethod
17
+ def compute_params(self, data_input: QEPestInput) -> QEPestOutput:
18
+ pass
19
+
20
+ @abstractmethod
21
+ def get_qex_values(self, d: list[float]) -> None:
22
+ pass
23
+
24
+ @abstractmethod
25
+ def _log_compute_df(
26
+ self, func, index: int, lst: list[float], data_lst: list
27
+ ) -> float:
28
+ pass
pythonQEPest/data.txt CHANGED
@@ -1,2 +1,2 @@
1
- Name MW LogP HBA HBD RB arR
1
+ Name MW LogP HBA HBD RB arR
2
2
  Nc1nc2CCCC3O[C@H](CCC)C(=O)c(n1)c23 247.29799999999994 1.8178 5 1 2 1
pythonQEPest/data.txt.out CHANGED
@@ -1,2 +1,2 @@
1
- Name QEH QEI QEF
2
- Nc1nc2CCCC3O[C@H](CCC)C(=O)c(n1)c23 0.7387 0.4635 0.5941
1
+ Name QEH QEI QEF
2
+ Nc1nc2CCCC3O[C@H](CCC)C(=O)c(n1)c23 0.7387 0.4635 0.5941