diff --git a/upload_heatflux.py b/upload_heatflux.py
index df9f39e0ba744babaeb47e1e5909bb936012bd1c..896cbcb3f24fc92b2d9118361447fa8468aba16d 100644
--- a/upload_heatflux.py
+++ b/upload_heatflux.py
@@ -1,13 +1,13 @@
 # -*- coding: utf-8 -*-
 """
 Created on Fri Sep 21 09:32:29 2018
-
+V3.0.1
 @author: holn
 """
 
 import numpy as np
 import scipy.io as sio
-import matplotlib.pyplot as plt
+#import matplotlib.pyplot as plt
 import h5py as h5
 import uploadingversionIRdata as IRup
 import downloadversionIRdata as IR
@@ -18,8 +18,12 @@ import datetime
 
 port=20
 program="20171109.008"
+#programlist=["20171011.009"]
+programlist=["20171011.010","20171011.011","20171011.012","20171011.013","20171011.014","20171011.015","20171011.016","20171011.017","20171011.018","20171011.019","20171011.022","20171011.025","20171011.026","20171011.030","20171011.031","20171011.034","20171011.035","20171011.036","20171011.037","20171011.038","20171011.039","20171011.041","20171011.042","20171011.044","20171109.006","20171109.007","20171109.009","20171109.010","20171109.012","20171109.013","20171109.014","20171109.016","20171109.017","20171109.018","20171109.020","20171109.021","20171109.022","20171109.023","20171109.024","20171109.025","20171109.026"]
+programlist.extend(["20171102.007","20171102.009","20171102.011","20171102.012","20171102.014","20171102.022"])
 path="F:\\holn\\Documents\\Doktorarbeit\\RESULTS\\OP1.2a\\Fulldivertor_res\\EJM\\He\\"
 outpfad="F:\\holn\\Documents\\Doktorarbeit\\DATEN\\Mapping\\LinesforStacks\\"
+scenepath=""
 
 project="W7XAnalysis"
 group="QRT_IRCAM"
@@ -27,174 +31,243 @@ stream="AEF"+str(port)+"_heatflux"
 comment="Test upload"    
 header={'code_version':4,'alpha_corrected':1}
 stream2="Mapping_reference"
-upload_Mapping=True
-
-File=sio.loadmat(path+program+"_AEF"+str(port)+"_heatflux_V4.mat")
-time=np.asarray(File['time'][0])
-tilelist=np.asarray(File['tiles'])
-heatpics=np.zeros((125+190+10,108*12+4,len(time)))
-alphapic=np.zeros((125+190+10,108*12+4,1))
-alphapic.fill(np.nan)
-heatpics.fill(np.nan)
-Xpic=alphapic.copy()
-Ypic=alphapic.copy()
-FXpic=alphapic.copy()
-FYpic=alphapic.copy()
-profpic=alphapic.copy()
-profnpic=alphapic.copy()
-tilepic=alphapic.copy()
-fingerpic=alphapic.copy()
+upload_Mapping=False
+upload_scene_reference=False
+stream_scene="AEF"+str(port)+"_SceneModel_reference"    
+scene_reference_time=0#ns timestamp goes here!
 
-linedict={'h_l':30,'h_m':54,'h_h':24,'v':29}
-numstacks={            
-'h_l':{0:13,1:14,2:14,3:14,4:14,5:14,6:14,7:14,8:14,9:14,10:15,11:15,12:14,13:14,14:14,15:13,16:13,17:13,18:13,19:13,20:13,21:13,22:13,23:13,24:13,25:13,26:13,27:13,28:13,29:13},
-'h_m':{0:14,1:15,2:14,3:15,4:14,5:15,6:14,7:15,8:14,9:15,10:14,11:15,12:14,13:15,14:14,15:15,16:14,17:15,18:14,19:15,20:14,21:15,22:14,23:15,24:14,25:15,26:14,27:15,28:14,29:15,30:14,31:15,32:14,33:15,34:14,35:15,36:14,37:15,38:14,39:15,40:14,41:15,42:14,43:15,44:14,45:15,46:14,47:15,48:15,49:14,50:14,51:14,52:14,53:15},
-'h_h':{0:16,1:15,2:15,3:15,4:15,5:15,6:15,7:15,8:15,9:15,10:15,11:15,12:15,13:15,14:15,15:15,16:15,17:15,18:15,19:15,20:15,21:15,22:15,23:15},
-'v':{0:15,1:15,2:15,3:15,4:15,5:15,6:15,7:15,8:15,9:15,10:15,11:15,12:15,13:15,14:15,15:15,16:15,17:15,18:15,19:15,20:15,21:15,22:15,23:15,24:15,25:15,26:15,27:15,28:15}
-}
+for program in programlist:
 
