Skip to content

Commit ce55c64

Browse files
committed
Start reordering things
1 parent 17905d1 commit ce55c64

File tree

3 files changed

+190
-179
lines changed

3 files changed

+190
-179
lines changed

src/components/CollectionComponents.tsx renamed to src/components/FixedTarget/FixedTargetMapComponents.tsx

Lines changed: 1 addition & 178 deletions
Original file line numberDiff line numberDiff line change
@@ -2,196 +2,19 @@ import {
22
Box,
33
Button,
44
ButtonGroup,
5-
Checkbox,
65
Dialog,
7-
DialogContent,
8-
DialogContentText,
9-
DialogTitle,
106
FormControl,
117
InputLabel,
128
MenuItem,
139
Select,
14-
FormControlLabel,
1510
Stack,
1611
TextField,
1712
ToggleButton,
1813
ToggleButtonGroup,
1914
Tooltip,
2015
} from "@mui/material";
2116
import React from "react";
22-
import { calculateEAVA, EavaRequest, MapTypes } from "./params";
23-
24-
/**
25-
* Opens a dilog showing the calculated laser delay to set for each EAVA setting, given the laser
26-
* exposure time and collection exposure time.
27-
*
28-
* @param {number} laserDwell - laser exposure time
29-
* @param {number} expTime - collection exposure time
30-
*/
31-
export function PumpProbeDialog(props: EavaRequest) {
32-
const [open, setOpen] = React.useState(false);
33-
34-
const handleClickOpen = () => {
35-
setOpen(true);
36-
};
37-
38-
const handleClose = () => {
39-
setOpen(false);
40-
};
41-
42-
return (
43-
<React.Fragment>
44-
<Tooltip
45-
title="Calculate the optimal delay to set for Repeat# Excite And Visit Again settings"
46-
placement="bottom"
47-
>
48-
<Button color="custom" variant="outlined" onClick={handleClickOpen}>
49-
EAVA calculator
50-
</Button>
51-
</Tooltip>
52-
<Dialog open={open} onClose={handleClose}>
53-
<DialogTitle>EAVA: Excite And Visit Again</DialogTitle>
54-
<DialogContent>
55-
<DialogContentText>
56-
Calculate the laser delay for each Excite And Visit Again setting
57-
from laser dwell time and exposure time.
58-
</DialogContentText>
59-
<Stack direction={"column"} spacing={1} alignItems={"center"}>
60-
<p>
61-
<b>Repeat1: </b>
62-
{calculateEAVA(props.laserDwell, props.expTime, 2)}s
63-
</p>
64-
<p>
65-
<b>Repeat2: </b>
66-
{calculateEAVA(props.laserDwell, props.expTime, 4)}s
67-
</p>
68-
<p>
69-
<b>Repeat3: </b>
70-
{calculateEAVA(props.laserDwell, props.expTime, 6)}s
71-
</p>
72-
<p>
73-
<b>Repeat5: </b>
74-
{calculateEAVA(props.laserDwell, props.expTime, 10)}s
75-
</p>
76-
<p>
77-
<b>Repeat10: </b>
78-
{calculateEAVA(props.laserDwell, props.expTime, 20)}s
79-
</p>
80-
</Stack>
81-
<DialogContentText>
82-
<b>Notes</b>
83-
<ul>
84-
<li>
85-
The repeat is the number of pairs of lines illuminated before
86-
probe.
87-
</li>
88-
<li>
89-
Because the lines in a block are 20, repeat3 will miss some
90-
lines
91-
</li>
92-
<li>
93-
ONLY use with Mapping lite, do not run a full Oxford Chip in
94-
this mode.
95-
</li>
96-
</ul>
97-
</DialogContentText>
98-
</DialogContent>
99-
</Dialog>
100-
</React.Fragment>
101-
);
102-
}
103-
104-
/**
105-
* Dynamic component which will show the pump probe options if one of the settings is selected in the
106-
* dropdown.
107-
*
108-
* @param {string} pumpProbe - selected setting
109-
* @param {number} laserDwell - laser exposure time
110-
* @param {number} expTime - collection exposure time
111-
* @param {boolean} checkerPattern - pump in a checkerboard pattern
112-
* @returns null if the selected pump probe setting is `NoPP`, a JSX.Element with input text fields otherwise
113-
*/
114-
export function PumpProbeOptions({
115-
pumpProbe,
116-
laserDwell,
117-
expTime,
118-
checkerPattern,
119-
setLaserDwell,
120-
setLaserDelay,
121-
setPrePumpExp,
122-
setChecked,
123-
}: {
124-
pumpProbe: string;
125-
laserDwell: number;
126-
expTime: number;
127-
checkerPattern: boolean;
128-
setLaserDwell: React.Dispatch<React.SetStateAction<number>>;
129-
setLaserDelay: React.Dispatch<React.SetStateAction<number>>;
130-
setPrePumpExp: React.Dispatch<React.SetStateAction<number>>;
131-
setChecked: React.Dispatch<React.SetStateAction<boolean>>;
132-
}): JSX.Element | null {
133-
if (pumpProbe === "NoPP") {
134-
return null;
135-
}
136-
137-
return (
138-
<Stack spacing={1} direction={"column"}>
139-
<Tooltip
140-
title="Exposure time for the laser pump, in seconds"
141-
placement="right"
142-
>
143-
<TextField
144-
size="small"
145-
label="Laser Dwell (s)"
146-
defaultValue={laserDwell}
147-
onChange={(e) => setLaserDwell(Number(e.target.value))}
148-
style={{ width: 150 }}
149-
/>
150-
</Tooltip>
151-
<Tooltip
152-
title="Delay time between the laser pump and the collection, in seconds"
153-
placement="right"
154-
>
155-
<TextField
156-
size="small"
157-
label="Laser Delay (s)"
158-
defaultValue={0.0}
159-
onChange={(e) => setLaserDelay(Number(e.target.value))}
160-
style={{ width: 150 }}
161-
/>
162-
</Tooltip>
163-
<Tooltip
164-
title="How long to collect before laser pump, if setting is Short2, in seconds"
165-
placement="right"
166-
>
167-
<TextField
168-
size="small"
169-
label="Pre-Pump Exposure Time (s)"
170-
defaultValue={0.0}
171-
onChange={(e) => setPrePumpExp(Number(e.target.value))}
172-
style={{ width: 150 }}
173-
/>
174-
</Tooltip>
175-
<Tooltip
176-
title="If selected, do pump every other well in a checkerboard pattern"
177-
placement="right"
178-
>
179-
<FormControl>
180-
<FormControlLabel
181-
label="Checker Pattern"
182-
control={
183-
<Checkbox
184-
checked={checkerPattern}
185-
onChange={(e) => setChecked(Boolean(e.target.checked))} // NOPE!
186-
/>
187-
}
188-
/>
189-
</FormControl>
190-
</Tooltip>
191-
<PumpProbeDialog laserDwell={laserDwell} expTime={expTime} />
192-
</Stack>
193-
);
194-
}
17+
import { MapTypes } from "../params";
19518

