Skip to content

Commit

Permalink
ENH: Add limitation to cores values to avoid multithreading overhead
Browse files Browse the repository at this point in the history
  • Loading branch information
acsenrafilho committed Nov 14, 2024
1 parent dc8b8f7 commit dd49e5d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions asltk/reconstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,15 @@ def create_map(
ub (list, optional): The upper limit values. Defaults to [1.0, 5000.0].
lb (list, optional): The lower limit values. Defaults to [0.0, 0.0].
par0 (list, optional): The initial guess parameter for non-linear fitting. Defaults to [1e-5, 1000].
cores (int, optional): Defines how many CPU threads can be used for the class. Defaults is using all the availble threads.
Returns:
(dict): A dictionary with 'cbf', 'att' and 'cbf_norm'
"""
if (cores < 0) or (cores > cpu_count()) or not isinstance(cores, int):
raise ValueError(
'Number of proecess must be at least 1 and less than maximum cores availble.'
)
if (
len(self._asl_data.get_ld()) == 0
or len(self._asl_data.get_pld()) == 0
Expand Down

0 comments on commit dd49e5d

Please sign in to comment.