Skip to content

Commit

Permalink
added snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
JerryI committed Oct 30, 2024
1 parent d7ad6f5 commit a0d90d6
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Kernel/Material.wl
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,30 @@ findFDCIRanges[mFp_MaterialParameters] :=



MaterialParameters /: Snippet[m_MaterialParameters] := With[{
n = QuantityMagnitude[m["n"], {1/"Centimeters", 1}],
k = QuantityMagnitude[m["\[Alpha]"], {1/"Centimeters", 1/"Centimeters"}],
fdci = QuantityMagnitude[#, 1/"Centimeters"] &/@ m["FDCI"]
},

With[{
nPlot = ListLinePlot[
{#[[1]], Clip[#[[2]], {1,Infinity}]} &/@ Select[n, Function[item, item[[1]] > fdci[[1]] / E && item[[1]] < E fdci[[2]] ]],
PlotRange->Full, Frame->True, FrameLabel->{"wavenumber (1/cm)", ""}
, PlotStyle->ColorData[97][2], Prolog->{
Opacity[0.2], Green, Rectangle[{fdci[[1]], Min[n[[All,2]]]}, {fdci[[2]], Max[n[[All,2]]]}]
}],

kPlot = ListLinePlot[
{#[[1]], Clip[#[[2]], {-20,Infinity}]} &/@ Select[k, Function[item, item[[1]] > fdci[[1]] / E && item[[1]] < E fdci[[2]] ]],
PlotRange->Full, Frame->True, FrameLabel->{"wavenumber (1/cm)", "absorption coefficient (1/cm)"}
, Prolog->{
Opacity[0.2], Green, Rectangle[{fdci[[1]], 0}, {fdci[[2]], Max[k[[All,2]]]}]
}]
},
Panel[Row[{kPlot, nPlot}]]
] ]


End[]
EndPackage[]
27 changes: 27 additions & 0 deletions Kernel/Transmission.wl
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,33 @@ TransmissionObject[a_Association][prop_String] := If[!KeyExistsQ[a, prop],
a[prop]
]


(* :: Snippet :: *)
TransmissionObject /: Snippet[m_TransmissionObject] := With[{
phase = QuantityMagnitude[m["Phase Features"], {1/"Centimeters", 1}],
transm = QuantityMagnitude[m["Transmission"], {1/"Centimeters", 1}],
fdci = QuantityMagnitude[#, 1/"Centimeters"] &/@ m["FDCI"]
},

With[{
phasePlot = ListLinePlot[
Select[phase, Function[item, item[[1]] < E fdci[[2]] ]],
PlotRange->Full, Frame->True, FrameLabel->{"wavenumber (1/cm)", "Radians"}
, PlotStyle->ColorData[97][2], Prolog->{
Opacity[0.2], Green, Rectangle[{fdci[[1]], Min[phase[[All,2]]]}, {fdci[[2]], Max[phase[[All,2]]]}]
}],

transmPlot = ListLinePlot[
{#[[1]], Clip[#[[2]], {0,1}]} &/@ Select[transm, Function[item, item[[1]] < E fdci[[2]] ]],
PlotRange->Full, Frame->True, FrameLabel->{"wavenumber (1/cm)", "T"}
, Prolog->{
Opacity[0.2], Green, Rectangle[{fdci[[1]], -0.1}, {fdci[[2]], 1.1}]
}]
},
Panel[Row[{transmPlot, phasePlot}]]
] ]


(* :: Calculated properties :: *)

TransmissionObject[a_Association]["Kramers-Kronig n"] := With[{
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,16 @@ where `sign12` denotes the sign of a phase jump between parts, while `phaseJump1
- `"PhaseThreshold"` : sets the treshold for a detector to remove `2Pi` jump. By the default is `5.6`
- `"PhaseShift"` : overrides a constant phase offset parameter to be used later in material parameters extraction

#### How to make a preview for a transmisstion object
##### `Snippet`
To show the quick preview of your data evalaute

```mathematica
Snippet[t_TransmissionObject]
```

![](./imgs/snippet1.png)


### Material Parameters ⤵️
This the main goal of all optical spectroscopy: use EM waves to probe the responce function of the material to extract all useful properties. Here we focus on $n$ and $\kappa$ (or their derivatives).
Expand Down Expand Up @@ -292,6 +302,16 @@ All properties are *read-only*.
- `"FDCI2"` : it serves the same purpose as `FDCI` (as a criteria parameter), but relies on the phase information. It cannot be with a wrapped phase.
- `"FPReduction"` : a quality factor of Fabry-Perot fringes reduction. `1.0` or close to it means the deconvolution procedure was not succesfull. The higher - the better.

#### Preview the data
Apply `Snippet` on your object to get a formatted preview

```mathematica
Snippet[m_MaterialParameters]
```

![](./imgs/snippet2.png)


#### Optimizing parameters
The main issue is inaccuracy in `"Thickness"` and `"Gain"`, which comes naturally in a measurements. In this case a slight misaligment can make your results look much worse, when `FabryPerotCancellation` is enabled.

Expand Down
Binary file added imgs/snippet1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added imgs/snippet2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a0d90d6

Please sign in to comment.