initial commit with updaet
This commit is contained in:
parent
287e7d174b
commit
3a1db07aa3
174
flake.lock
generated
Normal file
174
flake.lock
generated
Normal file
@ -0,0 +1,174 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"inputs": {
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-github-actions": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"poetry2nixSrc",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1703863825,
|
||||
"narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nix-github-actions",
|
||||
"rev": "5163432afc817cf8bd1f031418d1869e4c9d5547",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nix-github-actions",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1725476236,
|
||||
"narHash": "sha256-jhtkFFP0v0z0m8oznMJ5szoPA72CGaeJYSv7/uaGpS4=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "e9f994aaff25e101d165245dcda1965d7871ff73",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"poetry2nixSrc": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nix-github-actions": "nix-github-actions",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": "systems_3",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1725322757,
|
||||
"narHash": "sha256-dgbmWv9ysSAZi27W4DnCdWDG+Q2yCCngVTKApDCN0ms=",
|
||||
"owner": "nix-community",
|
||||
"repo": "poetry2nix",
|
||||
"rev": "184203e05a78f93f3c6329597db4cbec0471984b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "poetry2nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"poetry2nixSrc": "poetry2nixSrc"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_2": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_3": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "systems",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"poetry2nixSrc",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1719749022,
|
||||
"narHash": "sha256-ddPKHcqaKCIFSFc/cvxS14goUhCOAwsM1PbMr0ZtHMg=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "8df5ff62195d4e67e2264df0b7f5e8c9995fd0bd",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
47
flake.nix
Normal file
47
flake.nix
Normal file
@ -0,0 +1,47 @@
|
||||
{
|
||||
description = "Application packaged using poetry2nix";
|
||||
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
|
||||
inputs.poetry2nixSrc = {
|
||||
url = "github:nix-community/poetry2nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, poetry2nixSrc }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
poetry2nix = poetry2nixSrc.lib.mkPoetry2Nix { inherit pkgs; };
|
||||
in {
|
||||
packages = {
|
||||
kalpaApp = poetry2nix.mkPoetryApplication {
|
||||
projectDir = self;
|
||||
python = pkgs.python39;
|
||||
preferWheels = true;
|
||||
};
|
||||
kalpaEnv = poetry2nix.mkPoetryEnv {
|
||||
projectDir = self;
|
||||
python = pkgs.python39;
|
||||
preferWheels = true;
|
||||
overrides = poetry2nix.overrides.withDefaults (self: super: {
|
||||
});
|
||||
};
|
||||
default = self.packages.${system}.kalpaEnv;
|
||||
};
|
||||
devShells.default = pkgs.mkShell {
|
||||
inputsFrom = [ self.packages.${system}.kalpaEnv ];
|
||||
buildInputs = [
|
||||
pkgs.poetry
|
||||
self.packages.${system}.kalpaEnv
|
||||
self.packages.${system}.kalpaApp
|
||||
pkgs.just
|
||||
pkgs.nodejs
|
||||
];
|
||||
shellHook = ''
|
||||
export DO_NIX_CUSTOM=1
|
||||
'';
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
2
justfile
2
justfile
@ -43,7 +43,7 @@ fmt:
|
||||
else
|
||||
poetry run black .
|
||||
fi
|
||||
find single_dipole_4 -type f -name "*.py" -exec sed -i -e 's/ /\t/g' {} \;
|
||||
find kalpa -type f -name "*.py" -exec sed -i -e 's/ /\t/g' {} \;
|
||||
find bin -type f -name "*.py" -exec sed -i -e 's/ /\t/g' {} \;
|
||||
# find tests -type f -name "*.py" -exec sed -i -e 's/ /\t/g' {} \;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
from single_dipole_4.read_bin_csv import read_dots_and_binned
|
||||
from single_dipole_4.common import get_model
|
||||
from single_dipole_4.config import (
|
||||
from kalpa.read_bin_csv import read_dots_and_binned
|
||||
from kalpa.common import get_model
|
||||
from kalpa.config import (
|
||||
Config,
|
||||
TantriConfig,
|
||||
GeneralConfig,
|
||||
|
@ -1,6 +1,6 @@
|
||||
from single_dipole_4.common.model_params import get_model
|
||||
from single_dipole_4.common.cli_utils import set_up_logging
|
||||
from single_dipole_4.common.runner_utils import (
|
||||
from kalpa.common.model_params import get_model
|
||||
from kalpa.common.cli_utils import set_up_logging
|
||||
from kalpa.common.runner_utils import (
|
||||
new_cd,
|
||||
tantri_binned_output_name,
|
||||
tantri_full_output_name,
|
||||
|
@ -1,11 +1,11 @@
|
||||
import pathlib
|
||||
import logging
|
||||
import single_dipole_4.config
|
||||
import kalpa.config
|
||||
import typing
|
||||
|
||||
|
||||
def set_up_logging(
|
||||
config: single_dipole_4.config.Config,
|
||||
config: kalpa.config.Config,
|
||||
log_file: typing.Optional[str],
|
||||
create_logfile_parents: bool = True,
|
||||
):
|
||||
|
@ -2,7 +2,7 @@ import dataclasses
|
||||
import typing
|
||||
import logging
|
||||
from tantri.dipoles.types import Orientation
|
||||
import single_dipole_4.config
|
||||
import kalpa.config
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
@ -51,7 +51,7 @@ def _fixed_z_model_func(
|
||||
)
|
||||
|
||||
|
||||
def get_model(params: single_dipole_4.config.ReducedModelParams):
|
||||
def get_model(params: kalpa.config.ReducedModelParams):
|
||||
model_funcs = {
|
||||
Orientation.Z: _fixed_z_model_func,
|
||||
Orientation.RANDOM: LogSpacedRandomCountMultipleDipoleFixedMagnitudeModel,
|
||||
|
@ -1,3 +1,3 @@
|
||||
from single_dipole_4.inference_coalesce.coalescer import Coalescer
|
||||
from kalpa.inference_coalesce.coalescer import Coalescer
|
||||
|
||||
__all__ = ["Coalescer"]
|
||||
|
@ -202,7 +202,6 @@ class BinnedData:
|
||||
csv_dict: typing.Dict[str, typing.Any]
|
||||
measurement_type: str
|
||||
|
||||
# we're ignoring stdevs for the current moment, as in the calculator single_dipole_matches.py script.
|
||||
def _dot_to_measurement(self, dot_name: str) -> typing.Sequence[Measurement]:
|
||||
if dot_name not in self.dots_dict:
|
||||
raise KeyError(f"Could not find {dot_name=} in {self.dots_dict=}")
|
||||
|
@ -1,10 +1,10 @@
|
||||
import logging
|
||||
|
||||
import single_dipole_4.stages.stage01
|
||||
import single_dipole_4.stages.stage02
|
||||
import single_dipole_4.stages.stage03
|
||||
import single_dipole_4.stages.stage04
|
||||
import single_dipole_4.common
|
||||
import kalpa.stages.stage01
|
||||
import kalpa.stages.stage02
|
||||
import kalpa.stages.stage03
|
||||
import kalpa.stages.stage04
|
||||
import kalpa.common
|
||||
import tantri.dipoles.types
|
||||
|
||||
import argparse
|
||||
@ -13,25 +13,25 @@ _logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Runner:
|
||||
def __init__(self, config: single_dipole_4.Config):
|
||||
def __init__(self, config: kalpa.Config):
|
||||
self.config = config
|
||||
_logger.info(f"Initialising runner with {config=}")
|
||||
|
||||
def run(self):
|
||||
_logger.info("*** Beginning Stage 01 ***")
|
||||
stage01 = single_dipole_4.stages.stage01.Stage01Runner(self.config)
|
||||
stage01 = kalpa.stages.stage01.Stage01Runner(self.config)
|
||||
stage01.run()
|
||||
|
||||
_logger.info("*** Beginning Stage 02 ***")
|
||||
stage02 = single_dipole_4.stages.stage02.Stage02Runner(self.config)
|
||||
stage02 = kalpa.stages.stage02.Stage02Runner(self.config)
|
||||
stage02.run()
|
||||
|
||||
_logger.info("*** Beginning Stage 03 ***")
|
||||
stage03 = single_dipole_4.stages.stage03.Stage03Runner(self.config)
|
||||
stage03 = kalpa.stages.stage03.Stage03Runner(self.config)
|
||||
stage03.run()
|
||||
|
||||
_logger.info("*** Beginning Stage 04 ***")
|
||||
stage04 = single_dipole_4.stages.stage04.Stage04Runner(self.config)
|
||||
stage04 = kalpa.stages.stage04.Stage04Runner(self.config)
|
||||
stage04.run()
|
||||
|
||||
|
||||
@ -55,32 +55,32 @@ def main():
|
||||
args = parse_args()
|
||||
|
||||
tantri_configs = [
|
||||
single_dipole_4.TantriConfig(12345, 50, 0.5, 100000),
|
||||
# single_dipole_4.TantriConfig(1234, 50, 0.0005, 10000),
|
||||
kalpa.TantriConfig(12345, 50, 0.5, 100000),
|
||||
# kalpa.TantriConfig(1234, 50, 0.0005, 10000),
|
||||
]
|
||||
generation_config = single_dipole_4.GenerationConfig(
|
||||
generation_config = kalpa.GenerationConfig(
|
||||
tantri_configs=tantri_configs,
|
||||
counts=[1],
|
||||
num_replicas=3,
|
||||
orientations=[tantri.dipoles.types.Orientation.XY],
|
||||
num_bin_time_series=25,
|
||||
)
|
||||
general_config = single_dipole_4.GeneralConfig(
|
||||
measurement_type=single_dipole_4.MeasurementTypeEnum.POTENTIAL
|
||||
general_config = kalpa.GeneralConfig(
|
||||
measurement_type=kalpa.MeasurementTypeEnum.POTENTIAL
|
||||
)
|
||||
|
||||
deepdog_config = single_dipole_4.DeepdogConfig(
|
||||
deepdog_config = kalpa.DeepdogConfig(
|
||||
costs_to_try=[10, 2, 1, 0.1],
|
||||
max_monte_carlo_cycles_steps=20,
|
||||
)
|
||||
|
||||
config = single_dipole_4.Config(
|
||||
config = kalpa.Config(
|
||||
generation_config=generation_config,
|
||||
general_config=general_config,
|
||||
deepdog_config=deepdog_config,
|
||||
)
|
||||
|
||||
single_dipole_4.common.set_up_logging(config, args.log_file)
|
||||
kalpa.common.set_up_logging(config, args.log_file)
|
||||
|
||||
_logger.info(f"Got {config=}")
|
||||
runner = Runner(config)
|
||||
|
@ -4,8 +4,8 @@ import json
|
||||
import pathlib
|
||||
import argparse
|
||||
import logging
|
||||
import single_dipole_4
|
||||
import single_dipole_4.common
|
||||
import kalpa
|
||||
import kalpa.common
|
||||
import tantri.cli
|
||||
import tantri.dipoles.types
|
||||
|
||||
@ -78,7 +78,7 @@ _logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Stage01Runner:
|
||||
def __init__(self, config: single_dipole_4.Config):
|
||||
def __init__(self, config: kalpa.Config):
|
||||
self.config = config
|
||||
_logger.info(f"Initialising Stage01 runner with {config=}")
|
||||
|
||||
@ -100,12 +100,12 @@ class Stage01Runner:
|
||||
dipoles_json = directory / "dipoles.json"
|
||||
|
||||
with open(config_json, "w") as conf_file:
|
||||
params = single_dipole_4.ReducedModelParams(
|
||||
params = kalpa.ReducedModelParams(
|
||||
count=count, orientation=tantri.dipoles.types.Orientation(orientation)
|
||||
)
|
||||
_logger.debug(f"Got params {params=}")
|
||||
json.dump(params.config_dict(seed), conf_file)
|
||||
# json.dump(single_dipole_4.common.model_config_dict(count, orientation, seed), conf_file)
|
||||
# json.dump(kalpa.common.model_config_dict(count, orientation, seed), conf_file)
|
||||
|
||||
tantri.cli._generate_dipoles(config_json, dipoles_json, (seed, replica, 1))
|
||||
|
||||
@ -113,10 +113,10 @@ class Stage01Runner:
|
||||
for tantri_index, tantri_config in enumerate(
|
||||
self.config.generation_config.tantri_configs
|
||||
):
|
||||
output_csv = directory / single_dipole_4.common.tantri_full_output_name(
|
||||
output_csv = directory / kalpa.common.tantri_full_output_name(
|
||||
tantri_index
|
||||
)
|
||||
binned_csv = directory / single_dipole_4.common.tantri_binned_output_name(
|
||||
binned_csv = directory / kalpa.common.tantri_binned_output_name(
|
||||
tantri_index
|
||||
)
|
||||
tantri.cli._write_apsd(
|
||||
@ -191,19 +191,19 @@ def main():
|
||||
args = parse_args()
|
||||
|
||||
tantri_configs = [
|
||||
single_dipole_4.TantriConfig(31415, 100, 5, 100000),
|
||||
single_dipole_4.TantriConfig(314, 100, 0.00005, 100000),
|
||||
kalpa.TantriConfig(31415, 100, 5, 100000),
|
||||
kalpa.TantriConfig(314, 100, 0.00005, 100000),
|
||||
]
|
||||
generation_config = single_dipole_4.GenerationConfig(
|
||||
generation_config = kalpa.GenerationConfig(
|
||||
tantri_configs=tantri_configs,
|
||||
counts=[1],
|
||||
num_replicas=3,
|
||||
orientations=[tantri.dipoles.types.Orientation.Z],
|
||||
)
|
||||
|
||||
config = single_dipole_4.Config(generation_config=generation_config)
|
||||
config = kalpa.Config(generation_config=generation_config)
|
||||
|
||||
single_dipole_4.common.set_up_logging(config, args.log_file)
|
||||
kalpa.common.set_up_logging(config, args.log_file)
|
||||
|
||||
_logger.info("Generating our data, for the following iterations")
|
||||
|
||||
|
@ -30,8 +30,8 @@ import json
|
||||
#
|
||||
#
|
||||
# folder in curr dir
|
||||
import single_dipole_4
|
||||
import single_dipole_4.common
|
||||
import kalpa
|
||||
import kalpa.common
|
||||
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
@ -74,7 +74,7 @@ def enumify_orientation_string(
|
||||
|
||||
|
||||
class Stage02Runner:
|
||||
def __init__(self, config: single_dipole_4.Config):
|
||||
def __init__(self, config: kalpa.Config):
|
||||
self.config = config
|
||||
_logger.info(f"Initialising Stage02 runner with {config=}")
|
||||
|
||||
@ -106,7 +106,7 @@ class Stage02Runner:
|
||||
return ["dot1", "dot2", current_dot]
|
||||
|
||||
def run_in_subdir(self, subdir: pathlib.Path):
|
||||
with single_dipole_4.common.new_cd(subdir):
|
||||
with kalpa.common.new_cd(subdir):
|
||||
_logger.debug(f"Running inside {subdir=}")
|
||||
|
||||
# TODO hardcoding that we're executing every job index.
|
||||
@ -140,7 +140,7 @@ class Stage02Runner:
|
||||
seed_index: int,
|
||||
):
|
||||
# _logger.info(f"Got job index {job_index}")
|
||||
# NOTE This guy runs inside subdirs, obviously. In something like <single_dipole_4>/out/z-10-2/dipoles
|
||||
# NOTE This guy runs inside subdirs, obviously. In something like <kalpa>/out/z-10-2/dipoles
|
||||
|
||||
# we had job_index, trial_name, args let's see what we need
|
||||
|
||||
@ -153,10 +153,10 @@ class Stage02Runner:
|
||||
)
|
||||
num_tantri_configs = len(self.config.generation_config.tantri_configs)
|
||||
binned_datas = [
|
||||
single_dipole_4.read_dots_and_binned(
|
||||
kalpa.read_dots_and_binned(
|
||||
self.config.get_dots_json_path(),
|
||||
pathlib.Path("..")
|
||||
/ single_dipole_4.common.tantri_binned_output_name(tantri_index),
|
||||
/ kalpa.common.tantri_binned_output_name(tantri_index),
|
||||
)
|
||||
for tantri_index in range(num_tantri_configs)
|
||||
]
|
||||
@ -188,11 +188,11 @@ class Stage02Runner:
|
||||
|
||||
mccount, mccountcycles = occupancies_dict[avg_filled]
|
||||
|
||||
model_params = single_dipole_4.ReducedModelParams(
|
||||
model_params = kalpa.ReducedModelParams(
|
||||
count=avg_filled, log_magnitude=log_magnitude, orientation=orientation
|
||||
)
|
||||
|
||||
models.append(single_dipole_4.get_model(model_params))
|
||||
models.append(kalpa.get_model(model_params))
|
||||
|
||||
_logger.info(f"have {len(models)} models to look at")
|
||||
if len(models) == 1:
|
||||
@ -229,7 +229,7 @@ class Stage02Runner:
|
||||
_logger.info(results)
|
||||
|
||||
def run(self):
|
||||
"""Going to iterate over every folder in out_dir, and execute the subdir stuff inside dirs like <single_dipole_4>/out/z-10-2/dipoles"""
|
||||
"""Going to iterate over every folder in out_dir, and execute the subdir stuff inside dirs like <kalpa>/out/z-10-2/dipoles"""
|
||||
out_dir_path = self.config.get_out_dir_path()
|
||||
subdirs = [child for child in out_dir_path.iterdir() if child.is_dir]
|
||||
# _logger.info(f"Going to execute within each of the directories in {subdirs=}")
|
||||
@ -261,14 +261,14 @@ def main():
|
||||
args = parse_args()
|
||||
|
||||
tantri_configs = [
|
||||
single_dipole_4.TantriConfig(31415, 100, 5, 100000),
|
||||
single_dipole_4.TantriConfig(314, 100, 0.00005, 100000),
|
||||
kalpa.TantriConfig(31415, 100, 5, 100000),
|
||||
kalpa.TantriConfig(314, 100, 0.00005, 100000),
|
||||
]
|
||||
generation_config = single_dipole_4.GenerationConfig(tantri_configs=tantri_configs)
|
||||
generation_config = kalpa.GenerationConfig(tantri_configs=tantri_configs)
|
||||
|
||||
config = single_dipole_4.Config(generation_config=generation_config)
|
||||
config = kalpa.Config(generation_config=generation_config)
|
||||
|
||||
single_dipole_4.common.set_up_logging(config, args.log_file)
|
||||
kalpa.common.set_up_logging(config, args.log_file)
|
||||
|
||||
_logger.info("Generating our data, for the following iterations")
|
||||
|
||||
|
@ -15,8 +15,8 @@ import logging
|
||||
# # import itertools
|
||||
import pdme
|
||||
|
||||
import single_dipole_4.stages
|
||||
import single_dipole_4.stages.stage03_1
|
||||
import kalpa.stages
|
||||
import kalpa.stages.stage03_1
|
||||
import tantri.cli
|
||||
import tantri.cli.file_importer
|
||||
import tantri.dipoles.types
|
||||
@ -25,8 +25,8 @@ import tantri.dipoles.types
|
||||
#
|
||||
#
|
||||
# folder in curr dir
|
||||
import single_dipole_4
|
||||
import single_dipole_4.common
|
||||
import kalpa
|
||||
import kalpa.common
|
||||
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
@ -70,7 +70,7 @@ def read_coalesced_csv(parent_path: pathlib.Path, dot_name: str, target_cost):
|
||||
|
||||
|
||||
class Stage03Runner:
|
||||
def __init__(self, config: single_dipole_4.Config):
|
||||
def __init__(self, config: kalpa.Config):
|
||||
self.config = config
|
||||
_logger.info(f"Initialising Stage03 runner with {config=}")
|
||||
|
||||
@ -85,7 +85,7 @@ class Stage03Runner:
|
||||
_logger.info(f"Got dots {self.dots=}")
|
||||
|
||||
def merge_coalesceds(self, sorted_dir: pathlib.Path):
|
||||
out_path = sorted_dir / single_dipole_4.common.merged_coalesced_name()
|
||||
out_path = sorted_dir / kalpa.common.merged_coalesced_name()
|
||||
with out_path.open("w", newline="") as outfile:
|
||||
writer = csv.DictWriter(outfile, OUT_FIELDNAMES)
|
||||
writer.writeheader()
|
||||
@ -100,15 +100,15 @@ class Stage03Runner:
|
||||
"""
|
||||
Subdir passed in should be e.g. <>/out/z-10-1/
|
||||
"""
|
||||
with single_dipole_4.common.new_cd(subdir):
|
||||
with kalpa.common.new_cd(subdir):
|
||||
|
||||
_logger.debug(f"Running inside {subdir=}")
|
||||
|
||||
single_dipole_4.stages.stage03_1.move_all_in_dipoles(subdir / "dipoles")
|
||||
kalpa.stages.stage03_1.move_all_in_dipoles(subdir / "dipoles")
|
||||
|
||||
seed_index = 0
|
||||
|
||||
sorted_dir = pathlib.Path(single_dipole_4.common.sorted_bayesruns_name())
|
||||
sorted_dir = pathlib.Path(kalpa.common.sorted_bayesruns_name())
|
||||
_logger.info(f"{sorted_dir.resolve()}")
|
||||
|
||||
for cost in self.config.deepdog_config.costs_to_try:
|
||||
@ -138,7 +138,7 @@ class Stage03Runner:
|
||||
#
|
||||
|
||||
def run(self):
|
||||
"""Going to iterate over every folder in out_dir, and execute the subdir stuff inside dirs like <single_dipole_4>/out/z-10-2/dipoles"""
|
||||
"""Going to iterate over every folder in out_dir, and execute the subdir stuff inside dirs like <kalpa>/out/z-10-2/dipoles"""
|
||||
out_dir_path = self.config.get_out_dir_path()
|
||||
subdirs = [child for child in out_dir_path.iterdir() if child.is_dir]
|
||||
# _logger.info(f"Going to execute within each of the directories in {subdirs=}")
|
||||
@ -170,19 +170,19 @@ def main():
|
||||
args = parse_args()
|
||||
|
||||
tantri_configs = [
|
||||
single_dipole_4.TantriConfig(31415, 100, 5, 100000),
|
||||
single_dipole_4.TantriConfig(314, 100, 0.00005, 100000),
|
||||
kalpa.TantriConfig(31415, 100, 5, 100000),
|
||||
kalpa.TantriConfig(314, 100, 0.00005, 100000),
|
||||
]
|
||||
generation_config = single_dipole_4.GenerationConfig(
|
||||
generation_config = kalpa.GenerationConfig(
|
||||
tantri_configs=tantri_configs,
|
||||
counts=[1],
|
||||
num_replicas=3,
|
||||
orientations=[tantri.dipoles.types.Orientation.Z],
|
||||
)
|
||||
|
||||
config = single_dipole_4.Config(generation_config=generation_config)
|
||||
config = kalpa.Config(generation_config=generation_config)
|
||||
|
||||
single_dipole_4.common.set_up_logging(config, args.log_file)
|
||||
kalpa.common.set_up_logging(config, args.log_file)
|
||||
|
||||
_logger.info("Generating our data, for the following iterations")
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import single_dipole_4.common
|
||||
import kalpa.common
|
||||
import os
|
||||
import logging
|
||||
import argparse
|
||||
@ -27,7 +27,7 @@ def target_dir(filename) -> BFile:
|
||||
raise ValueError(f"Could not parse {filename=}")
|
||||
tag = parsed_slug["tag"]
|
||||
cost = parsed_slug["target_cost"]
|
||||
target_dirname = f"{single_dipole_4.common.sorted_bayesruns_name()}/{tag}-{cost}"
|
||||
target_dirname = f"{kalpa.common.sorted_bayesruns_name()}/{tag}-{cost}"
|
||||
file = fileresult.path
|
||||
|
||||
bfile = BFile(file=file, target_dirname=target_dirname)
|
||||
@ -49,7 +49,7 @@ def move_all_in_dipoles(dipoles_path: pathlib.Path):
|
||||
|
||||
_logger.info(f"Going to try to move files in {dipoles_path=}")
|
||||
|
||||
sorted_dir = pathlib.Path(single_dipole_4.common.sorted_bayesruns_name())
|
||||
sorted_dir = pathlib.Path(kalpa.common.sorted_bayesruns_name())
|
||||
sorted_dir.mkdir(exist_ok=True, parents=True)
|
||||
|
||||
bayesruns = [
|
||||
|
@ -2,9 +2,9 @@ import typing
|
||||
import logging
|
||||
import argparse
|
||||
import csv
|
||||
import single_dipole_4
|
||||
import single_dipole_4.common
|
||||
import single_dipole_4.inference_coalesce
|
||||
import kalpa
|
||||
import kalpa.common
|
||||
import kalpa.inference_coalesce
|
||||
import tantri.dipoles.types
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
@ -93,7 +93,7 @@ def is_actual(row, actual_normal_orientation, actual_count):
|
||||
|
||||
|
||||
class Stage04Runner:
|
||||
def __init__(self, config: single_dipole_4.Config):
|
||||
def __init__(self, config: kalpa.Config):
|
||||
self.config = config
|
||||
_logger.info(f"Initialising Stage04 runner with {config=}")
|
||||
|
||||
@ -104,8 +104,8 @@ class Stage04Runner:
|
||||
subdir_path = self.config.get_out_dir_path() / subdir_name
|
||||
csv_path = (
|
||||
subdir_path
|
||||
/ single_dipole_4.common.sorted_bayesruns_name()
|
||||
/ single_dipole_4.common.merged_coalesced_name()
|
||||
/ kalpa.common.sorted_bayesruns_name()
|
||||
/ kalpa.common.merged_coalesced_name()
|
||||
)
|
||||
_logger.debug(f"Reading {csv_path=}")
|
||||
with csv_path.open(mode="r", newline="") as csvfile:
|
||||
@ -148,7 +148,7 @@ class Stage04Runner:
|
||||
megamerged_reader = csv.DictReader(infile)
|
||||
rows = [row for row in megamerged_reader]
|
||||
_logger.debug(rows[0])
|
||||
coalescer = single_dipole_4.inference_coalesce.Coalescer(
|
||||
coalescer = kalpa.inference_coalesce.Coalescer(
|
||||
rows, num_replicas=self.config.generation_config.num_replicas
|
||||
)
|
||||
_logger.info(coalescer.actual_dict.keys())
|
||||
@ -191,19 +191,19 @@ def main():
|
||||
args = parse_args()
|
||||
|
||||
tantri_configs = [
|
||||
single_dipole_4.TantriConfig(31415, 100, 5, 100000),
|
||||
single_dipole_4.TantriConfig(314, 100, 0.00005, 100000),
|
||||
kalpa.TantriConfig(31415, 100, 5, 100000),
|
||||
kalpa.TantriConfig(314, 100, 0.00005, 100000),
|
||||
]
|
||||
generation_config = single_dipole_4.GenerationConfig(
|
||||
generation_config = kalpa.GenerationConfig(
|
||||
tantri_configs=tantri_configs,
|
||||
counts=[1],
|
||||
num_replicas=3,
|
||||
orientations=[tantri.dipoles.types.Orientation.Z],
|
||||
)
|
||||
|
||||
config = single_dipole_4.Config(generation_config=generation_config)
|
||||
config = kalpa.Config(generation_config=generation_config)
|
||||
|
||||
single_dipole_4.common.set_up_logging(config, args.log_file)
|
||||
kalpa.common.set_up_logging(config, args.log_file)
|
||||
|
||||
_logger.info("Generating our data, for the following iterations")
|
||||
|
||||
|
40
poetry.lock
generated
40
poetry.lock
generated
@ -1,4 +1,4 @@
|
||||
# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand.
|
||||
# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand.
|
||||
|
||||
[[package]]
|
||||
name = "black"
|
||||
@ -73,22 +73,20 @@ files = [
|
||||
|
||||
[[package]]
|
||||
name = "deepdog"
|
||||
version = "1.3.0"
|
||||
version = "1.4.0"
|
||||
description = ""
|
||||
optional = false
|
||||
python-versions = ">=3.8.1,<3.10"
|
||||
files = []
|
||||
develop = true
|
||||
python-versions = "<3.10,>=3.8.1"
|
||||
files = [
|
||||
{file = "deepdog-1.4.0-py3-none-any.whl", hash = "sha256:aabaae5f1dad01ff52ea1475448800af0494c250432cff3f8ebe5f41580e830e"},
|
||||
{file = "deepdog-1.4.0.tar.gz", hash = "sha256:60e952c13d601985caf445522ee6232d6d089a373a48b83b05732324df6c2dc7"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
numpy = "1.22.3"
|
||||
pdme = "^1.5.0"
|
||||
pdme = ">=1.5.0,<2.0.0"
|
||||
scipy = "1.10"
|
||||
tqdm = "^4.66.2"
|
||||
|
||||
[package.source]
|
||||
type = "directory"
|
||||
url = "../deepdog"
|
||||
tqdm = ">=4.66.2,<5.0.0"
|
||||
|
||||
[[package]]
|
||||
name = "mypy-extensions"
|
||||
@ -221,24 +219,6 @@ dev = ["click", "doit (>=0.36.0)", "flake8", "mypy", "pycodestyle", "pydevtool",
|
||||
doc = ["matplotlib (>2)", "numpydoc", "pydata-sphinx-theme (==0.9.0)", "sphinx (!=4.1.0)", "sphinx-design (>=0.2.0)"]
|
||||
test = ["asv", "gmpy2", "mpmath", "pooch", "pytest", "pytest-cov", "pytest-timeout", "pytest-xdist", "scikit-umfpack", "threadpoolctl"]
|
||||
|
||||
[[package]]
|
||||
name = "tantri"
|
||||
version = "1.1.0"
|
||||
description = "Python dipole model evaluator"
|
||||
optional = false
|
||||
python-versions = ">=3.8.1,<3.10"
|
||||
files = []
|
||||
develop = true
|
||||
|
||||
[package.dependencies]
|
||||
click = "^8.1.7"
|
||||
numpy = "^1.22.3"
|
||||
scipy = "~1.10"
|
||||
|
||||
[package.source]
|
||||
type = "directory"
|
||||
url = "../tantri"
|
||||
|
||||
[[package]]
|
||||
name = "tomli"
|
||||
version = "2.0.1"
|
||||
@ -284,4 +264,4 @@ files = [
|
||||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = ">=3.8.1,<3.10"
|
||||
content-hash = "3c0c0391fcd01dabcbc7add8d92f0dac5c218e78aa375df1e9845c514a26dd83"
|
||||
content-hash = "ea6ff51c2e1b8a65a98c932f38e2f360076a90ee7706676cbf83e306bf6565e7"
|
||||
|
@ -1,17 +1,16 @@
|
||||
[tool.poetry]
|
||||
name = "single-dipole-4"
|
||||
version = "0.0.0"
|
||||
description = "running single dipole 4 test"
|
||||
name = "kalpa"
|
||||
version = "0.0.1"
|
||||
description = "Groups up and runs full run."
|
||||
authors = ["Deepak Mallubhotla <dmallubhotla+github@gmail.com>"]
|
||||
readme = "README.md"
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = ">=3.8.1,<3.10"
|
||||
deepdog = {path = "../deepdog", develop = true}
|
||||
tantri = {path = "../tantri", develop = true}
|
||||
pdme = "^1.5.0"
|
||||
|
||||
|
||||
deepdog = "^1.4.0"
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
black = "^24.8.0"
|
||||
|
||||
@ -20,8 +19,8 @@ requires = ["poetry-core"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
|
||||
[tool.poetry.scripts]
|
||||
stage01 = "single_dipole_4.stages.stage01:main"
|
||||
stage02 = "single_dipole_4.stages.stage02:main"
|
||||
stage03 = "single_dipole_4.stages.stage03:main"
|
||||
stage04 = "single_dipole_4.stages.stage04:main"
|
||||
sd4 = "single_dipole_4.stages:main"
|
||||
stage01 = "kalpa.stages.stage01:main"
|
||||
stage02 = "kalpa.stages.stage02:main"
|
||||
stage03 = "kalpa.stages.stage03:main"
|
||||
stage04 = "kalpa.stages.stage04:main"
|
||||
sd4 = "kalpa.stages:main"
|
||||
|
Loading…
x
Reference in New Issue
Block a user