Commit 647eb7f6 authored by Médéric Boquien's avatar Médéric Boquien
Browse files

Centralise OUT_DIR in one location. One day we will have to have a second look...

Centralise OUT_DIR in one location. One day we will have to have a second look at all these files and maybe rearrange them a little.
parent 5aba1c8e
......@@ -47,8 +47,6 @@ from ..utils import ParametersHandler, backup_dir
TOLERANCE = 1e-12
# Limit the redshift to this number of decimals
REDSHIFT_DECIMALS = 2
# Directory where the output files are stored
OUT_DIR = "out/"
class PdfAnalysis(AnalysisModule):
......@@ -116,7 +114,7 @@ class PdfAnalysis(AnalysisModule):
print("Initialising the analysis module... ")
# Rename the output directory if it exists
backup_dir(OUT_DIR)
backup_dir()
# Initalise variables from input arguments.
analysed_variables = config["analysed_variables"]
......
......@@ -10,6 +10,8 @@ import numpy as np
from scipy.stats import gaussian_kde
from scipy.linalg import LinAlgError
from ..utils import OUT_DIR
# Number of points in the PDF
PDF_NB_POINTS = 1000
# Name of the file containing the analysis results
......
......@@ -17,6 +17,7 @@ import numpy as np
# Directory where the output files are stored
OUT_DIR = "out/"
class ParametersHandler(object):
"""Class to handle the parameters to generate a parameter list on-the-fly.
"""
......@@ -123,12 +124,12 @@ class ParametersHandler(object):
return len(self.shape)
def backup_dir(directory):
def backup_dir(directory=OUT_DIR):
if os.path.exists(directory):
new_name = datetime.now().strftime("%Y%m%d%H%M") + "_" + directory
os.rename(directory, new_name)
print("The existing {} directory was renamed to {}".format(
OUT_DIR,
directory,
new_name
))
os.mkdir(OUT_DIR)
os.mkdir(directory)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment