Skip to content

Commit

Permalink
Use f-strings instead of str()
Browse files Browse the repository at this point in the history
  • Loading branch information
the-professor510 committed Jan 10, 2025
1 parent 5a60495 commit 1713e78
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions tools/plotDetectorsClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tools/validateFibreDect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions tools/validateHGG.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand All @@ -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)))
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}")

0 comments on commit 1713e78

Please sign in to comment.