Beispiel #1
0
 def n(self, lambda0):
     if self.n_file:
         if not self.n_data:
             self.n_data = DataFileWrapper(self.n_file)
         return self.n_data.value(lambda0)
     else:
         L = (lambda0 / 1000.0)**2
         # Sellmeier equation works for um, not nm
         return sqrt(1 + L * self.B[0] / (L - self.C[0]) + L * self.B[1] /
                     (L - self.C[1]) + L * self.B[2] / (L - self.C[2]))
Beispiel #2
0
 def n(self, lambda0):
     if self.n_file:
         if not self.n_data:
             self.n_data = DataFileWrapper(self.n_file)
         return self.n_data.value(lambda0)
     else:
         L = (lambda0 / 1000.0) ** 2
         # Sellmeier equation works for um, not nm
         return sqrt(
             1 + L * self.B[0] / (L - self.C[0]) + L * self.B[1] / (L - self.C[1]) + L * self.B[2] / (L - self.C[2])
         )
Beispiel #3
0
class Material(object):
    def __init__(self,
                 name=None,
                 n=0.0,
                 B=None,
                 C=None,
                 n_file='',
                 Y=inf,
                 sigma=0.0,
                 phi=0.0,
                 notes=''):
        self.name = name if name else str(n)
        self.notes = notes
        self.n_file = n_file
        self.n_data = None
        self.B = B if B else [0.0, 0.0, 0.0]
        self.C = C if C else [0.0, 0.0, 0.0]
        if n > 0.0:
            self.B[0] = n**2 - 1.0

        self.Y = float(Y)
        self.sigma = float(sigma)
        self.phi = float(phi)

        if name:
            MaterialLibrary.Instance().register(self)

    def n(self, lambda0):
        if self.n_file:
            if not self.n_data:
                self.n_data = DataFileWrapper(self.n_file)
            return self.n_data.value(lambda0)
        else:
            L = (lambda0 / 1000.0)**2
            # Sellmeier equation works for um, not nm
            return sqrt(1 + L * self.B[0] / (L - self.C[0]) + L * self.B[1] /
                        (L - self.C[1]) + L * self.B[2] / (L - self.C[2]))

    def save(self):
        return {
            'B': self.B,
            'C': self.C,
            'n_file': self.n_file,
            'Y': self.Y,
            'sigma': self.sigma,
            'phi': self.phi,
            'notes': self.notes,
        }
Beispiel #4
0
class Material(object):
    def __init__(self, name=None, n=0.0, B=None, C=None, n_file="", Y=inf, sigma=0.0, phi=0.0, notes=""):
        self.name = name if name else str(n)
        self.notes = notes
        self.n_file = n_file
        self.n_data = None
        self.B = B if B else [0.0, 0.0, 0.0]
        self.C = C if C else [0.0, 0.0, 0.0]
        if n > 0.0:
            self.B[0] = n ** 2 - 1.0

        self.Y = float(Y)
        self.sigma = float(sigma)
        self.phi = float(phi)

        if name:
            MaterialLibrary.Instance().register(self)

    def n(self, lambda0):
        if self.n_file:
            if not self.n_data:
                self.n_data = DataFileWrapper(self.n_file)
            return self.n_data.value(lambda0)
        else:
            L = (lambda0 / 1000.0) ** 2
            # Sellmeier equation works for um, not nm
            return sqrt(
                1 + L * self.B[0] / (L - self.C[0]) + L * self.B[1] / (L - self.C[1]) + L * self.B[2] / (L - self.C[2])
            )

    def save(self):
        return {
            "B": self.B,
            "C": self.C,
            "n_file": self.n_file,
            "Y": self.Y,
            "sigma": self.sigma,
            "phi": self.phi,
            "notes": self.notes,
        }