Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
8fff14e
structure: moved some files to _old_ directory
f1i3g3 Sep 24, 2025
1ac1ce1
fix: small fix
f1i3g3 Sep 24, 2025
59f6606
fix: updated pysatl_criterion
f1i3g3 Sep 24, 2025
5fb1f96
fix: updated dependencies
f1i3g3 Sep 24, 2025
07eba89
fix: updated ci.yaml
f1i3g3 Sep 25, 2025
4a04d88
fix: updated dependencies
f1i3g3 Sep 25, 2025
ae42fc6
feat: implemented experiments' PostgreSQL data base + some tests for it
f1i3g3 Sep 25, 2025
3b2456f
fix: added missing interfaces
f1i3g3 Sep 25, 2025
c3071f5
docs: added myself to authors
f1i3g3 Sep 29, 2025
a43c024
deps: added psycopg2 to dependencies
f1i3g3 Sep 29, 2025
bd250f3
fix: grammar fix
f1i3g3 Oct 5, 2025
da99fad
feat: stub for internal storage commands
f1i3g3 Oct 5, 2025
a724c05
feat: stub for internal storage commands
f1i3g3 Oct 5, 2025
a324ba4
structure: changed storage structure
f1i3g3 Oct 5, 2025
d33af14
fix: experiment test updated
f1i3g3 Oct 5, 2025
fd90442
feat: added storage error
f1i3g3 Oct 5, 2025
19a668e
feat: power storage + stub for tests
f1i3g3 Oct 5, 2025
f2f62b3
feat: stub for random values storage tests
f1i3g3 Oct 5, 2025
e92852c
feat: time complexity PostgreSQL storage + stub for tests
f1i3g3 Oct 5, 2025
e0654b7
structure: resolving merge conflict
f1i3g3 Oct 5, 2025
d282b45
fix: toml fix
f1i3g3 Oct 5, 2025
8d953a9
fix: toml fix
f1i3g3 Oct 5, 2025
4ce4e79
tests: added stubs for sqlite storages tests
f1i3g3 Oct 6, 2025
11a2164
fix: small changes
f1i3g3 Oct 10, 2025
642ab80
fix: changed pyproject.toml
f1i3g3 Oct 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
python-version: ["3.11", "3.12", "3.13"]

steps:
- name: Checkout repository
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Exceptions:

- Minor corrections and fixes to pull requests submitted by others.
- While making a formal release, the release manager can make necessary, appropriate changes.
- Small documentation changes that reinforce existing subject matter. Most commonly being, but not limited to spelling and grammar corrections.
- Small documentation changes that reinforce existing subject. Most commonly being, but not limited to spelling and grammar corrections.

### Responsibilities

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 11 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
name = "pysatl-experiment"
version = "0.1.0"
description = "package for PySATL math statistics experiments"
authors = ["Ivan Pokhabov <vanek3372@gmail.com>"]
license = "MIT"
authors = ["Ivan Pokhabov <vanek3372@gmail.com>",
"Dmitrii Kuznetsov <dmitrvlkuznetsov@gmail.com>"]
readme = "README.md"
package-mode = true
packages = [{include = "pysatl_experiment"}]

[tool.poetry.dependencies]
python = ">=3.10,<3.13"
python = ">=3.11,<3.13"
numpy = ">=1.25.1"
scipy = ">=1.11.2"
matplotlib = ">=3.8.0"
Expand All @@ -25,6 +26,7 @@ rich = "==13.9.4"
click = ">=8.2.1"
dacite = "==1.9.2"
line_profiler = "5.0.0"
psycopg2 = ">=2.9.10"
pysatl-criterion = {path = "./pysatl_criterion"}

[tool.poetry.group.dev.dependencies]
Expand All @@ -33,6 +35,7 @@ mkdocs = "1.6.1"
mkdocs-material = "9.6.14"
mdx-truly-sane-lists = "1.3"
pymdown-extensions = "10.15"
jinja2 = "3.1.6"
mike = "2.1.3"
isort = "6.0.1"
coveralls = "4.0.1"
Expand All @@ -43,6 +46,7 @@ ruff = "0.11.12"
pytest-mock = "3.14.1"
pre-commit = "4.2.0"
mypy = "^1.15.0"
psycopg2 = "2.9.10"

[tool.poetry.scripts]
experiment = "pysatl_experiment.cli.cli.cli:cli"
Expand Down Expand Up @@ -80,5 +84,8 @@ max-complexity = 12
[tool.ruff.lint.isort]
lines-after-imports = 2

