-
Notifications
You must be signed in to change notification settings - Fork 3
/
README.Rmd
74 lines (47 loc) · 2.87 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
---
output:
github_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE,
comment = "#>",
fig.path = "man/figures/")
```
# mlfilms <img src="man/figures/logo.png" align="right" />
![R-CMD-check](https://github.com/tjconstant/mlfilms/workflows/R-CMD-check/badge.svg) [![codecov](https://codecov.io/gh/tjconstant/mlfilms/branch/master/graph/badge.svg)](https://codecov.io/gh/tjconstant/mlfilms)
Calculation of reflection from multilayer films using the transfer matrix method.
This package uses the transfer matrix method outlined in [Pedrotti, Pedrotti and Pedrotti](http://www.amazon.com/Introduction-Optics-3rd-Frank-Pedrotti/dp/0131499335) to calculate the reflection and transmission of plane polarised light from an arbitary stack of thin films.
## To Install
From within an R session, use the devtools package like so:
```{r, eval = FALSE}
devtools::install_github('tjconstant/mlfilms')
```
## The Layers
All layers are defined as a list of parameters, with the layers listed sequentially from top (incident side) to bottom (exit side). The list must contain the refractive indexes as `index` and the thicknesses of the layers as `thickness`. You may also optionally include a number of repetitions of the stack under `repetitions`.
For Example, for the following thin film stack shown in the diagram, with the listed thicknesses (t) and refractive indexes (n),
![example_figure](man/figures/example.png)
The appropriate stack would be as follows,
```{r, eval = FALSE}
mystack <- list(index = c(1.33, 1.75, 1.2, 1.3 + 1i),
thickness = c(50e-9, 50e-9, 30e-9, 27e-9),
repetitions = 1)
```
Notice the incident and exit mediums are not part of the stack, and so their refracive indexes are not listed in the `mystack` list. They will be specificed when the optical response function is called (see below).
## Example
As a quick example, here is how you'd calculate and plot the reflection from a thin silver film through a prism. This is a standard experiment in our lab which results in a reflectivity minima associated with a surface plasmon excitation.
We simply construct a stack with an appropriate refractive index and thickness (45 nm), and calculate the reflection (as a funciton of polar angle, setting the incident medium to glass.
```{r}
library(mlfilms)
mystack2 <- list(index = 0.13+4i,
thickness = 45e-9)
plasmon <- angle_scan(mystack2,
incident_medium.index = 1.5 + 0i)
```
Plotting the result using `ggplot` shows a critical edge related to the onset of total internal reflection in the prism, and the reflectivity minima resulting from a surface plasmon excitation on the silver/air interface.
```{r plasmon, message=FALSE}
library(tidyverse)
plasmon %>%
ggplot(aes(x = angle, y = Reflection))+
geom_line() +
xlab(expression(angle~(degree)))
```