-def splitStacktoLines(locationall, rowcountarray):
-  locations = []
-  for i in range(len(rowcountarray) - 1):
-    locations.append(np.array(locationall[rowcountarray[i]:rowcountarray[i+1]]))
-  locations = np.array(locations)
-  return locations 
-ii=0
-V_index=0
-xoff=0
-maxyoff=0
-tn=0
-for tile in tilelist:#['h_l','h_m','h_h','v']:
-    tn+=1
-    tile=tile.replace(" ","")
-    linn=linedict[tile]
-    if tile!='v':
-        V_index+=linn
-        yoff=130
-    else:        
-        yoff=1
-        xoff=1
-    for i in range(linn):
-        if ii<30:
-            iko=ii
-        elif ii<84:
-            iko=ii-30            
-        elif ii<108:
-            iko=ii-84
-        else:
-            iko=ii-108
-        if ii>=78 and ii<108:
-            tn=3
-        fingerfile=str(port//10)
-        if port % 10 ==0:
-             fingerfile=fingerfile+"l"+tile+"_"
-        else:
-             fingerfile=fingerfile+"u"+tile+"_"
-        if port==20 and int(program.split(".")[0])<20171020:
-            linefile=fingerfile+'{0:02d}'.format(iko)+"2Dlines_biliniar_before_20171020.h5"
-        else:
-            linefile=fingerfile+'{0:02d}'.format(iko)+"2Dlines_biliniar.h5"
-        linf=h5.File(outpfad+linefile,'r')
-        linid=list(linf['LineNos'])
-        lines=linf['locationall2D']#
-        linlocid=linf['rowcountarray']
-        locations=splitStacktoLines(lines,linlocid)
-        linf.close()
-        xoff+=1
-        if tile=='h_m' and iko<48 and iko%2==1:
-            shift=True
-            xoff=xoff-numstacks[tile][i-1]-1
-            maxyoff+=1
-        else:
-            shift=False
-            maxyoff=0
-        for j in range(numstacks[tile][i]): 
-            j2=linid.index(j)
-            if shift:
-                yloff=maxyoff
+    File=sio.loadmat(path+program+"_AEF"+str(port)+"_heatflux_V4.mat")
+    time=np.asarray(File['time'][0])
+    tilelist=np.asarray(File['tiles'])
+    ### camera, program dependent things###
+    heatpics=np.zeros((125+190+10,108*12+4,len(time)))# define the pictures for the heat flux
+    alphapic=np.zeros((125+190+10,108*12+4,1)) # define the picture for the alpha values
+    alphapic.fill(np.nan)
+    heatpics.fill(np.nan)
+    if upload_Mapping:
+        ### mapping dependent things ###
+        Xpic=alphapic.copy() #X-Coordiate in the Mapping
+        Ypic=alphapic.copy() #Y-Coordiate in the Mapping
+        FXpic=alphapic.copy() #X-Coordiate in the Fingersystem in the Mapping
+        FYpic=alphapic.copy() #Y-Coordiate in the Fingersystem in the Mapping
+        profpic=alphapic.copy() #profiles or s coordiante in the Mapping
+    #    profnpic=alphapic.copy() 
+        tilepic=alphapic.copy() #target indentifier, 1: low iota, 2: middle part, 3: high iota, 4: vertical
+        fingerpic=alphapic.copy() #finger ID from the mapping, last two digits are the profile number, the 3 to 6. digit are the finger id (100*i+j; i:0-136; j:0-16)
+    if upload_scene_reference:
+        ### Camera ###
+        PXpic=alphapic.copy() #orignal Pixel X
+        PYpic=alphapic.copy() #orignal Pixel Y
+        Xpic3D=alphapic.copy() #CAD 3D X from Scene Model
+        Ypic3D=alphapic.copy() #CAD 3D Y from Scene Model
+        Zpic3D=alphapic.copy() #CAD 3D Z from Scene Model
+        CID=alphapic.copy() #Component ID from the Scene Model
+        szene=h5.File(scenepath+"AEF"+str(port)+"_scene_model_"+str(scene_reference_time)+".h5",'r')
+        Xloc=np.asarray(szene['x'])
+        Yloc=np.asarray(szene['y'])
+        Zloc=np.asarray(szene['z'])
+        #CAD=np.asarray(szene['CAD'])
+        PFC=np.asarray(szene['PFC'])
+    
+    linedict={'h_l':30,'h_m':54,'h_h':24,'v':29}
+    numstacks={            
+    'h_l':{0:13,1:14,2:14,3:14,4:14,5:14,6:14,7:14,8:14,9:14,10:15,11:15,12:14,13:14,14:14,15:13,16:13,17:13,18:13,19:13,20:13,21:13,22:13,23:13,24:13,25:13,26:13,27:13,28:13,29:13},
+    'h_m':{0:14,1:15,2:14,3:15,4:14,5:15,6:14,7:15,8:14,9:15,10:14,11:15,12:14,13:15,14:14,15:15,16:14,17:15,18:14,19:15,20:14,21:15,22:14,23:15,24:14,25:15,26:14,27:15,28:14,29:15,30:14,31:15,32:14,33:15,34:14,35:15,36:14,37:15,38:14,39:15,40:14,41:15,42:14,43:15,44:14,45:15,46:14,47:15,48:15,49:14,50:14,51:14,52:14,53:15},
+    'h_h':{0:16,1:15,2:15,3:15,4:15,5:15,6:15,7:15,8:15,9:15,10:15,11:15,12:15,13:15,14:15,15:15,16:15,17:15,18:15,19:15,20:15,21:15,22:15,23:15},
+    'v':{0:15,1:15,2:15,3:15,4:15,5:15,6:15,7:15,8:15,9:15,10:15,11:15,12:15,13:15,14:15,15:15,16:15,17:15,18:15,19:15,20:15,21:15,22:15,23:15,24:15,25:15,26:15,27:15,28:15}
+    }
+    
+    def splitStacktoLines(locationall, rowcountarray):
+      locations = []
+      for i in range(len(rowcountarray) - 1):
+        locations.append(np.array(locationall[rowcountarray[i]:rowcountarray[i+1]]))
+      locations = np.array(locations)
+      return locations 
+    ii=0
+    V_index=0
+    xoff=0
+    maxyoff=0
+    tn=0
+    for tile in tilelist:#['h_l','h_m','h_h','v']:
+        tn+=1
+        tile=tile.replace(" ","")
+        linn=linedict[tile]
+        if tile!='v':
+            V_index+=linn
+            yoff=130
+        else:        
+            yoff=1
+            xoff=1
+        for i in range(linn):
+            if ii<30:
+                iko=ii
+            elif ii<84:
+                iko=ii-30            
+            elif ii<108:
+                iko=ii-84
+            else:
+                iko=ii-108
+            if ii>=78 and ii<108:
+                tn=3
+            fingerfile=str(port//10)
+            if port % 10 ==0:
+                 fingerfile=fingerfile+"l"+tile+"_"
             else:
-                yloff=0
-            lprof=np.array(File['profiles_'+str(ii)+"_"+str(j2)][0])
-            lalpha=np.array(File['alpha_'+str(ii)+"_"+str(j2)][0])
-            lheat=np.array(File['heat_'+str(ii)+"_"+str(j2)])
-            lXY=np.array(File['plot_profiles_'+str(ii)+"_"+str(j2)])
-            loco=locations[j2]
-            profilelength=int(np.max(lprof)/3e-3)+1
-            for k in range(profilelength):                
-                pos=k*3e-3#3.143e-3                                        
-                pid=IR.IR_tools.find_nearest(lprof,pos)
-                if abs(pos-lprof[pid])<2e-3:
-                    alphapic[yoff+yloff,xoff]=lalpha[pid]
-                    heatpics[yoff+yloff,xoff,:]=lheat[:,pid]
-                    Xpic[yoff+yloff,xoff]=lXY[pid,0]
-                    Ypic[yoff+yloff,xoff]=lXY[pid,1]
-                    FXpic[yoff+yloff,xoff]=loco[pid,0]
-                    FYpic[yoff+yloff,xoff]=loco[pid,1]
-                    profpic[yoff+yloff,xoff]=lprof[pid]
-#                    profnpic[yoff+yloff,xoff]=j
-                    tilepic[yoff+yloff,xoff]=tn
-                    fingerpic[yoff+yloff,xoff]=ii*100+j
-                yloff+=1
+                 fingerfile=fingerfile+"u"+tile+"_"
+            if port==20 and int(program.split(".")[0])<20171020:
+                linefile=fingerfile+'{0:02d}'.format(iko)+"2Dlines_biliniar_before_20171020.h5"
+            else:
+                linefile=fingerfile+'{0:02d}'.format(iko)+"2Dlines_biliniar.h5"
+            linf=h5.File(outpfad+linefile,'r')
+            linid=list(linf['LineNos'])
+            lines=linf['locationall2D']#
+            linlocid=linf['rowcountarray']
+            linrefpoi=linf['refPoi']
+            linweipoi=linf['weightPoi']
+            if port==50:
+                shapi=[1024, 1280]
+            else:
+                shapi=[768, 1024]
+            locations=splitStacktoLines(lines,linlocid)
+            locpoi=splitStacktoLines(linrefpoi,linlocid)
+            locwei=splitStacktoLines(linweipoi,linlocid)            
+            linf.close()
             xoff+=1
-            if yloff>maxyoff and not shift:
-                maxyoff=yloff
-        ii+=1
-
-#plt.figure();plt.imshow(alphapic[:,:,0])
-#plt.figure();plt.imshow(tilepic[:,:,0])
-#plt.figure();plt.imshow(fingerpic[:,:,0])
-#plt.figure();plt.imshow(heatpics[:,:,50])
-#testupload ####
-
-archivepath="http://archive-webapi.ipp-hgw.mpg.de/Test/raw/"
-prog=IR.get_program_from_PID(program)
-if prog[0]:
-    t1=prog[1]['trigger']['1'][0]
-    time_ns=[int(t1-1e9)]
-    for t3 in time:
-        time_ns.append(int(t1+t3*1e9))
-    images=np.append(alphapic,heatpics,axis=2)
-    chanDesc=[{'name':'heatflux','physicalQuantity':{'type':'W/m^2'},'active':1}]
-    parobj={"label":"parms",
-                "description":"heat flux for IR camera in AEF"+str(port),
-                "values":[{"chanDescs":chanDesc,'header':header,'comment':comment}],
-                "dimensions":[int(time_ns[0]),int(time_ns[-1])]}
+            if tile=='h_m' and iko<48 and iko%2==1:
+                shift=True
+                xoff=xoff-numstacks[tile][i-1]-1
+                maxyoff+=1
+            else:
+                shift=False
+                maxyoff=0
+            for j in range(numstacks[tile][i]): 
+                j2=linid.index(j)
+                if shift:
+                    yloff=maxyoff
+                else:
+                    yloff=0
+                lprof=np.array(File['profiles_'+str(ii)+"_"+str(j2)][0])
+                lalpha=np.array(File['alpha_'+str(ii)+"_"+str(j2)][0])
+                lheat=np.array(File['heat_'+str(ii)+"_"+str(j2)])
+                lXY=np.array(File['plot_profiles_'+str(ii)+"_"+str(j2)])
+                xf=np.array(np.asarray(locpoi[j2])%shapi[1],dtype=np.int16)
+                yf=np.array(np.asarray(locpoi[j2])//shapi[1],dtype=np.int16)
+                PX=np.asarray([np.dot(xf[o],locwei[j2][o]) for o in range(len(xf))])
+                PY=np.asarray([np.dot(yf[o],locwei[j2][o]) for o in range(len(yf))])
+                loco=locations[j2]
+                profilelength=int(np.max(lprof)/3e-3)+1
+                for k in range(profilelength):                
+                    pos=k*3e-3#3.143e-3                                        
+                    pid=IR.IR_tools.find_nearest(lprof,pos)
+                    if abs(pos-lprof[pid])<2e-3:
+                        alphapic[yoff+yloff,xoff]=lalpha[pid]
+                        heatpics[yoff+yloff,xoff,:]=lheat[:,pid]
+                        if upload_Mapping:
+                            Xpic[yoff+yloff,xoff]=lXY[pid,0]
+                            Ypic[yoff+yloff,xoff]=lXY[pid,1]
+                            FXpic[yoff+yloff,xoff]=loco[pid,0]
+                            FYpic[yoff+yloff,xoff]=loco[pid,1]
+                            profpic[yoff+yloff,xoff]=lprof[pid]
+        #                    profnpic[yoff+yloff,xoff]=j
+                            tilepic[yoff+yloff,xoff]=tn
+                            fingerpic[yoff+yloff,xoff]=ii*100+j
+                        if upload_scene_reference:
+                            PXpic[yoff+yloff,xoff]=int(round(PX[pid],0))
+                            PYpic[yoff+yloff,xoff]=int(round(PY[pid],0))
+                            Xpic3D[yoff+yloff,xoff]=Xloc[int(round(PY[pid],0)),int(round(PX[pid],0))]
+                            Ypic3D[yoff+yloff,xoff]=Yloc[int(round(PY[pid],0)),int(round(PX[pid],0))]
+                            Zpic3D[yoff+yloff,xoff]=Zloc[int(round(PY[pid],0)),int(round(PX[pid],0))]
+                            CID[yoff+yloff,xoff]=PFC[int(round(PY[pid],0)),int(round(PX[pid],0))]
+                    yloff+=1
+                xoff+=1
+                if yloff>maxyoff and not shift:
+                    maxyoff=yloff
+            ii+=1
+    del lalpha,lheat,lXY,loco,lprof,tn,File
+    #plt.figure();plt.imshow(alphapic[:,:,0])
+    #plt.figure();plt.imshow(tilepic[:,:,0])
+    #plt.figure();plt.imshow(fingerpic[:,:,0])
+    #plt.figure();plt.imshow(heatpics[:,:,50])
+    #testupload ####
     
-    url=archivepath+project+"/"+group+"/AEF"+str(port)+"_heatflux"
-#    url=IR.archivepath+project+"/"+group+"/"+stream
-    ver=IR.get_latest_version("Test/raw/"+project+"/"+group+"/"+stream+"_PARLOG",project=project,Test=True)
-    if ver==None:
-        reason="Versioning of Data"
-        IRup.archive_create_stream_version(url, reason, False, "n/a", "n/a" )
-    print(datetime.datetime.now(),"starting upload")
-    IRup.upload_Parlog(url,parobj,versionnumber=1)  
-    print(datetime.datetime.now(),"parlog written")
-    IRup.upload_images(images,time=time_ns,group=group,stream=stream,project=project,version=1,swapping=False,Test=True)
-    print(datetime.datetime.now(),"data uploaded")
-    if upload_Mapping:
-        ### upload reference stream ###once!
-        time_ns2=[]
-        timet1=int(IR.TimeToNs([2017,9,26],[8,0,0,0]))
-        for t in range(7):
-            time_ns2.append(int(timet1+10*t))
-        images2=np.append(profpic,Xpic,axis=2)
-        images2=np.append(images2,Ypic,axis=2)
-        images2=np.append(images2,FXpic,axis=2)
-        images2=np.append(images2,FYpic,axis=2)
-        images2=np.append(images2,fingerpic,axis=2)    #    images2=np.append(images2,profnpic,axis=2)    
-        images2=np.append(images2,tilepic,axis=2)
-        header2={'profile':int(timet1),'MX':int(timet1+10),'MY':int(timet1+20),'FX':int(timet1+30),'FY':int(timet1+40),'finger_profile':int(timet1+50),'targetgroup':int(timet1+60)}
-        chanDesc=[{'name':'reference','physicalQuantity':{'type':'none'},'active':1}]
+    archivepath="http://archive-webapi.ipp-hgw.mpg.de/Test/raw/"
+    prog=IR.get_program_from_PID(program)
+    if prog[0]:
+        t1=prog[1]['trigger']['1'][0]
+        time_ns=[int(t1-1e9)]
+        for t3 in time:
+            time_ns.append(int(t1+t3*1e9))
+        images=np.append(alphapic,heatpics,axis=2)
+        chanDesc=[{'name':'heatflux','physicalQuantity':{'type':'W/m^2'},'active':1}]
         parobj={"label":"parms",
-                    "description":"reference data for the heat flux",
-                    "values":[{"chanDescs":chanDesc,'header':header2,'comment':comment}],
-                    "dimensions":[int(time_ns2[0]),int(time_ns2[-1])]
-                    }
-    #    url=IR.archivepath+project+"/"+group+"/"+stream2
-        url=archivepath+project+"/"+group+"/"+stream2
-        ver=IR.get_latest_version("Test/raw/"+project+"/"+group+"/"+stream2+"_PARLOG",project=project,Test=True)
+                    "description":"heat flux for IR camera in AEF"+str(port),
+                    "values":[{"chanDescs":chanDesc,'header':header,'comment':comment}],
+                    "dimensions":[int(time_ns[0]),int(time_ns[-1])]}
+        
+        url=archivepath+project+"/"+group+"/AEF"+str(port)+"_heatflux"
+    #    url=IR.archivepath+project+"/"+group+"/"+stream
+        ver=IR.get_latest_version(group+"/"+stream+"_PARLOG",project=project,Test=True)
         if ver==None:
             reason="Versioning of Data"
             IRup.archive_create_stream_version(url, reason, False, "n/a", "n/a" )
-        IRup.upload_Parlog(url,parobj,versionnumber=1)  
-        IRup.upload_images(images2,time=time_ns2,group=group,stream=stream2,project=project,version=1,swapping=False,Test=True)
+        print(datetime.datetime.now(),"starting upload")
+#        IRup.upload_Parlog(url,parobj,versionnumber=1)  
+        print(datetime.datetime.now(),"parlog written")
+#        IRup.upload_images(images,time=time_ns,group=group,stream=stream,project=project,version=1,swapping=False,Test=True)
+        print(datetime.datetime.now(),"data uploaded")
+        del images,alphapic,heatpics,time_ns
+        if upload_Mapping:
+            ### upload reference stream ###once!
+            time_ns2=[]
+            timet1=int(IR.TimeToNs([2017,9,26],[8,0,0,0]))
+            for t in range(7):
+                time_ns2.append(int(timet1+10*t))
+            images2=np.append(profpic,Xpic,axis=2)
+            images2=np.append(images2,Ypic,axis=2)
+            images2=np.append(images2,FXpic,axis=2)
+            images2=np.append(images2,FYpic,axis=2)
+            images2=np.append(images2,fingerpic,axis=2)    #    images2=np.append(images2,profnpic,axis=2)    
+            images2=np.append(images2,tilepic,axis=2)
+            header2={'profile':int(timet1),'MX':int(timet1+10),'MY':int(timet1+20),'FX':int(timet1+30),'FY':int(timet1+40),'finger_profile':int(timet1+50),'targetgroup':int(timet1+60)}
+            chanDesc=[{'name':'reference','physicalQuantity':{'type':'none'},'active':1}]
+            parobj={"label":"parms",
+                        "description":"reference data for the heat flux",
+                        "values":[{"chanDescs":chanDesc,'header':header2,'comment':comment}],
+                        "dimensions":[int(time_ns2[0]),int(time_ns2[-1])]
+                        }
+        #    url=IR.archivepath+project+"/"+group+"/"+stream2
+            url=archivepath+project+"/"+group+"/"+stream2
+            ver=IR.get_latest_version(group+"/"+stream2+"_PARLOG",project=project,Test=True)
+            if ver==None:
+                reason="Versioning of Data"
+                IRup.archive_create_stream_version(url, reason, False, "n/a", "n/a" )
+            IRup.upload_Parlog(url,parobj,versionnumber=1)  
+            IRup.upload_images(images2,time=time_ns2,group=group,stream=stream2,project=project,version=1,swapping=False,Test=True)
+        if upload_scene_reference:
+            ### upload scene model camera refrence stream (once per scene model)
+            time_ns_scene=[]
+            for t in range(6):
+                time_ns_scene.append(int(scene_reference_time+10*t))
+            images3=np.append(PXpic,PYpic,axis=2)
+            images3=np.append(images3,Xpic3D,axis=2)
+            images3=np.append(images3,Ypic3D,axis=2)
+            images3=np.append(images3,Zpic3D,axis=2)
+            images3=np.append(images3,CID,axis=2)
+            header3={'Pixel_X':int(scene_reference_time),'Pixel_Y':int(scene_reference_time+10),'CAD_X':int(scene_reference_time+20),'CAD_Y':int(scene_reference_time+30),'CAD_Z':int(scene_reference_time+40),'Component_ID':int(timet1+50)}
+            chanDesc=[{'name':'scene model reference','physicalQuantity':{'type':'none'},'active':1}]
+            parobj={"label":"parms",
+                        "description":"scene model reference data for the heat flux",
+                        "values":[{"chanDescs":chanDesc,'header':header3,'comment':comment}],
+                        "dimensions":[int(time_ns_scene[0]),int(time_ns_scene[-1])]
+                        }
+        #    url=IR.archivepath+project+"/"+group+"/"+stream2
+            url=archivepath+project+"/"+group+"/"+stream_scene
+            ver=IR.get_latest_version(group+"/"+stream_scene+"_PARLOG",project=project,Test=True)
+            if ver==None:
+                reason="Versioning of Data"
+                IRup.archive_create_stream_version(url, reason, False, "n/a", "n/a" )
+            IRup.upload_Parlog(url,parobj,versionnumber=1)  
+            IRup.upload_images(images3,time=time_ns_scene,group=group,stream=stream_scene,project=project,version=1,swapping=False,Test=True)
+            
diff --git a/uploadingversionIRdata.py b/uploadingversionIRdata.py
index 7234315f0a37193692d6bccebcd9c11b185a7bd5..31ece2ae5959726161cde0c6410f1eb8ba7c0a17 100644
--- a/uploadingversionIRdata.py
+++ b/uploadingversionIRdata.py
@@ -950,7 +950,7 @@ def upload_images(images,time,group,stream,newversion=False,reason="",project="W
 #        archive.write_signals(images,time,group,project,names, datastream_name,units,metadata,2,True)
         tmp=writeH5_images(datastream_name,images,time,swapping=swapping)
 #        uploadH5(group,datastream_name,tmp,True)
-        response=uploadH5_Versioning(group,datastream_name,tmp,version,True,project=project)
+        response=uploadH5_Versioning(group,datastream_name,tmp,version,True,project=project,Test=Test)
         return response
     except Exception as E:
         print("Upload Failed")
@@ -985,9 +985,12 @@ def uploadH5(group,stream, h5file, delete=False, timeout=None,project="W7X"):
 #    _sup.debug(result,3)
 #    return result
 
-def uploadH5_Versioning(group,stream, h5file,version, delete=False, timeout=None,project="W7X"):
+def uploadH5_Versioning(group,stream, h5file,version, delete=False, timeout=None,project="W7X",Test=False):
     # path=Path, h5file=h5-file
-    base=archivepath+project+"/"#"http://archive-webapi/Test/raw/W7X/"   #"http://sv-coda-wsvc-3/Test/raw/W7X/"#
+    if Test:
+        base="http://archive-webapi.ipp-hgw.mpg.de/Test/raw/"+project+"/"#"http://archive-webapi/Test/raw/W7X/"   #"http://sv-coda-wsvc-3/Test/raw/W7X/"#
+    else:
+        base=archivepath+project+"/"#"http://archive-webapi/Test/raw/W7X/"   #"http://sv-coda-wsvc-3/Test/raw/W7X/"#
     #http://sv-coda-wsvc-3/Test/raw/W7X/QRT_IRCAM_TEST?dataPath=/data/AEF100_RAW_TEST2&timePath=/data/timestamps&versionNumber=1 
     try:
         headers = {'Content-Type': 'application/x-hdf'}