Beispiel #1
0
# --------------------------- Modules Importation --------------------------- #
import matplotlib
matplotlib.use('pgf')
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
import scipy.special as sp
import scipy.interpolate as interpolate
import scipy.integrate as integrate
import scipy.constants as cst
import itertools
import unittest
import sympy
import vphys

pgf_with_pdflatex = vphys.default_pgf_configuration()
matplotlib.rcParams.update(pgf_with_pdflatex)

# -------------------------------- Functions -------------------------------- #
def user_mod(value, modulo):
  return value-np.abs(modulo)*np.floor(value/np.abs(modulo))

def ExpansionCoefficient(m,p):
  """
  Computes the expansion coefficient of non-paraxial terms of the
  Lax series. Its mathematical form is (Opt. Lett 28(10), 2003):
   c_p^(m) = (2m)!/[m(p-1)!(m-1)!(m+p)!].
  We compute it by first taking the logarithms, expanding the terms, and then
  computing the exponential of that.
  """
  firstNumerator   = sp.gammaln(2*m+1)
# -- OS and other stuff.
import time
import argparse
import imp

# -- Load our custom modules.
vphys           = imp.load_source('vphys', "../../python-tools/vphys.py")
AnalysisStratto = imp.load_source('AnalysisStratto', "../../python-tools/AnalysisStrattoCalculator.py")
import vphys
import AnalysisStratto as analstrat


# ------------------------------ Configuration ------------------------------ #

#-- We reset the LaTeX parameters to enable XeLaTeX.
mpl.rcParams.update(vphys.default_pgf_configuration())


# ----------------------------- Argument Parsing ---------------------------- #
parser = argparse.ArgumentParser()
parser.add_argument("--output-directory",
                      type=str,
                      default="figs/",
                      help="Directory where the figures will be saved.")
args = parser.parse_args()

# --------------------------- Function Definition --------------------------- #
def GaussIntegrals(analysis_obj, field_type, r_index, frequency_index):
  """
  Evaluates the Gaussian integral of Maxwell's equations, either for the
  magnetic or electric field, for a given frequency, and for a given value of r.