Skip to content

Commit

Permalink
clean write version
Browse files Browse the repository at this point in the history
  • Loading branch information
gordonkoehn committed Oct 15, 2024
1 parent 8e71f09 commit d2587fd
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions lollipop/cli/deconvolute.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import pandas as pd
import numpy as np
from tqdm import tqdm, trange
from threadpoolctl import threadpool_info, ThreadpoolController, threadpool_limits
from threadpoolctl import ThreadpoolController

import lollipop as ll

Expand Down Expand Up @@ -147,11 +147,10 @@ def _deconvolute_bootstrap(
List[pd.DataFrame]
The deconvolution results for the location and bootstrap iterations.
"""
print("Threadpool: ", threadpool_info())

logging.warning(threadpool_info())

# monitor the number of threads, to prevent oversubscription on blas / cluster systmes
controller = ThreadpoolController()
logging.info(f"Threading configuration:\n {controller.info()}")

# deconvolution results
deconv = []
Expand Down Expand Up @@ -238,17 +237,19 @@ def _deconvolute_bootstrap(
# just run one on everything
weights = {}

# define deconvolution kernel
t_kdec = ll.KernelDeconv(
temp_df2[var_dates["var_dates"][mindate] + ["undetermined"]],
temp_df2["frac"],
temp_df2["date"],
kernel=kernel(**kernel_params),
reg=regressor(**regressor_params),
confint=confint(**confint_params),
**weights,
)
# limit the number of threads, to prevent oversubscription on blas / cluster systmes
with controller.limit(limits=1, user_api='blas'):
# deconvolution
t_kdec = ll.KernelDeconv(
temp_df2[var_dates["var_dates"][mindate] + ["undetermined"]],
temp_df2["frac"],
temp_df2["date"],
kernel=kernel(**kernel_params),
reg=regressor(**regressor_params),
confint=confint(**confint_params),
**weights,
)
# do the deconvolution
t_kdec = t_kdec.deconv_all(**deconv_params)

if have_confint:
Expand Down Expand Up @@ -397,9 +398,6 @@ def deconvolute(
tally_data,
namefield,
):

controller = ThreadpoolController()
logging.warning(f"Controller {controller.info()}")

# load data
yaml = ruamel.yaml.YAML(typ="rt")
Expand Down

0 comments on commit d2587fd

Please sign in to comment.