[tool.mypy]
ignore_missing_imports = true
[tool.flake8]
ignore = ["E121", "E123", "E126", "E24", "E203", "E704", "W503", "W504"]
max-line-length = 120
max-complexity = 12
exclude = [".git", "__pycache__", ".eggs", "user_data", ".venv", ".env"]
2 changes: 1 addition & 1 deletion pysatl_criterion
Submodule pysatl_criterion updated 33 files
+1 −1 .github/workflows/ci.yaml
+4 −2 pyproject.toml
+19 −34 pysatl_criterion/cv_calculator/cv_calculator/cv_calculator.py
+7 −0 pysatl_criterion/multiple_testing/__init__.py
+39 −0 pysatl_criterion/multiple_testing/abstract_multiple_testing.py
+0 −0 pysatl_criterion/multiple_testing/fdr.py
+99 −0 pysatl_criterion/multiple_testing/fwer.py
+0 −0 pysatl_criterion/multiple_testing/special_multiple_testing.py
+0 −0 pysatl_criterion/p_value_calculator/__init__.py
+61 −0 pysatl_criterion/p_value_calculator/p_value_calculator/p_value_calculator.py
+97 −0 pysatl_criterion/persistence/limit_distribution/datastorage/datastorage.py
+2 −2 pysatl_criterion/persistence/limit_distribution/sqlite/sqlite.py
+66 −0 pysatl_criterion/persistence/model/orm/orm.py
+392 −0 ...terion/persistence/parameter_estimation/maximum_likelihood_method/function_for_maximum_likelihood_method.py
+33 −0 pysatl_criterion/persistence/parameter_estimation/maximum_likelihood_method/maximum_likelihood_method.py
+42 −34 pysatl_criterion/statistics/exponent.py
+88 −16 pysatl_criterion/statistics/graph_goodness_of_fit.py
+34 −18 pysatl_criterion/statistics/models.py
+41 −27 pysatl_criterion/statistics/normal.py
+32 −18 pysatl_criterion/test/goodness_of_fit_test/goodness_of_fit_test.py
+79 −0 tests/calc/test_cv.py
+114 −0 tests/calc/test_goodness_of_fit_test.py
+115 −0 tests/calc/test_p_value.py
+0 −0 tests/multiple_testing/test_fdr.py
+98 −0 tests/multiple_testing/test_fwer.py
+0 −0 tests/multiple_testing/test_special_multiple_testing.py
+19 −0 tests/persistence/limit_distribution/datastorage/datastorage_test.py
+142 −0 tests/persistence/limit_distribution/limit_distribution_test.py
+62 −0 tests/persistence/limit_distribution/sqlite/sqlite_test.py
+53 −4 tests/statistics/test_exponent.py
+520 −0 tests/statistics/test_function_for_maximum_likelihood_method.py
+46 −0 tests/statistics/test_hypothesis_type.py
+49 −4 tests/statistics/test_normal.py
2 changes: 2 additions & 0 deletions pysatl_experiment/cli/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from pysatl_experiment.cli.commands.configure.show.show import show
from pysatl_experiment.cli.commands.configure.significance_levels.significance_levels import significance_levels
from pysatl_experiment.cli.commands.configure.storage_connection.storage_connection import storage_connection
from pysatl_experiment.cli.commands.configure.storage_type.storage_type import storage_type
from pysatl_experiment.cli.commands.create.create import create
from pysatl_experiment.cli.shared import cli

Expand All @@ -28,6 +29,7 @@
cli.add_command(generator_type)
cli.add_command(executor_type)
cli.add_command(report_builder_type)
cli.add_command(storage_type)
cli.add_command(sample_sizes)
cli.add_command(monte_carlo_count)
cli.add_command(significance_levels)
Expand Down
3 changes: 2 additions & 1 deletion pysatl_experiment/cli/commands/common/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ def create_storage_path(storage_name: str) -> str:
:return: path to the storage.
"""

# TODO: add support for link!
# pysatl-experiment/.storage
storage_dir = Path(__file__).resolve().parents[4] / ".storage"
storage_file_name = f"{storage_name}.sqlite"
storage_file_name = f"{storage_name}.sqlite" # TODO: different storages

storage_path = storage_dir / storage_file_name

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ def storage_connection(ctx: Context, connection: str) -> None:
:param connection: storage connection.
"""

# TODO: add support for different remote storages

experiment_name, experiment_config = get_experiment_name_and_config(ctx)

storage_path = create_storage_path(connection)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from click import Context, argument, echo, pass_context

from pysatl_experiment.cli.commands.common.common import get_experiment_name_and_config, save_experiment_config
from pysatl_experiment.cli.commands.configure.configure import configure


@configure.command()
@argument("store_type")
@pass_context
def storage_type(ctx: Context, store_type: str) -> None:
"""
Configure storage type.

:param ctx: context.
:param store_type: storage type.
"""

# TODO: add support for remote storage

experiment_name, experiment_config = get_experiment_name_and_config(ctx)

# TODO
storage_type_lower = store_type.lower()
experiment_config["storage_type"] = storage_type_lower
# TODO

save_experiment_config(ctx, experiment_name, experiment_config)

echo(f"Report builder type of the experiment '{experiment_name}' is set to '{storage_type_lower}'.")
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from pysatl_experiment.configuration.model.report_mode.report_mode import ReportMode
from pysatl_experiment.configuration.model.run_mode.run_mode import RunMode
from pysatl_experiment.configuration.model.step_type.step_type import StepType
from pysatl_experiment.configuration.model.storage_type.storage_type import StorageType


