Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
88 changes: 88 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Git
.git
.gitignore
.gitattributes

# CI
.codeclimate.yml
.travis.yml
.taskcluster.yml

# Docker
docker-compose.yml
Dockerfile
.docker
.dockerignore

# Byte-compiled / optimized / DLL files
**/__pycache__/
**/*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Virtual environment
.env
.venv/
venv/

# PyCharm
.idea

# Python mode for VIM
.ropeproject
**/.ropeproject

# Vim swap files
**/*.swp

# VS Code
.vscode/
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM python:3.12.9-slim-bookworm AS base

WORKDIR /app

ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONFAULTHANDLER=1
ENV PATH=/home/pysatluser/.local/bin:$PATH
ENV POETRY_HOME=/opt/poetry

RUN apt-get update && apt-get install -y curl && \
curl -sSL https://install.python-poetry.org | python - && \
cd /usr/local/bin && \
ln -s /opt/poetry/bin/poetry && \
poetry config virtualenvs.create true

# Копируем файлы зависимостей
COPY pyproject.toml ./

# Устанавливаем зависимости
RUN poetry install --no-interaction --no-ansi

# Копируем остальные файлы
COPY . .

ENTRYPOINT ["poetry", "run", "python", "-m", "stattest.main"]
# Default to experiment mode
CMD [ "experiment", "--config", "../../config_examples/config_example.json" ]
76 changes: 76 additions & 0 deletions config_examples/config_example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"generator_configuration": {
"generators": [
{
"name": "ExponentialGenerator",
"params": {
"lam": 0.5
}
}
],
"sizes": [100, 200],
"count": 1000,
"threads": 1,
"skip_if_exists": true,
"clear_before": false,
"skip_step": false,
"show_progress": false,
"listeners": [
{
"name": "TimeEstimationListener"
}
]
},
"test_configuration": {
"tests": [
{
"name": "KolmogorovSmirnovWeibullGofStatistic"
}
],
"threads": 8,
"worker":
{
"name": "PowerCalculationWorker",
"params": {
"alpha": 0.05,
"monte_carlo_count": 100000,
"cv_store": {
"name": "CriticalValueDbStore",
"params": {
"db_url": "sqlite:///weibull_experiment.sqlite"
}
},
"hypothesis": {
"name": "WeibullHypothesis"
}
}
},
"listeners": [
{
"name": "TimeEstimationListener"
}
]
},
"report_configuration": {
"report_builder": {
"name": "PdfPowerReportBuilder"
},
"listeners": []
},
"rvs_store":
{
"name": "RvsDbStore",
"params":
{
"db_url": "sqlite:///weibull_experiment.sqlite"
}
},
"result_store":
{
"name": "ResultDbStore",
"params":
{
"db_url": "sqlite:///weibull_experiment.sqlite"
}
}
}
45 changes: 0 additions & 45 deletions config_examples/config_example_full.json

This file was deleted.

72 changes: 72 additions & 0 deletions config_examples/weibull_experiment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"generator_configuration": {
"generators": [
{
"name": "ExponentialGenerator",
"params": {
"lam": 0.5
}
}
],
"sizes": [100, 200],
"count": 1000,
"threads": 1,
"listeners": [
{
"name": "TimeEstimationListener"
}
]
},
"test_configuration": {
"tests": [
{
"name": "KSWeibullTest"
}
],
"threads": 8,
"worker":
{
"name": "PowerCalculationWorker",
"params": {
"alpha": 0.05,
"monte_carlo_count": 100000,
"cv_store": {
"name": "CriticalValueDbStore",
"params": {
"db_url": "sqlite:///weibull_experiment.sqlite"
}
},
"hypothesis": {
"name": "WeibullHypothesis"
}
}
},
"listeners": [
{
"name": "TimeEstimationListener"
}
]
},
"report_configuration": {
"report_builder": {
"name": "PdfPowerReportBuilder"
},
"listeners": []
},
"rvs_store":
{
"name": "RvsDbStore",
"params":
{
"db_url": "sqlite:///weibull_experiment.sqlite"
}
},
"result_store":
{
"name": "ResultDbStore",
"params":
{
"db_url": "sqlite:///weibull_experiment.sqlite"
}
}
}
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
services:
stattest:
build:
context: .
# dockerfile: "./docker/Dockerfile.custom"
restart: unless-stopped
container_name: pysatl-experiment
volumes:
- "./user_data:/stattest/user_data"
# Default command used when running `docker compose up`
command: >
experiment
--logfile /stattest/user_data/logs/pysatl_experiment.log
--config /stattest/user_data/config.json
4 changes: 2 additions & 2 deletions docs/requirements-docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ markdown==3.7
mkdocs==1.6.1
mkdocs-material==9.5.44
mdx_truly_sane_lists==1.3
pymdown-extensions==10.12
jinja2==3.1.4
pymdown-extensions==10.14.3
jinja2==3.1.6
mike==2.1.3
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

from stattest.experiment import Experiment
from stattest.experiment.configuration.configuration import (
AlternativeConfiguration,
ExperimentConfiguration,
GeneratorConfiguration,
ReportConfiguration,
TestConfiguration,
)
Expand All @@ -23,7 +23,7 @@
)
from stattest.experiment.hypothesis import NormalHypothesis
from stattest.experiment.listener.listeners import TimeEstimationListener
from stattest.experiment.report.model import PdfPowerReportBuilder
from stattest.experiment.report.builders import PdfPowerReportBuilder
from stattest.experiment.test.worker import PowerCalculationWorker
from stattest.persistence.db_store import CriticalValueDbStore, ResultDbStore, RvsDbStore

Expand Down Expand Up @@ -67,7 +67,7 @@
KolmogorovSmirnovNormalityGofStatistic(),
]

alternatives_configuration = AlternativeConfiguration(
alternatives_configuration = GeneratorConfiguration(
alternatives, sizes, count=1_000, threads=generation_threads, listeners=listeners
)

Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions generators/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
from stattest.experiment.generator import AbstractRVSGenerator


class BBBRVSGenerator(AbstractRVSGenerator):
def __init__(self, a, b, **kwargs):
class GeneratorTest(AbstractRVSGenerator):
def __init__(self, a=1, b=2, **kwargs):
super().__init__(**kwargs)
self.a = a
self.b = b

def code(self):
return super()._convert_to_code(["beta", self.a, self.b])
return super()._convert_to_code(["generator_test", self.a, self.b])

def generate(self, size):
return generate_beta(size=size, a=self.a, b=self.b)
Loading