Closed demisjohn closed 8 years ago
Also added documentation explaining how the various options for RefractiveIndex
should be used, in the docstring for RefractiveIndex
.
help( EMpy.materials.RefractiveIndex )
now prints the following:
Help on class RefractiveIndex in module EMpy.materials:
class RefractiveIndex(builtins.object)
| Refractive Index.
|
| Unaware of temperature.
|
| Parameters
| ----------
| Provide ONE of the following named-arguments:
|
| n0_const : float
| A single-value of refractive index, to be used regardless of the wavelength requested.
| Eg. n0_const = 1.448 for SiO2
|
| n0_poly : list/tuple
| Use a polynomial rix dispersion function: provide the polynomial coefficients to be evaluated by numpy.polyval.
| Eg. >>> n0_poly = (9,5,3,1) # sets the refractive index function as n = 9(wl**3) + 5(wl**2) + 3(wl) + 1
|
| n0_smcoeffs (Sellmeier coefficients): 6-element list/tuple
| Set the rix dispersion function to the 6-parameter Sellmeier function as so:
| n = 1. +
| B1 * wls ** 2 / (wls ** 2 - C1) +
| B2 * wls ** 2 / (wls ** 2 - C2) +
| B3 * wls ** 2 / (wls ** 2 - C3)
| Eg. >>> n0_smcoeffs = [B1, B2, B3, C1, C2, C3] # six values total
|
| n0_func : function
| Provide an arbitrary function to return the refractive index versus wavelength.
| Eg.
| >>> SiN_rix = RefractiveIndex( n0_func = lambda wl: 1.887 + 0.01929/x**2 + 1.6662e-4/x**4 )
| or
| >>> def SiN_func(wl):
| >>> x = wl * 1e6 # convert to microns
| >>> return 1.887 + 0.01929/x**2 + 1.6662e-4/x**4 # cauchy func
| >>> SiN_rix = RefractiveIndex( n0_func = SiN_func )
|
|
| n0_known : dictionary
| Use if RefractiveIndex will only evaluated at a specific set of `wls`.
| n0_known should be a dictionary of key:value == wavelength:rix pairs.
| Eg. >>> n0_known = { 1599e-9: 1.998, 1550e-9: 1.997, 1600e-9: 1.996 }
|
Thanks! Not sure why TravisCI tests fail, but the code looks good to me. It would have been great if you added a unittest, along with the patch, though!
No problem, my pleasure. I actually don't know what a unittest or TravisCI is - could you point me to some online help so I can do that next time?
-- Demis
(Swnt frm my oPhone)
On Jan 2, 2016, at 07:07, Lorenzo Bolla notifications@github.com wrote:
Thanks! Not sure why TravisCI tests fail, but the code looks good to me. It would have been great if you added a unittest, along with the patch, though!
— Reply to this email directly or view it on GitHub.
TravisCI is a continuous integration service (https://en.wikipedia.org/wiki/Travis_CI). I use it to run EMpy test suite on new commits (https://travis-ci.org/lbolla/EMpy).
Unittests are code whose purpose is to test the correctness of some code. EMpy has very few of them, unfortunately: https://github.com/lbolla/EMpy/tree/master/tests
You can run the existing tests with: python setup.py test
. See README.rst.
Thanks. I'll see if I can add some unittests for this if/when I add other features. As I'm figuring out how to use it, I may update documentation/docstrings as well.
-- Demis -- --- Sound OK
On Sat, Jan 2, 2016 at 8:56 AM, Lorenzo Bolla notifications@github.com wrote:
TravisCI is a continuous integration service ( https://en.wikipedia.org/wiki/Travis_CI). I use it to run EMpy test suite on new commits (https://travis-ci.org/lbolla/EMpy). Unittests are code whose purpose is to test the correctness of some code. EMpy has very few of them, unfortunately: https://github.com/lbolla/EMpy/tree/master/tests You can run the existing tests with: python setup.py test. See README.rst.
— Reply to this email directly or view it on GitHub https://github.com/lbolla/EMpy/pull/1#issuecomment-168406977.
Perfect, thank you.
RefractiveIndex.__init__()
has New optionn0_func=
for user to provide an arbitrary function for rix dispersion function. Eg.or
Confirmed this works with the
ex_transfer_matrix.py
example ex_transfer_matrix - RIX_func v1.py.zip.