@dataclass
Expand All @@ -16,6 +17,7 @@ class ExperimentConfig:

experiment_type: ExperimentType
storage_connection: str
storage_type: StorageType
run_mode: RunMode
hypothesis: Hypothesis
generator_type: StepType
Expand Down
10 changes: 10 additions & 0 deletions pysatl_experiment/configuration/model/storage_type/storage_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from enum import Enum


class StorageType(Enum):
"""
Internal storage.
"""

SQLITE = "sqlite"
POSTGRESQL = "postgresql"
6 changes: 6 additions & 0 deletions pysatl_experiment/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@ class ConfigurationError(OperationalException):
"""
Configuration error. Usually caused by invalid configuration.
"""


class StorageError(OperationalException): # TODO: description!!!
"""
Storage error. Used in storage creation.
"""
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
from pysatl_experiment.experiment.generator.generators import ExponentialGenerator, NormalGenerator, WeibullGenerator
from pysatl_experiment.experiment_new.experiment_steps.experiment_steps import ExperimentSteps
from pysatl_experiment.experiment_new.model.experiment_step.experiment_step import IExperimentStep
from pysatl_experiment.persistence.experiment.sqlite.sqlite import SQLiteExperimentStorage
from pysatl_experiment.persistence.model.experiment.experiment import ExperimentQuery, IExperimentStorage
from pysatl_experiment.persistence.model.power.power import PowerQuery
from pysatl_experiment.persistence.model.random_values.random_values import IRandomValuesStorage, RandomValuesAllQuery
from pysatl_experiment.persistence.model.time_complexity.time_complexity import TimeComplexityQuery
from pysatl_experiment.persistence.power.sqlite.sqlite import SQLitePowerStorage
from pysatl_experiment.persistence.random_values.sqlite.sqlite import SQLiteRandomValuesStorage
from pysatl_experiment.persistence.time_complexity.sqlite.sqlite import SQLiteTimeComplexityStorage
from pysatl_experiment.persistence.storage.experiment.sqlite.sqlite import SQLiteExperimentStorage
from pysatl_experiment.persistence.storage.power.sqlite.sqlite import SQLitePowerStorage
from pysatl_experiment.persistence.storage.random_values.sqlite.sqlite import SQLiteRandomValuesStorage
from pysatl_experiment.persistence.storage.time_complexity.sqlite.sqlite import SQLiteTimeComplexityStorage


D = TypeVar("D", contravariant=True, bound=ExperimentData)
Expand Down Expand Up @@ -434,7 +434,7 @@ def _init_data_storage(self) -> IRandomValuesStorage:
"""

storage_connection = self.experiment_data.config.storage_connection
data_storage = SQLiteRandomValuesStorage(storage_connection)
data_storage = SQLiteRandomValuesStorage(storage_connection) # TODO: improve smh
data_storage.init()

return data_storage
Expand All @@ -447,7 +447,7 @@ def _init_experiment_storage(self) -> IExperimentStorage:
"""

storage_connection = self.experiment_data.config.storage_connection
data_storage = SQLiteExperimentStorage(storage_connection)
data_storage = SQLiteExperimentStorage(storage_connection) # TODO: improve smh
data_storage.init()

return data_storage
Expand All @@ -459,7 +459,7 @@ def _init_result_storage(self) -> RS:
:return: result storage.
"""

experiment_type = self.experiment_data.config.experiment_type
experiment_type = self.experiment_data.config.experiment_type # TODO: improve smh
storage_connection = self.experiment_data.config.storage_connection
if experiment_type == ExperimentType.CRITICAL_VALUE:
limit_distribution_storage = SQLiteLimitDistributionStorage(storage_connection)
Expand Down
20 changes: 19 additions & 1 deletion pysatl_experiment/persistence/model/power/power.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,22 @@ class IPowerStorage(IDataStorage[PowerModel, PowerQuery], Protocol):
Power storage interface.
"""

pass
def init(self) -> None:
"""
Initialize SQLite power storage and create tables.
"""

def insert_data(self, data: PowerModel) -> None:
"""
Insert or replace a power entry.
"""

def get_data(self, query: PowerQuery) -> PowerModel | None:
"""
Retrieve power data matching the query.
"""

def delete_data(self, query: PowerQuery) -> None:
"""
Delete power data matching the query.
"""
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,22 @@ class ITimeComplexityStorage(IDataStorage[TimeComplexityModel, TimeComplexityQue
Time complexity storage interface.
"""

pass
def init(self) -> None:
"""
Initialize SQLite time complexity storage and create tables.
"""

def insert_data(self, data: TimeComplexityModel) -> None:
"""
Insert or replace time complexity data.
"""

def get_data(self, query: TimeComplexityQuery) -> TimeComplexityModel | None:
"""
Get time complexity data matching the query.
"""

def delete_data(self, query: TimeComplexityQuery) -> None:
"""
Delete time complexity data matching the query.
"""
Loading