Skip to content

Commit

Permalink
Fixing TA_PATH references to use PAL_PATH.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph Paul Glaser committed Dec 6, 2022
1 parent 31adb20 commit e6ac786
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions src/pint_pal/make_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
import astropy.units as u

# accessible to functions here, apparently
TA_PATH = "/home/jovyan/work/pint_pal/" # assume running from here?
PAL_PATH = "/home/jovyan/work/pint_pal/" # assume running from here?
INTERMED_PATH = "/nanograv/share/15yr/timing/intermediate/"
TA_RESULTS = os.path.join(TA_PATH,"results")
TA_CONFIGS = os.path.join(TA_PATH,"configs")
PAL_RESULTS = os.path.join(PAL_PATH,"results")
PAL_CONFIGS = os.path.join(PAL_PATH,"configs")

def make_release_dir(type, overwrite=False):
"""
Expand Down Expand Up @@ -62,9 +62,9 @@ def check_cleared(type):
narrowband (nb), wideband (wb), or both (nbwb)
"""
if type == "nbwb":
yamls = glob.glob(f"{TA_CONFIGS}/*.yaml")
yamls = glob.glob(f"{PAL_CONFIGS}/*.yaml")
else:
yamls = glob.glob(f"{TA_CONFIGS}/*.{type}.yaml")
yamls = glob.glob(f"{PAL_CONFIGS}/*.{type}.yaml")
for y in yamls:
tc = TimingConfiguration(y)
if not tc.get_check_cleared():
Expand Down Expand Up @@ -114,7 +114,7 @@ def locate_copy_results(yamls,type,destination=None):
source = tc.get_source()
noise_dir = tc.get_noise_dir()
latest_yaml = [y]
latest_par = [f"{TA_PATH}{tc.get_model_path()}"]
latest_par = [f"{PAL_PATH}{tc.get_model_path()}"]
latest_tim = glob.glob(f"{noise_dir}results/{source}_*.tim") # underscore to avoid duplicating split-tel results
noise_chains = glob.glob(f"{noise_dir}{source}_{type}/chain_1.txt")
noise_pars = glob.glob(f"{noise_dir}{source}_{type}/pars.txt")
Expand Down
20 changes: 10 additions & 10 deletions src/pint_pal/update_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
import os

# accessible to functions here, apparently
TA_PATH = "/home/jovyan/work/pint_pal/" # assume running from here?
PAL_PATH = "/home/jovyan/work/pint_pal/" # assume running from here?
INTERMED_PATH = "/nanograv/share/15yr/timing/intermediate/"
TA_RESULTS = os.path.join(TA_PATH,"results")
TA_ARCHIVE = os.path.join(TA_RESULTS,"archive")
PAL_RESULTS = os.path.join(PAL_PATH,"results")
PAL_ARCHIVE = os.path.join(PAL_RESULTS,"archive")

def new_noise_results(input_pars,logs_only=False):
""" Check in new par file, point to new noise results, edit yaml appropriately
Expand All @@ -40,7 +40,7 @@ def new_noise_results(input_pars,logs_only=False):
src = p.split('_')[0]
mode = p.split('.')[-2]
y = f"{src}.{mode}.yaml" # yaml file only
yaml_path = os.path.join(TA_PATH,"configs",y)
yaml_path = os.path.join(PAL_PATH,"configs",y)

# Determine noise-dir from par_path unless told to do otherwise (needs dev if so)
noise_path = os.path.dirname(os.path.dirname(par_path)) # assumes etc./noise/results/*.par
Expand All @@ -51,15 +51,15 @@ def new_noise_results(input_pars,logs_only=False):
log.info(f"Associating input par {p} with {y}")

# Copy par file(s) and git add
log.info(f"Copying {p} to {TA_RESULTS}")
log.info(f"Copying {p} to {PAL_RESULTS}")
# Could also add a check here for whether results are already up to date
if not logs_only:
process_cpnew = subprocess.Popen(["cp",par_path,TA_RESULTS],
process_cpnew = subprocess.Popen(["cp",par_path,PAL_RESULTS],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
# Ensures next process waits for this one to finish...
_stdout, _stderr = process_cpnew.communicate()
process_gitadd = subprocess.Popen(["git","add",os.path.join(TA_RESULTS,p)],
process_gitadd = subprocess.Popen(["git","add",os.path.join(PAL_RESULTS,p)],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
_stdout, _stderr = process_gitadd.communicate()
Expand All @@ -71,9 +71,9 @@ def new_noise_results(input_pars,logs_only=False):
log.info(f"Previous par file: {prev_par}")

# git mv to archive
log.info(f"Moving {pp} to {TA_ARCHIVE}")
log.info(f"Moving {pp} to {PAL_ARCHIVE}")
if not logs_only:
process_gitmv = subprocess.Popen(["git","mv",prev_par,TA_ARCHIVE],
process_gitmv = subprocess.Popen(["git","mv",prev_par,PAL_ARCHIVE],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
_stdout, _stderr = process_gitmv.communicate()
Expand Down Expand Up @@ -120,7 +120,7 @@ def new_outlier_results(input_tims,logs_only=False):
src = t.split('.')[0]
mode = t.split('.')[1].split('_')[0]
y = f"{src}.{mode}.yaml" # yaml file only
yaml_path = os.path.join(TA_PATH,"configs",y)
yaml_path = os.path.join(PAL_PATH,"configs",y)

log.info(src)
if os.path.exists(yaml_path):
Expand Down

0 comments on commit e6ac786

Please sign in to comment.