From f47abb23a85a93d99f954ff8a615f98eab795cc8 Mon Sep 17 00:00:00 2001
From: Peter Drewelow <peter.drewelow@ipp.mpg.de>
Date: Tue, 2 Jun 2020 16:02:27 +0200
Subject: [PATCH] renaming files and allow for Sandbox download

upload_config: renamed to download_config (to avoid same name as in ir_upload)
IR_config_constants.py: renamed to IR_da_config_constants.py (to avoid same name as in ir_upload)
IR_image_tools.py, downloadversionIRdata.py, setup.py: adjusted import to IR_da_config_constants
download_config: parameter archivedb changed from boolean 'True'/'False' to string 'ArchiveDB'/'Test'/'Sandbox'
IR_da_config_constants.py: load target database from upload_config parameter archivedb and build archivepath from it
---
 IR_config_constants.py => IR_da_config_constants.py | 8 +++-----
 IR_image_tools.py                                   | 2 +-
 downloadversionIRdata.py                            | 2 +-
 setup.py                                            | 4 ++--
 upload_config                                       | 3 ++-
 5 files changed, 9 insertions(+), 10 deletions(-)
 rename IR_config_constants.py => IR_da_config_constants.py (98%)

diff --git a/IR_config_constants.py b/IR_da_config_constants.py
similarity index 98%
rename from IR_config_constants.py
rename to IR_da_config_constants.py
index 663b952..fa8e8b2 100644
--- a/IR_config_constants.py
+++ b/IR_da_config_constants.py
@@ -18,15 +18,13 @@ parameter_file_path = ospath.join(ospath.dirname(__file__), 'data')
 
 try:
 #    import sys
-    path=str(repr(__file__)).split("IR_config_constants")[0].split("'")[1]+"upload_config"
+    path=str(repr(__file__)).split("IR_da_config_constants")[0].split("'")[1]+"download_config"
     cFile=open(path.replace('\\\\',"\\"))#+"upload_config")
     for line in cFile:
         if line[0:3]!="###":
             if line.split("=")[0]=='archivedb':
-                if eval(line.split("=")[1].split("\n")[0]):
-                    archivepath="http://archive-webapi.ipp-hgw.mpg.de/ArchiveDB/raw/"
-                else:
-                    archivepath="http://archive-webapi.ipp-hgw.mpg.de/Test/raw/"
+                database = eval(line.split("=")[1].strip())
+                archivepath = "http://archive-webapi.ipp-hgw.mpg.de/{0}/raw/".format(database)
     cFile.close()    
 except Exception as E:
     archivepath="http://archive-webapi.ipp-hgw.mpg.de/Test/raw/"
diff --git a/IR_image_tools.py b/IR_image_tools.py
index 5a5b6c7..0db5bea 100644
--- a/IR_image_tools.py
+++ b/IR_image_tools.py
@@ -15,7 +15,7 @@ Tools for:
 import numpy as np
 import matplotlib.pyplot as plt
 import matplotlib.patches as patches
-from IR_config_constants import portcamdict, IRCAMBadPixels_path, parameter_file_path
+from IR_da_config_constants import portcamdict, IRCAMBadPixels_path, parameter_file_path
 import os
 import datetime
 #import h5py
diff --git a/downloadversionIRdata.py b/downloadversionIRdata.py
index 2938d1a..ffc323f 100644
--- a/downloadversionIRdata.py
+++ b/downloadversionIRdata.py
@@ -16,7 +16,7 @@ version="V3.4.0"
 
 import numpy as np
 import IR_image_tools as IR_tools
-from IR_config_constants import archivepath, testarchivepath, portcamdict, camlimdict, \
+from IR_da_config_constants import archivepath, testarchivepath, portcamdict, camlimdict, \
                                 valid_FOV_circle, valid_background_rectangle, \
                                 TC_port, TC_channel, IRCamColdframes_fittingpath, \
                                 exJet, portpathdict, project, project_ana, \
diff --git a/setup.py b/setup.py
index 3c46522..9461aa1 100644
--- a/setup.py
+++ b/setup.py
@@ -9,14 +9,14 @@ setup(
 	py_modules = [
                 'downloadversionIRdata',
                 'IR_image_tools',
-                'IR_config_constants',
+                'IR_da_config_constants',
                 'IR_image_tools',
                 'plot_IR_data'       ,
                 'Create_HDF5_from_archive_data',
                 'plot_heatflux_example'
         ],
       data_files=[
-                  ('',['upload_config','CHANGELOG','ToDo.txt']),
+                  ('',['download_config','CHANGELOG','ToDo.txt']),
                   ('data',['data/AEF10_coldframes_background_fails_real.txt',
                            'data/AEF11_coldframes_background_fails_real.txt',
                            'data/AEF20_coldframes_background_fails_real.txt',
diff --git a/upload_config b/upload_config
index 79785e1..0396f34 100644
--- a/upload_config
+++ b/upload_config
@@ -23,7 +23,8 @@ nuc=False
 metastream=True
 temperature=False
 retry=2
-archivedb=True
+### target database (ArchiveDB/Test/Sandbox) ###
+archivedb='ArchiveDB'
 ### versioning ###
 reupload=False
 reason=""
-- 
GitLab