Skip to content

Commit

Permalink
added palette
Browse files Browse the repository at this point in the history
  • Loading branch information
JerryI committed Nov 15, 2024
1 parent f673cf8 commit 2a6a686
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 0 deletions.
83 changes: 83 additions & 0 deletions Kernel/Wizard.wl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,89 @@ TDSWizard::usage = "TDSWizard"

Begin["`Private`"]

toStringHeld[expr_] := StringDrop[StringDrop[ToString[Hold[expr], InputForm], 5],-1]
SetAttributes[toStringHeld, HoldFirst];

TDSPalette := CellPrint[toStringHeld @ With[{parent = CurrentWindow["Origin"]},
{
{
EventHandler[InputButton["TDTrace"], Function[Null,
With[{selected = FrontFetchAsync[FrontEditorSelected["Get"], "Window"->parent]},
Then[selected, Function[string,
If[TrueQ[StringLength[StringTrim[string]] > 0],
FrontSubmit[FrontEditorSelected["Set", "TDTrace[QuantityArray["<>StringTrim[string]<>", {\"Picoseconds\", 1}]]"], "Window"->parent]
,
FrontSubmit[FrontEditorSelected["Set", "TDTrace[QuantityArray[(*BB[*)( )(*,*)(*\"1:eJxTTMoPSmNkYGAoZgESHvk5KRAeB5AILqnMSXXKr0hjgskHleakFnMBGU6JydnpRfmleSlpzDDlQe5Ozvk5+UVFDGDwwR6dwcAAAAHdFiw=\"*)(*]BB*), {\"Picoseconds\", 1}]]"], "Window"->parent]
]
]]
]

]],
Item[" Transform list of tds-data to TDTrace", FontSize->8]
},

{
EventHandler[InputButton["TransmissionObject"], Function[Null,
With[{selected = FrontFetchAsync[FrontEditorSelected["Get"], "Window"->parent]},
Then[selected, Function[string,
If[TrueQ[StringLength[StringTrim[string]] > 0],
FrontSubmit[FrontEditorSelected["Set", "TransmissionObject["<>StringTrim[string]<>", \"Thickness\"->Quantity[(*BB[*)( )(*,*)(*\"1:eJxTTMoPSmNkYGAoZgESHvk5KRAeB5AILqnMSXXKr0hjgskHleakFnMBGU6JydnpRfmleSlpzDDlQe5Ozvk5+UVFDGDwwR6dwcAAAAHdFiw=\"*)(*]BB*), \"Millimeters\"]]"], "Window"->parent]
,
FrontSubmit[FrontEditorSelected["Set", "TransmissionObject[(*BB[*)(sample)(*,*)(*\"1:eJxTTMoPSmNkYGAoZgESHvk5KRAeB5AILqnMSXXKr0hjgskHleakFnMBGU6JydnpRfmleSlpzDDlQe5Ozvk5+UVFDGDwwR6dwcAAAAHdFiw=\"*)(*]BB*), (*BB[*)(reference)(*,*)(*\"1:eJxTTMoPSmNkYGAoZgESHvk5KRAeB5AILqnMSXXKr0hjgskHleakFnMBGU6JydnpRfmleSlpzDDlQe5Ozvk5+UVFDGDwwR6dwcAAAAHdFiw=\"*)(*]BB*), \"Thickness\"->Quantity[(*BB[*)( )(*,*)(*\"1:eJxTTMoPSmNkYGAoZgESHvk5KRAeB5AILqnMSXXKr0hjgskHleakFnMBGU6JydnpRfmleSlpzDDlQe5Ozvk5+UVFDGDwwR6dwcAAAAHdFiw=\"*)(*]BB*), \"Millimeters\"]]"], "Window"->parent]
]
]]
]
]],
Item[" Calculates transmission based on two TDTraces", FontSize->8]
},

{
EventHandler[InputButton["TransmissionUnwrap"], Function[Null,
With[{selected = FrontFetchAsync[FrontEditorSelected["Get"], "Window"->parent]},
Then[selected, Function[string,
If[TrueQ[StringLength[StringTrim[string]] > 0],
FrontSubmit[FrontEditorSelected["Set", "TransmissionUnwrap["<>StringTrim[string]<>", \"Basic\"]"], "Window"->parent]
,
FrontSubmit[FrontEditorSelected["Set", "TransmissionUnwrap[(*BB[*)( )(*,*)(*\"1:eJxTTMoPSmNkYGAoZgESHvk5KRAeB5AILqnMSXXKr0hjgskHleakFnMBGU6JydnpRfmleSlpzDDlQe5Ozvk5+UVFDGDwwR6dwcAAAAHdFiw=\"*)(*]BB*), \"Basic\"]"], "Window"->parent]
]
]]
]
]],
Item[" Unwraps phase of transmission", FontSize->8]
},

{
EventHandler[InputButton["MaterialParameters"], Function[Null,
With[{selected = FrontFetchAsync[FrontEditorSelected["Get"], "Window"->parent]},
Then[selected, Function[string,
If[TrueQ[StringLength[StringTrim[string]] > 0],
FrontSubmit[FrontEditorSelected["Set", "MaterialParameters["<>StringTrim[string]<>"]"], "Window"->parent]
,
FrontSubmit[FrontEditorSelected["Set", "MaterialParameters[(*BB[*)( )(*,*)(*\"1:eJxTTMoPSmNkYGAoZgESHvk5KRAeB5AILqnMSXXKr0hjgskHleakFnMBGU6JydnpRfmleSlpzDDlQe5Ozvk5+UVFDGDwwR6dwcAAAAHdFiw=\"*)(*]BB*)]"], "Window"->parent]
]
]]
]
]],
Item[" Calculates material parameters from transmission", FontSize->8]
},

{
EventHandler[InputButton["TDSWizard"], Function[Null,
FrontSubmit[FrontEditorSelected["Set", "TDSWizard[]"], "Window"->parent]
]],
Item[" Helper widgets", FontSize->8]
}
} // Grid
], "Target"->_];

TDSWizard[] := Column[Join[
{Item["The following options are available:", FontSize->10, Background->LightGreen ]},
Table[Item["TDSWizard["<>SymbolName[i]<>"][...]", FontSize->10], {i, {
TransmissionObject,
TransmissionUnwrap,
MaterialParameters
}}]
] ]

TDSWizard[TransmissionUnwrap][t_TransmissionObject] := TDSWizard[TransmissionUnwrap, Method->Automatic][t]
TDSWizard[TransmissionUnwrap][{t__TransmissionObject}] := TDSWizard[TransmissionUnwrap, Method->Automatic][{t}]
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,19 @@ this function will group them by `Phase` arrays (comparison by the internal refe

This also takes advantage of non-blocking execution model of OpenCL and loads all data at once.

### Palette
Shows all symbols used in the library (will be shown in a new window)

```mathematica
TDSPalette[]
```

### Time-Domain Wizards

```mathematica
TDSWizard[]
```

The general interface is

```mathematica
Expand Down

0 comments on commit 2a6a686

Please sign in to comment.