Skip to content

Commit fe7b035

Browse files
committed
Update codes
1 parent 547f7a0 commit fe7b035

File tree

4 files changed

+31
-1359
lines changed

4 files changed

+31
-1359
lines changed

Python/hbayesdm/base.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import multiprocessing
22
import os
33
import pickle
4+
import tempfile
45
import warnings
56
from abc import ABCMeta, abstractmethod
67
from collections import OrderedDict
78
from pathlib import Path
89
from typing import Any, Callable, Dict, List, Sequence, Tuple, Union
910

10-
import numpy as np
11-
import pandas as pd
12-
from scipy import stats
13-
1411
import arviz as az
1512
import matplotlib.pyplot as plt
13+
import numpy as np
14+
import pandas as pd
1615
from pystan import StanModel
1716
from pystan import __version__ as _pystan_version
17+
from scipy import stats
1818

1919
__all__ = ['TaskModel']
2020

@@ -640,7 +640,12 @@ def _designate_stan_model(self, model: str) -> StanModel:
640640
Compiled StanModel obj to use for sampling & fitting.
641641
"""
642642
model_path = str(PATH_STAN / (model + '.stan'))
643-
cache_file = 'cached-%s-pystan_%s.pkl' % (model, _pystan_version)
643+
tempdir = Path(tempfile.gettempdir())
644+
uid = os.getuid()
645+
cache_file = tempdir / (
646+
'cached-hBayesDM_model-%s-pystan_%s_user-%d.pkl' %
647+
(model, _pystan_version, uid)
648+
)
644649

645650
if os.path.exists(cache_file):
646651
try:

0 commit comments

Comments
 (0)