Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gempyor API docstring refurbishment #468

Merged
merged 18 commits into from
Jan 31, 2025
Merged
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
53 changes: 35 additions & 18 deletions flepimop/gempyor_pkg/src/gempyor/calibrate.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
"""
Facilitates the calibration of the model using the `emcee` MCMC sampler.

Provides CLI options for users to specify simulation parameters.

Functions:
calibrate: Reads a configuration file for simulation settings.
"""

#!/usr/bin/env python
import os
import shutil
import copy
import pathlib
import multiprocessing

import click
import emcee
import numpy as np

import gempyor
from gempyor import model_info, file_paths, config, inference_parameter
from gempyor.inference import GempyorInference
from gempyor.utils import config, as_list
import gempyor
import numpy as np
import os, shutil, copy
import emcee
import pathlib
import multiprocessing
import gempyor.postprocess_inference


# from .profile import profile_options

# disable operations using the MKL linear algebra.
Expand Down Expand Up @@ -113,18 +127,21 @@
# @profile_options
# @profile()
def calibrate(
config_filepath,
project_path,
nwalkers,
niter,
nsamples,
nthin,
ncpu,
input_run_id,
prefix,
resume,
resume_location,
):
config_filepath: str | pathlib.Path,
project_path: str,
nwalkers: int,
niter: int,
nsamples: int,
nthin: int | None,
ncpu: int,
input_run_id: int | None,
prefix: str | None,
resume: bool,
resume_location: str | None,
) -> None:
"""
Calibrate using an `emcee` sampler to initialize a model based on a config.
"""
# Choose a run_id
if input_run_id is None:
base_run_id = pathlib.Path(config_filepath).stem.replace("config_", "")
Expand Down
3 changes: 2 additions & 1 deletion flepimop/gempyor_pkg/src/gempyor/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
)
@click.pass_context
def patch(ctx: click.Context = mock_context, **kwargs) -> None:
"""Merge configuration files
"""
Merge configuration files.

This command will merge multiple config files together by overriding the top level
keys in config files. The order of the config files is important, as the last file
Expand Down
Loading
Loading