diff --git a/tools/plotDetectorsClass.py b/tools/plotDetectorsClass.py index ef4b2c3..f2fdd59 100644 --- a/tools/plotDetectorsClass.py +++ b/tools/plotDetectorsClass.py @@ -8,8 +8,8 @@ def plot(self, radius, count, nPackets, dectType): print(radius) print(count) totalCounts = sum(count) - print("Detector Type : " + dectType) - print("Total Diffuse : " + str(totalCounts/nPackets)) + print(f"Detector Type : {dectType:.4f}") + print(f"Total Diffuse : {totalCounts/nPackets}") fig = plt.figure(1) diff --git a/tools/validateFibreDect.py b/tools/validateFibreDect.py index dd1a2d6..828ea23 100644 --- a/tools/validateFibreDect.py +++ b/tools/validateFibreDect.py @@ -15,7 +15,7 @@ totalCounts.append(sum(count)/nPackets) aperture.append(j*0.5) - print("Total Diffuse " + str(j) + " : " + str(totalCounts[j-1])) + print(f"Total Diffuse {j} : {(totalCounts[j-1]):.5f}") fig = plt.figure(1) diff --git a/tools/validateHGG.py b/tools/validateHGG.py index 8bdb16f..29517dd 100644 --- a/tools/validateHGG.py +++ b/tools/validateHGG.py @@ -11,9 +11,9 @@ # Validating against https://doi.org/10.1016/0169-2607(95)01640-F # The total diffuse reflection and tranmission for a finite refractive matched slab -print("Theoretical Total Diffure Reflection : 0.09739") -print("Simulated Total Diffuse Reflection : " + str(totalCounts)) -print("%Diff : "+ str((np.abs(totalCounts-0.09739)*100)/((0.09739 + totalCounts)/2))) +print(f"Theoretical Total Diffure Reflection : {0.09739}") +print(f"Simulated Total Diffuse Reflection : {totalCounts:.5f}") +print(f"%Diff : {((np.abs(totalCounts-0.09739)*100)/((0.09739 + totalCounts)/2)):.5f}") print() folderName = "RSMCRT/data/detectors/" @@ -23,6 +23,6 @@ radius, count, nPackets, numBins, pos, dir, typeOfDect, _ = readDetectors.read_1D_Detector(filename) totalCounts = sum(count)/nPackets -print("Theoretical Total Diffure Transmission : 0.66096") -print("Simulated Total Diffuse Transmission : " + str(totalCounts)) -print("%Diff : "+ str((np.abs(totalCounts-0.66096)*100)/((0.66096 + totalCounts)/2))) \ No newline at end of file +print(f"Theoretical Total Diffure Transmission : {0.66096}") +print(f"Simulated Total Diffuse Transmission : {(totalCounts):.5f}") +print(f"%Diff : {((np.abs(totalCounts-0.66096)*100)/((0.66096 + totalCounts)/2)):.5f}") \ No newline at end of file