diff --git a/FF_HEDM/v7/pf_MIDAS.py b/FF_HEDM/v7/pf_MIDAS.py index 80edd02d..f0816139 100755 --- a/FF_HEDM/v7/pf_MIDAS.py +++ b/FF_HEDM/v7/pf_MIDAS.py @@ -104,19 +104,20 @@ def parallel_peaks(layerNr,positions,startNrFirstLayer,nrFilesPerSweep,topdir,pa omegaOffsetThis = -delOmega # Because we subtract this print(f"Offsetting omega: {omegaOffsetThis}, original value: {thisOmega}.") tOme = time.time() - shutil.copy2(f'Result_StartNr_{startNr}_EndNr_{endNr}.csv',f'Result_StartNr_{startNr}_EndNr_{endNr}.csv.old') # Must use the new file that we just generated. + shutil.copy2(f'Result_StartNr_{startNr}_EndNr_{endNr}.csv',f'Result_StartNr_{startNr}_EndNr_{endNr}.csv.old') Result = np.genfromtxt(f'Result_StartNr_{startNr}_EndNr_{endNr}.csv',skip_header=1,delimiter=' ') if len(Result.shape) > 1: headRes = open(f'Result_StartNr_{startNr}_EndNr_{endNr}.csv').readline() Result = Result[Result[:,5] > minThresh] - Result[:,2] -= omegaOffsetThis - Result[Result[:,2]<-180,6] += 360 - Result[Result[:,2]<-180,7] += 360 - Result[Result[:,2]<-180,2] += 360 - Result[Result[:,2]> 180,6] -= 360 - Result[Result[:,2]> 180,7] -= 360 - Result[Result[:,2]> 180,2] -= 360 - np.savetxt(f'Result_StartNr_{startNr}_EndNr_{endNr}.csv',Result,fmt="%.6f",delimiter=' ',header=headRes.split('\n')[0],comments='') + if len(Result.shape) > 1: + Result[:,2] -= omegaOffsetThis + Result[Result[:,2]<-180,6] += 360 + Result[Result[:,2]<-180,7] += 360 + Result[Result[:,2]<-180,2] += 360 + Result[Result[:,2]> 180,6] -= 360 + Result[Result[:,2]> 180,7] -= 360 + Result[Result[:,2]> 180,2] -= 360 + np.savetxt(f'Result_StartNr_{startNr}_EndNr_{endNr}.csv',Result,fmt="%.6f",delimiter=' ',header=headRes.split('\n')[0],comments='') print(f"Omega offset done. Time taken: {time.time()-tOme} seconds.") subprocess.call(os.path.expanduser("~/opt/MIDAS/FF_HEDM/bin/CalcRadiusAllZarr")+f' {outFStem} {thisDir}',env=env,shell=True,stdout=f,stderr=f_err) subprocess.call(os.path.expanduser("~/opt/MIDAS/FF_HEDM/bin/FitSetupZarr")+f' {outFStem} {thisDir}',env=env,shell=True,stdout=f,stderr=f_err)