Library for lab work in the Princeton Space Physics Laboratory: MATLAB tools for setting up the ion beamline and processing beam-monitor data.
-
Clone or download this repo.
-
In MATLAB (R2019a or newer), run
pspl_setup.monce per session. It puts every tool folder on the MATLAB path, so the functions work from any folder:run('path/to/PSPL_Lab/pspl_setup.m')To keep the folders on the path for future sessions, run
savepathafterwards or add that line to yourstartup.m. -
Open the tool you need. Scripts are set up by editing the variables near the top (data paths, dates, physical parameters) before running.
| Folder | What it's for | Files |
|---|---|---|
beamline/wien_filter/ |
Ion source Wien filter: plate voltage that passes each ion species, and plots of a plate-potential scan against voltage and mass | Ion_source_Wien.m |
beamline/deflection/ |
Gyroradius and sideways deflection of the beam in the beamline's magnetic fields | gyroradiusCalculator.m, derivation note (PDF) and slides |
beam_monitor/abm/ |
C-foil absolute beam monitor (ABM): count rates, absolute detection efficiency and absolute beam flux | ABM_process.m (batch script), import_ABM_file.m, determine_avg_ABM_rate.m |
Each folder's README covers inputs, outputs and data formats.
- Put it under the area it belongs to (
beamline/,beam_monitor/) in its own folder. Start a new top-level folder for a new kind of equipment or analysis. - Keep data out of the repo: read it from OneDrive and set the path near the top of the script.
- Start each function with a help block (what it does, inputs, outputs, units) so
help <name>works. - Keep derivation notes and slides next to the code they explain.
- Add a row to the table above and a short README in the tool's folder.