######################## ## READ IN FILES ######################## # outDat has fields "time" and "values" #size is (numFrames,ny,nx,nf) #print('Input:') #(inputDat,inputHdr) = pv.get_pvp_data(input_activityFile,progressPeriod,lastFrame,startFrame,skipFrames) #frame = 0 #plt.imshow(np.squeeze(inputDat["values"][frame]),cmap='gray') #plt.show(block=False) #size is (numFrames,ny,nx,nf) print('L1:') (L1Dat,L1Hdr) = pv.get_pvp_data(l1_activityFile,progressPeriod,lastFrame,startFrame,skipFrames) #print('Err_from_file:') #(errDat,errHdr) = pv.get_pvp_data(err_activityFile,progressPeriod,lastFrame,startFrame,skipFrames) #print('Err_from_recon:') #(errDat,errHdr) = pv.get_pvp_data(err_activityFile,progressPeriod,lastFrame,startFrame,skipFrames) #print('Weights from non-checkpoint:') #(weightDat,weightsHdr) = pv.get_pvp_data(weightsFile,progressPeriod,lastFrame,startFrame,skipFrames) print('Weights from checkpoint:') (weightChkDat,weightsChkHdr) = pv.get_pvp_data(weightsChkFile,progressPeriod,lastFrame,startFrame,skipFrames) #print('Recon:') #(reconDat,reconHdr) = pv.get_pvp_data(recon_activityFile,progressPeriod,lastFrame,startFrame,skipFrames)
#(L1Struct,L1Hdr) = pv.get_pvp_data(l1_activityFile,progressPeriod,lastFrame,startFrame,skipFrames) # Gar Method # divide the L2 norm of the residual by the L2 of the input to the # residiual (i.e the image) to get % error #TODO: pass param for error method, there are 3 that I know of. Gar method, pSNR, SNR #print('Err:') #(errStruct,errHdr) = pv.get_pvp_data(err_activityFile,progressPeriod,lastFrame,startFrame,skipFrames) #Recon error? # ABS gives distance from 0. # Averaging over the 512x512 array gives err per frame #plt.plot(np.average(np.average(np.abs(err_outStruct["values"]),2),2)) #plt.show() print('Weights:') (weightStruct,weightsHdr) = pv.get_pvp_data(weightsFile,progressPeriod,lastFrame,startFrame,skipFrames) #l1_activityFile.close() #err_activityFile.close() weightsFile.close() i_arbor = 0 i_frame = 1 # index, not actual frame number margin = 2 #pixels showPlot = True savePlot = True saveName = output_dir+'analysis/'+weights[:-4]+'_'+str(i_frame).zfill(5)+'.png' weight_mat = pw.plotWeights(weightStruct,i_arbor,i_frame,margin,showPlot,savePlot,saveName)
# Gar Method # divide the L2 norm of the residual by the L2 of the input to the # residiual (i.e the image) to get % error #TODO: pass param for error method, there are 3 that I know of. Gar method, pSNR, SNR #print('Err:') #(errStruct,errHdr) = pv.get_pvp_data(err_activityFile,progressPeriod,lastFrame,startFrame,skipFrames) #Recon error? # ABS gives distance from 0. # Averaging over the 512x512 array gives err per frame #plt.plot(np.average(np.average(np.abs(err_outStruct["values"]),2),2)) #plt.show() print('Weights:') (weightStruct, weightsHdr) = pv.get_pvp_data(weightsFile, progressPeriod, lastFrame, startFrame, skipFrames) #l1_activityFile.close() #err_activityFile.close() weightsFile.close() i_arbor = 0 i_frame = 1 # index, not actual frame number margin = 2 #pixels showPlot = True savePlot = True saveName = output_dir + 'analysis/' + weights[:-4] + '_' + str(i_frame).zfill( 5) + '.png' weight_mat = pw.plotWeights(weightStruct, i_arbor, i_frame, margin, showPlot, savePlot, saveName)
######################## ## READ IN FILES ######################## # outDat has fields "time" and "values" #size is (numFrames,ny,nx,nf) #print('Input:') #(inputDat,inputHdr) = pv.get_pvp_data(input_activityFile,progressPeriod,lastFrame,startFrame,skipFrames) #frame = 0 #plt.imshow(np.squeeze(inputDat["values"][frame]),cmap='gray') #plt.show(block=False) #size is (numFrames,ny,nx,nf) print('L1:') (L1Dat, L1Hdr) = pv.get_pvp_data(l1_activityFile, progressPeriod, lastFrame, startFrame, skipFrames) #print('Err_from_file:') #(errDat,errHdr) = pv.get_pvp_data(err_activityFile,progressPeriod,lastFrame,startFrame,skipFrames) #print('Err_from_recon:') #(errDat,errHdr) = pv.get_pvp_data(err_activityFile,progressPeriod,lastFrame,startFrame,skipFrames) #print('Weights from non-checkpoint:') #(weightDat,weightsHdr) = pv.get_pvp_data(weightsFile,progressPeriod,lastFrame,startFrame,skipFrames) print('Weights from checkpoint:') (weightChkDat, weightsChkHdr) = pv.get_pvp_data(weightsChkFile, progressPeriod, lastFrame, startFrame, skipFrames)