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

Dev #17

Merged
merged 3 commits into from
Feb 5, 2024
Merged

Dev #17

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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,4 @@ pipe/config/conf_rubicon.json
pipe/config/conf_hydra.json
conf_rubicon.json
conf_hydra.json
*.DS_Store
3 changes: 2 additions & 1 deletion pipe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@
)
from .pipe_control import PipeControl
from .pipe_param import PipeParam
from .pipe_statistics import mad, sigma_clip
from .pipe_statistics import mad, sigma_clip
from .config import conf
21 changes: 19 additions & 2 deletions pipe/config/pipeconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,31 @@
import os
import astropy.config as astropyconfig


def cache_dir():
return astropyconfig.get_cache_dir()


def get_conf_paths():
def get_conf_paths(overwrite=False):
# Get configuration information from setup.cfg
conf_path = os.path.join(os.path.dirname(__file__), 'conf.json')

if (not os.path.isfile(conf_path))|(overwrite):
# First creating a file
data_path = input('Please enter a path to the data files\nThe default path is ~/cheops-pipe/Data (press ENTER to use this): ')
ref_path = input('Please enter a path to the calibration files\nThe default path is ~/cheops-pipe/Ref (press ENTER to use this): ')
if data_path == '':
data_path = os.path.expanduser('~') + '/cheops-pipe/Data'
if ref_path == '':
ref_path = os.path.expanduser('~') + '/cheops-pipe/Ref'
fconf = open(os.path.dirname(__file__) + '/conf.json', 'w')
fconf.write('{\n')
fconf.write('\t"data_root" : "' + data_path + '",\n')
fconf.write('\t"ref_lib_data" : "' + ref_path + '"\n')
fconf.write('}')
fconf.close()
# And loading it
conf_path = os.path.join(os.path.dirname(__file__), 'conf.json')

with open(conf_path, 'r') as confstream:
confparse = json.load(confstream)
data_root_cfg = confparse.get("data_root")
Expand Down
Loading