Skip to content

Commit

Permalink
added get_volume function for magnet types
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Sep 13, 2024
1 parent da03e24 commit 2254c04
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
Empty file added __init__.py
Empty file.
9 changes: 9 additions & 0 deletions src/MagneticReadoutProcessing/MRP/MRPMagnetTypes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" collection of magnet specifications for different magnet types such as cubic n45,... """
import math
from enum import Enum

class MRPMagnetTypeException(Exception):
Expand Down Expand Up @@ -73,6 +74,14 @@ def get_dimension(self) -> (int, int, int):

raise MRPMagnetTypeException("get_dimension for this MagnetType not implemented")

def get_volume(self) -> float:
if self.is_cubic():
return self.get_dimension()[0] * self.get_dimension()[1] * self.get_dimension()[2]
elif self.is_cylindrical():
return math.pi * math.pow(self.get_dimension()[0] / 2, 2)* self.get_dimension()[1]

raise MRPMagnetTypeException("get_volume for this MagnetType not implemented")

def get_height(self) -> int:
"""
Returns the maximum height of the selected magnet type.
Expand Down
15 changes: 15 additions & 0 deletions src/MagneticReadoutProcessing/MRP/MRPPhysics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# https://chatgpt.com/share/66e4269a-1fbc-8008-a8fa-979a2dfd4025
import math

from MagneticReadoutProcessing.src.MagneticReadoutProcessing.MRP import MRPMagnetTypes

class MRPPhysics:

MAGNETIC_VACUUM_PERMEABILITY: float = 4 * math.pi * 10**-6


@staticmethod
def calculate_remancence_value(_magnettype: MRPMagnetTypes.MagnetType, _sensor_distance_mm: float, _magnetic_vacuum_permeability: float = MAGNETIC_VACUUM_PERMEABILITY) -> float:

volume_m: float = _magnettype.get_volume()
pass
Empty file.
Empty file added src/__init__.py
Empty file.

0 comments on commit 2254c04

Please sign in to comment.