19619
/**
19720
* Create list of numbered ToggleButtons to add to a ToggleButtonGroup
Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
import {
2+
Button,
3+
Checkbox,
4+
Dialog,
5+
DialogContent,
6+
DialogContentText,
7+
DialogTitle,
8+
FormControl,
9+
FormControlLabel,
10+
Stack,
11+
TextField,
12+
Tooltip,
13+
} from "@mui/material";
14+
import React from "react";
15+
import { calculateEAVA, EavaRequest } from "../params";
16+
17+
/**
18+
* Opens a dilog showing the calculated laser delay to set for each EAVA setting, given the laser
19+
* exposure time and collection exposure time.
20+
*
21+
* @param {number} laserDwell - laser exposure time
22+
* @param {number} expTime - collection exposure time
23+
*/
24+
export function PumpProbeDialog(props: EavaRequest) {
25+
const [open, setOpen] = React.useState(false);
26+
27+
const handleClickOpen = () => {
28+
setOpen(true);
29+
};
30+
31+
const handleClose = () => {
32+
setOpen(false);
33+
};
34+
35+
return (
36+
<React.Fragment>
37+
<Tooltip
38+
title="Calculate the optimal delay to set for Repeat# Excite And Visit Again settings"
39+
placement="bottom"
40+
>
41+
<Button color="custom" variant="outlined" onClick={handleClickOpen}>
42+
EAVA calculator
43+
</Button>
44+
</Tooltip>
45+
<Dialog open={open} onClose={handleClose}>
46+
<DialogTitle>EAVA: Excite And Visit Again</DialogTitle>
47+
<DialogContent>
48+
<DialogContentText>
49+
Calculate the laser delay for each Excite And Visit Again setting
50+
from laser dwell time and exposure time.
51+
</DialogContentText>
52+
<Stack direction={"column"} spacing={1} alignItems={"center"}>
53+
<p>
54+
<b>Repeat1: </b>
55+
{calculateEAVA(props.laserDwell, props.expTime, 2)}s
56+
</p>
57+
<p>
58+
<b>Repeat2: </b>
59+
{calculateEAVA(props.laserDwell, props.expTime, 4)}s
60+
</p>
61+
<p>
62+
<b>Repeat3: </b>
63+
{calculateEAVA(props.laserDwell, props.expTime, 6)}s
64+
</p>
65+
<p>
66+
<b>Repeat5: </b>
67+
{calculateEAVA(props.laserDwell, props.expTime, 10)}s
68+
</p>
69+
<p>
70+
<b>Repeat10: </b>
71+
{calculateEAVA(props.laserDwell, props.expTime, 20)}s
72+
</p>
73+
</Stack>
74+
<DialogContentText>
75+
<b>Notes</b>
76+
<ul>
77+
<li>
78+
The repeat is the number of pairs of lines illuminated before
79+
probe.
80+
</li>
81+
<li>
82+
Because the lines in a block are 20, repeat3 will miss some
83+
lines
84+
</li>
85+
<li>
86+
ONLY use with Mapping lite, do not run a full Oxford Chip in
87+
this mode.
88+
</li>
89+
</ul>
90+
</DialogContentText>
91+
</DialogContent>
92+
</Dialog>
93+
</React.Fragment>
94+
);
95+
}
96+
97+
/**
98+
* Dynamic component which will show the pump probe options if one of the settings is selected in the
99+
* dropdown.
100+
*
101+
* @param {string} pumpProbe - selected setting
102+
* @param {number} laserDwell - laser exposure time
103+
* @param {number} expTime - collection exposure time
104+
* @param {boolean} checkerPattern - pump in a checkerboard pattern
105+
* @returns null if the selected pump probe setting is `NoPP`, a JSX.Element with input text fields otherwise
106+
*/
107+
export function PumpProbeOptions({
108+
pumpProbe,
109+
laserDwell,
110+
expTime,
111+
checkerPattern,
112+
setLaserDwell,
113+
setLaserDelay,
114+
setPrePumpExp,
115+
setChecked,
116+
}: {
117+
pumpProbe: string;
118+
laserDwell: number;
119+
expTime: number;
120+
checkerPattern: boolean;
121+
setLaserDwell: React.Dispatch<React.SetStateAction<number>>;
122+
setLaserDelay: React.Dispatch<React.SetStateAction<number>>;
123+
setPrePumpExp: React.Dispatch<React.SetStateAction<number>>;
124+
setChecked: React.Dispatch<React.SetStateAction<boolean>>;
125+
}): JSX.Element | null {
126+
if (pumpProbe === "NoPP") {
127+
return null;
128+
}
129+
130+
return (
131+
<Stack spacing={1} direction={"column"}>
132+
<Tooltip
133+
title="Exposure time for the laser pump, in seconds"
134+
placement="right"
135+
>
136+
<TextField
137+
size="small"
138+
label="Laser Dwell (s)"
139+
defaultValue={laserDwell}
140+
onChange={(e) => setLaserDwell(Number(e.target.value))}
141+
style={{ width: 150 }}
142+
/>
143+
</Tooltip>
144+
<Tooltip
145+
title="Delay time between the laser pump and the collection, in seconds"
146+
placement="right"
147+
>
148+
<TextField
149+
size="small"
150+
label="Laser Delay (s)"
151+
defaultValue={0.0}
152+
onChange={(e) => setLaserDelay(Number(e.target.value))}
153+
style={{ width: 150 }}
154+
/>
155+
</Tooltip>
156+
<Tooltip
157+
title="How long to collect before laser pump, if setting is Short2, in seconds"
158+
placement="right"
159+
>
160+
<TextField
161+
size="small"
162+
label="Pre-Pump Exposure Time (s)"
163+
defaultValue={0.0}
164+
onChange={(e) => setPrePumpExp(Number(e.target.value))}
165+
style={{ width: 150 }}
166+
/>
167+
</Tooltip>
168+
<Tooltip
169+
title="If selected, do pump every other well in a checkerboard pattern"
170+
placement="right"
171+
>
172+
<FormControl>
173+
<FormControlLabel
174+
label="Checker Pattern"
175+
control={
176+
<Checkbox
177+
checked={checkerPattern}
178+
onChange={(e) => setChecked(Boolean(e.target.checked))} // NOPE!
179+
/>
180+
}
181+
/>
182+
</FormControl>
183+
</Tooltip>
184+
<PumpProbeDialog laserDwell={laserDwell} expTime={expTime} />
185+
</Stack>
186+
);
187+
}

src/screens/CollectionPanel.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import {
1111
} from "@mui/material";
1212
import { PvComponent } from "../pv/PvComponent";
1313
import React from "react";
14-
import { MapView, PumpProbeOptions } from "../components/CollectionComponents";
14+
import { PumpProbeOptions } from "../components/FixedTarget/PumpProbeComponents";
15+
import { MapView } from "../components/FixedTarget/FixedTargetMapComponents";
1516
import { chipTypes, MapTypes, pumpProbeMode } from "../components/params";
1617
import { forceString } from "../pv/util";
1718
import { AbortButton, RunPlanButton } from "../blueapi/BlueapiComponents";

0 commit comments

Comments
 (0)