API: PeakTrack1D
Peak tracking across a series of 1D spectra: the entry point peaktrack1d, the analysis it returns (PeakTracker), the picking model (Pick, Multiplet, Tracks), and the processing of time-domain data. See Peak tracking for how to use it.
NMRAnalysis.PeakTrack1D — Module
PeakTrack1DInteractive picking of peak positions across a series of 1D spectra, drawn as a stack. Each entity is a multiplet made of one or more lines, and each line holds at most one pick per plane. A reference multiplet, picked like any other, lets the spectra be aligned and the shifts referenced.
The picking model (tracks.jl), the peak finding (peaks.jl) and the brush geometry (view.jl) are plain functions of plain data, and are what the tests exercise. NMRData is touched only when the spectra are loaded or processed (series.jl, processing.jl), and Makie only in drawing and the window.
NMRAnalysis.PeakTrack1D.DEFAULTREFERENCE — Constant
The reference multiplet's name unless another is given.
NMRAnalysis.PeakTrack1D.FIELDTOLERANCE — Constant
Largest relative difference between Ξ × ¹H base frequency and an X base frequency taken as the same field.
NMRAnalysis.PeakTrack1D.HEIGHTNOTE — Constant
Heading heights.csv, since a height is easily mistaken for an integral or an amplitude.
NMRAnalysis.PeakTrack1D.P0TOLERANCE — Constant
Smallest departure (degrees) from the rest of the series that marks a zero-order phase as wrong.
NMRAnalysis.PeakTrack1D.P1TOLERANCE — Constant
Smallest departure (degrees) from the series median that marks a first-order phase as wrong.
NMRAnalysis.PeakTrack1D.REF — Constant
Index of the reference multiplet, shown to the user as 0.
NMRAnalysis.PeakTrack1D.STEP — Constant
Gain step for the up and down keys.
NMRAnalysis.PeakTrack1D.IndirectReference — Type
IndirectReference(frequencies, label)Shifts on the IUPAC unified scale, referenced indirectly to DSS picked in a ¹H analysis of the same samples. frequencies holds the frequency of 0 ppm on the ¹H scale in each plane (Hz, NaN where DSS was not picked), and label names the ¹H reference.
On the unified scale the frequency of 0 ppm for nucleus X is Ξ_X times that of ¹H in DSS, so a line at frequency ν has
δ = (ν / (Ξ_X ν₀(¹H)) − 1) × 10⁶where ν = bf (1 + δ′ × 10⁻⁶) for a line at apparent shift δ′ on an axis whose 0 ppm is at bf. Because each spectrum's own bf enters, the result does not depend on how the X spectrum was referenced when it was processed.
Harris, Becker, Cabral de Menezes, Goodfellow and Granger, Pure Appl. Chem. 73, 1795 (2001); Harris et al., Pure Appl. Chem. 80, 59 (2008).
NMRAnalysis.PeakTrack1D.IndirectReference — Method
IndirectReference(source::PeakTracker, s::SpectrumSeries)Reference the spectra s indirectly to the reference picked in the ¹H analysis source, plane by plane. The two must have the same number of planes, matched in order, recorded at the same field, and source must have its own picked reference, normally DSS at 0 ppm.
NMRAnalysis.PeakTrack1D.Multiplet — Type
Multiplet(label, lines)A named multiplet and the lines it is made of, by line number. A singlet is a multiplet of one line. Lines are referred to by number so that renaming or regrouping never touches their picks.
NMRAnalysis.PeakTrack1D.PeakTracker — Type
PeakTrackerA peak-tracking analysis, returned by peaktrack1d when its window closes: the spectra, the coordinates distinguishing the planes, the multiplets and their picks, how the spectra were processed (for time-domain data), and how the shifts are referenced (see Referencing), along with the window it was picked in.
Show it in the REPL for a table of multiplet centres, copy every line's shifts with clipboard(p), get every pick with planeresults(p), draw the stack with stackplot(p), or reopen the window with peaktrack1d(p).
NMRAnalysis.PeakTrack1D.Pick — Type
Pick(plane, shift, height)A line's position in one plane: the chemical shift as measured (ppm, never aligned) and the intensity there.
NMRAnalysis.PeakTrack1D.PickedReference — Type
PickedReference(shift)Shifts referenced to the centre of the reference multiplet picked in the same analysis, which is placed at shift (ppm) in every plane.
NMRAnalysis.PeakTrack1D.Processing — Type
Processing(fids; lb=1.0, zerofill=2, solvent=:auto, phase=:auto)Time-domain data and how they become the spectra shown: one FID per experiment (1D or pseudo-2D), exponential line broadening lb (Hz, adjustable afterwards), zero-filling, solvent suppression as in autoprocess, and one (p0, p1) phase correction per experiment (degrees, TopSpin's convention) with where it came from:
:auto:autoprocess's automatic phasing:refit: the zero-order phase fitted with the first-order phase fixed at the series median, where automatic phasing failed or gave an outlying first-order phase:neighbours: the zero-order phase of the neighbouring experiments, where the refit failed too, or where the zero-order phase was far from the rest of the series (seefixphases!):none: no phase could be found for any experiment in the series:pdata: PHC0 and PHC1 from the experiment's processed data:given: passed in, or read from aprocessing.csv
phase is :auto, :pdata, a vector of (p0, p1) pairs, or the path of a processing.csv written by an earlier analysis. Phases are found once; changing the line broadening reprocesses with them, since an exponential window does not change the phase.
NMRAnalysis.PeakTrack1D.Referencing — Type
ReferencingHow the shifts of an analysis are referenced. See PickedReference and IndirectReference.
NMRAnalysis.PeakTrack1D.Session — Type
Session()What the window keeps beyond the analysis itself: the folder it last saved to, and the message shown at its foot.
NMRAnalysis.PeakTrack1D.SpectrumSeries — Type
SpectrumSeries(shifts, intensities, noise, sources, experiments; nucleus="1H", title="",
bf=NaN, bf1=NaN, xi=NaN)
SpectrumSeries(spectra)The data behind the stack: a shared chemical shift axis (ppm), the real intensities with one column per plane, the rms noise of each plane, the file each plane came from, and the index of the experiment each plane belongs to. A pseudo-2D experiment contributes several planes with one experiment index, which is what lets it be processed with one phase.
For referencing across nuclei it also holds, for each plane, the frequency of 0 ppm on its axis bf (Hz, which moves with the processing reference SR), the spectrometer's base frequency for the nucleus bf1 (Hz, from the acquisition parameter BF1, which does not), and the nucleus's Ξ ratio on the DSS scale, each NaN where unknown.
Built from a vector of processed spectra, 1D or pseudo-2D, whose shift axes must agree. Intensities and noise are divided by NMRTools' scale(spec) (number of scans × receiver gain, and the sample concentration where one is recorded), so that experiments recorded with different settings can be compared. The noise of each plane is NMRTools' whole-spectrum estimate (spec[:noise]), or where that is missing a robust estimate from the plane itself.
NMRAnalysis.PeakTrack1D.SpectrumSeries — Method
The spectra from p, one or more planes per experiment.
NMRAnalysis.PeakTrack1D.StackView — Type
StackView(s; gain=2)How the series is drawn: plane i sits on a baseline at (i - 1) * spacing, intensities divided by norm (see displayscale) are multiplied by gain, and plane i is displaced along the shift axis by offsets[i], which is zero unless the spectra are aligned to the reference.
NMRAnalysis.PeakTrack1D.Tracks — Type
Tracks(labels)Every multiplet, the reference first, and every pick, keyed by (line, plane). Starts with one multiplet of one empty line per label.
InteractiveUtils.clipboard — Method
clipboard(p::PeakTracker)Copy the shift of every line in every plane to the clipboard, tab-separated, to paste into a spreadsheet: referenced to the reference multiplet once it has been picked, as in referencedshifts.csv, and as measured before then, as in shifts.csv.
NMRAnalysis.GUI2D.planeresults — Method
planeresults(p::PeakTracker) -> Vector{NamedTuple}One row per line per plane, the counterpart of series.csv: the multiplet label, line and plane, the plane's coordinates, the line's shift (ppm), height and snr, and the multiplet's centre and referenced shift (ppm), with missing where absent.
NMRAnalysis.PeakTrack1D.addlabels! — Method
Add an empty multiplet for each of labels not already present.
NMRAnalysis.PeakTrack1D.addmultiplet! — Method
Add a multiplet of one new, empty line called name, returning the line's number.
NMRAnalysis.PeakTrack1D.alignment — Method
alignment(p) -> Union{Vector{Float64},Nothing}How far to displace each plane of the stack so that referenced shifts line up, or nothing unless the reference is available in every plane. Taken at the middle of the axis, which for indirect referencing differs from anywhere else on it by parts in 10⁶ of the displacement.
NMRAnalysis.PeakTrack1D.analysisinfo — Method
The comment lines heading every CSV: what was analysed, and from what.
NMRAnalysis.PeakTrack1D.attach! — Method
attach!(p, textbox, panel, session; radius=8, snr=5)Wire up the mouse and keyboard, and draw the summary panel at panel. The current line is the one that picking, moving, erasing, renaming and deleting act on; line 0 is the vacant slot at the end, and picking there creates a new multiplet.
NMRAnalysis.PeakTrack1D.autophase1 — Method
The phases autoprocess settles on for one FID, or nothing where it finds no line to phase by and leaves the spectrum unphased.
NMRAnalysis.PeakTrack1D.broadeningcontrol! — Method
A slider for the exponential line broadening. Changing it reprocesses every experiment; picks keep their shifts, and their heights are read from the new data.
NMRAnalysis.PeakTrack1D.callcoordinates — Method
Coordinates for the record of the call: as a NamedTuple, which has a literal form.
NMRAnalysis.PeakTrack1D.centre — Method
centre(t, m, i) -> Union{Float64,Nothing}The chemical shift of multiplet m in plane i: the mean of its lines' shifts, which is the centre of any symmetric first-order multiplet. Defined only where every line picked anywhere is picked in this plane, since a mean over whichever lines happen to be present would be biased in exactly the planes where one is missing.
NMRAnalysis.PeakTrack1D.cleanlabel — Method
cleanlabel(name) -> StringA multiplet label as it is stored: trimmed, without commas, since labels are written unquoted to CSV, and with underscores replaced by hyphens, since in a CSV header an underscore separates a quantity from a tag (see docs/src/advanced/conventions.md).
NMRAnalysis.PeakTrack1D.climb — Method
Walk uphill from index k to the nearest local maximum of y.
NMRAnalysis.PeakTrack1D.clipboardtext — Method
clipboardtext(p) -> StringWhat clipboard(p) copies, tab-separated: the contents of referencedshifts.csv once the reference has been picked in any plane, and of shifts.csv before then.
NMRAnalysis.PeakTrack1D.columnindex — Method
Index of the column called name, or an error naming the file and the column.
NMRAnalysis.PeakTrack1D.coordinatetable — Method
coordinatetable(coordinates, n) -> NamedTupleThe coordinates of n planes as a NamedTuple of vectors, from a NamedTuple of vectors, a name => values pair, a plain vector (named x), or nothing (none). With n nothing, the lengths are not checked.
NMRAnalysis.PeakTrack1D.copyfigures — Method
Copy the figures saved with the f key (figure-*.pdf) from the earlier folder that backupfolder has just moved aside into the new one, so that they stay with the analysis.
NMRAnalysis.PeakTrack1D.covered — Method
Is point m within r pixels of the stroke pts?
NMRAnalysis.PeakTrack1D.deleteline! — Method
deleteline!(t, l)Remove line l and its picks. A multiplet left without lines goes too, except the reference, which keeps one empty line so that it can be picked again.
NMRAnalysis.PeakTrack1D.densify — Method
densify(pts, step, scale) -> Vector{Point2f}The polyline pts with points added so that neighbours are at most step pixels apart, so that a stroke drawn quickly still paints a continuous band.
NMRAnalysis.PeakTrack1D.displayscale — Method
The intensity that fills one row of the stack at unit gain: the largest in the series.
NMRAnalysis.PeakTrack1D.draw! — Method
Draw the stack. Traces are a neutral colour by default so that the multiplet colours stand out; pass a colormap to colour them by plane instead.
NMRAnalysis.PeakTrack1D.erase! — Method
Remove the picks of line l for which f(pick) is true.
NMRAnalysis.PeakTrack1D.exact — Method
Plane i picked exactly at shift x, with the height of the nearest point.
NMRAnalysis.PeakTrack1D.exptfolder — Method
The experiment folder holding path, which may name its processed data instead.
NMRAnalysis.PeakTrack1D.fixphases! — Method
fixphases!(phases, phasing, fids; window, zerofill, solvent) -> (phases, phasing)Repair the phases of a series where automatic phasing failed (nothing) or went astray, using the rest of the series.
Residual first-order phase comes from the acquisition (the digital filter's group delay, the pre-scan delay, the excitation pulse) and not from the sample, so across a series recorded with the same parameters it barely varies, while the zero-order phase follows the receiver, the tuning and the temperature. A phasing that has settled on a wrong first-order phase, getting one line right and another wrong, therefore stands out from the series median (see p1outliers), and its zero-order phase is fitted again with the first-order phase fixed at the median.
The zero-order phase follows the sample, but within a series it varies by tens of degrees at most, so one far from the rest (see p0outliers) has been phased by the wrong feature, often settling near the opposite sign, when a single line is too broad or weak to dominate the fit. It takes the zero-order phase of its neighbours in the series, with the first-order phase at the median.
Automatic phasing fails outright when a spectrum has no line strong enough to phase by, which happens to a single line broadened by exchange near a pKa or a binding midpoint. Its zero-order phase is then fitted the same way at a lower signal-to-noise threshold, and failing that taken from the neighbouring experiments in the series.
NMRAnalysis.PeakTrack1D.group! — Method
group!(t, a, b) -> IntJoin the multiplet holding line b to the one holding line a, keeping the label of a's multiplet, unless b belongs to the reference, which is never absorbed into another multiplet. Returns the index of the joined multiplet.
NMRAnalysis.PeakTrack1D.hertz — Method
The base frequency in Hz. NMRTools records it in Hz, but its Bruker reader copies TopSpin's SF, which is in MHz; no spectrometer frequency is below 10⁵ Hz, so the two cannot be confused.
NMRAnalysis.PeakTrack1D.hit — Function
hit(t, v, p, scale, r, line=nothing) -> Union{Tuple{Int,Int},Nothing}Key of the pick whose marker is nearest p, if within r pixels: among the picks of line, or of every line when line is nothing.
NMRAnalysis.PeakTrack1D.initialtracks — Method
Multiplets to start from: named ones, a saved peak list, or an earlier analysis's.
NMRAnalysis.PeakTrack1D.isreferenced — Method
Is the reference available in any plane, and in every plane?
NMRAnalysis.PeakTrack1D.keychar — Method
The character typed by key, for the small set allowed in labels, or nothing.
NMRAnalysis.PeakTrack1D.linetable — Function
linetable(p, value, unit="") -> (header, rows)A wide table for a spreadsheet: one row per plane, keyed by plane and the coordinates, then one column per line of every multiplet that has been picked, the reference first. A singlet's column is named by its label, and the lines of a multiplet label[1], label[2], ... from the highest shift. Each cell is value(q) for the line's pick q in that plane, at full precision, and NA where the line is not picked or value returns nothing.
NMRAnalysis.PeakTrack1D.makeexternal! — Method
makeexternal!(t, label) -> TracksMake the reference an empty slot called label, for a reference taken from another analysis. A reference already picked in t, as an earlier peak list may hold, becomes an ordinary multiplet after it, so that its picks keep their own name rather than being relabelled.
NMRAnalysis.PeakTrack1D.meanshift — Method
Mean measured shift of a line over the planes where it is picked; NaN for an empty line.
NMRAnalysis.PeakTrack1D.multipletcolour — Function
The colour of multiplet m: black for the reference, then the Wong palette in order.
NMRAnalysis.PeakTrack1D.multipletof — Method
Index of the multiplet holding line l, or nothing.
NMRAnalysis.PeakTrack1D.multipletplot — Method
multipletplot(p, m) -> FigureMultiplet m as the summary panel shows it: each line's shift as a faint point and the centre joined up, against the first numeric coordinate or the spectrum number, referenced where the reference is available in every spectrum. See summaryseries.
NMRAnalysis.PeakTrack1D.navorder — Method
Every line of multiplet m in the order they are stepped through: picked ones first.
NMRAnalysis.PeakTrack1D.nearestrow — Method
The plane whose trace, within w ppm of p on screen, comes closest to p vertically: the plane whose peak the cursor is on, or whose baseline it is nearest.
NMRAnalysis.PeakTrack1D.neighbour — Method
neighbour(before, after, l) -> IntThe slot to select once line l has gone: of the slots in after, the nearest before l in before, the order the slots were last shown in, or failing that the nearest after it. A line never shown was added since, at the end, so the last line takes its place.
NMRAnalysis.PeakTrack1D.neighbourphase — Method
The circular mean zero-order phase (degrees) of the nearest experiments either side of k among those phased successfully, ok.
NMRAnalysis.PeakTrack1D.noiselevel — Method
Robust rms noise estimate: median absolute deviation scaled for a Gaussian.
NMRAnalysis.PeakTrack1D.openwindow — Method
openwindow(s, processing; labels, reference, refshift, coordinates, peaklist, radius, snr,
gain, colormap, size, call) -> PeakTrackerOpen the picking window on s, wait until it is closed, and return the analysis.
NMRAnalysis.PeakTrack1D.orderedlines — Method
orderedlines(t, m) -> Vector{Int}The lines of multiplet m that have been picked anywhere, in decreasing order of shift, as a spectrum reads from left to right. Their position in this list is the line number written to the output files.
NMRAnalysis.PeakTrack1D.outputcontrols! — Method
The output folder box and the Save, Load and Quit buttons; returns the box.
NMRAnalysis.PeakTrack1D.overlay — Method
overlay(t, current, g, offsets, Δ, norm) -> (others, siblings, chosen, bars)What is drawn over the stack: markers and the segments joining them, split into the current line, the other lines of its multiplet, and everything else; and for each multiplet of more than one line, a bar across its lines in each plane where its centre is defined, a tick at the centre, and a dashed path joining the centres. Segments join picks of a line in adjacent planes only, so a plane without a pick shows as a gap.
NMRAnalysis.PeakTrack1D.p0outliers — Method
p0outliers(p0) -> (centre, indices)The centre of the zero-order phases p0 (degrees) and the indices of those departing from it, round the circle, by more than five robust standard deviations and by more than P0TOLERANCE. The centre is the circular mean moved to the median of the deviations from it, so that a single wild phase barely shifts it. None for fewer than three.
NMRAnalysis.PeakTrack1D.p1outliers — Method
p1outliers(p1) -> (median, indices)The series median of the first-order phases p1, and the indices of those departing from it by more than five robust standard deviations and by more than P1TOLERANCE. None for fewer than three.
NMRAnalysis.PeakTrack1D.painted — Method
painted(band, r, scale, y0, y1) -> Vector{Tuple{Float64,Float64}}The intervals of displayed shift covered by a brush of radius r pixels drawn through the (densified) points band, within the horizontal strip from y0 to y1, merged and in increasing order. This is the shaded area on screen.
NMRAnalysis.PeakTrack1D.pdataphases — Method
PHC0 and PHC1 from each experiment's pdata/1/procs, falling back to automatic phasing where there is none. They are checked like automatic phases, since a stored phase is no more reliable than the processing that left it there.
NMRAnalysis.PeakTrack1D.peaklisttable — Method
peaklisttable(p) -> (header, rows)Column names and rows of peaklist.csv, what the user placed: one row per pick, keyed by multiplet label, whether it is the reference, line and plane. A multiplet with no picks has one row with blank line and plane and an NA shift, so that its name survives a reload.
NMRAnalysis.PeakTrack1D.peaktrack1d — Function
peaktrack1d(expts; process=true, lb=1.0, zerofill=2, solvent=:auto, phase=:auto,
labels=String[], reference="reference", refshift=0.0, coordinates=nothing,
peaklist=nothing, radius=8, snr=5, gain=2, colormap=nothing,
size=(1200, 850)) -> PeakTracker
peaktrack1d(spectra; kwargs...)
peaktrack1d(fids; lb=1.0, zerofill=2, solvent=:auto, phase=:auto, kwargs...)
peaktrack1d(previous::PeakTracker; kwargs...)Follow the positions of peaks across a series of 1D spectra, drawn as a stack. Each peak is a multiplet of one or more lines: pick each line by painting along its trajectory, then group the lines of a multiplet together. A multiplet's shift in each plane is the mean of its lines' shifts. One multiplet, shown first, is the chemical shift reference: once it is picked in every plane, the spectra can be aligned to it, and every shift is also reported referenced to it.
The window blocks until it is closed, and the analysis is returned. Show it for a table of multiplet centres, copy every line's shifts with clipboard(p), get every pick with planeresults(p), or reopen the window with peaktrack1d(p). Save writes the output folder named under the plot, and Load restores the picks saved there.
Arguments
expts: an experiment folder or number, or a list or range of them (e.g.11:42), relative to the working directory. Each may be 1D or pseudo-2D.spectra: processed spectra, as oneNMRDataor a vector of them, sharing one chemical shift axis.fids: time-domain data fromloadfid, as oneNMRDataor a vector of them.process: forexpts, process the raw data (true, the default) or load the processed spectra inpdata/1(false).lb,zerofill,solvent: exponential line broadening (Hz), zero-filling factor, and solvent suppression as for NMRTools'autoprocess, when processing. The line broadening can be changed afterwards with the slider under the plot.phase: when processing,:autoto phase every experiment automatically,:pdatato take PHC0 and PHC1 from its processed data, a vector of(p0, p1)pairs in degrees, or the path of aprocessing.csvsaved earlier. In a series of three or more, a first-order phase far from the series median is set to the median and the zero-order phase fitted again, and a zero-order phase far from the rest of the series takes its neighbours'.labels: names of multiplets to create before picking; more are created as you pick.reference: the name of the reference multiplet, picked in this analysis. Or, for ¹⁹F, ³¹P or another nucleus, a ¹HPeakTrackerof the same samples with DSS picked: the shifts are then referenced indirectly to it on the IUPAC unified scale, using NMRTools' Ξ ratios, matching spectra one to one in order (seeIndirectReference). The two must have the same number of spectra, recorded at the same field.refshift: the shift (ppm) at which a picked reference is placed when aligning and referencing.coordinates: what distinguishes the planes, one value per plane: a vector, a pair such as"pH" => pH, or aNamedTupleof vectors such as(; pH, T). Written beside every shift in the output.peaklist: apeaklist.csvsaved earlier, or an earlierPeakTracker, whose picks to start from. Each pick is placed exactly at its saved shift.radius: the search radius (pixels) for snapping and for the brush.snr: the smallest signal-to-noise ratio of a peak found by the brush. Picks placed by clicking are always accepted.gain: the initial vertical scale;colormapcolours the traces by plane.
Mouse
Only the current line responds; change it with the keys.
- drag: paint a trajectory for the current line. In every plane the brush crosses, the tallest peak whose maximum lies inside the shaded area, within that plane's strip of the stack, is picked. Narrow the brush with
[and]to keep a strong neighbour out. - click: pick the current line in the plane under the cursor.
- drag a marker: move it along its plane. Right-click a marker: delete it.
- shift-drag: erase the current line's picks under the stroke.
- scroll: zoom chemical shift. Right-drag: pan. Ctrl-click: reset the view.
Clicked and dragged picks snap to the tallest point within the search radius; m turns snapping off (for overlapped peaks), and holding shift does the opposite of the setting.
Keys
←→: step through the lines, multiplet by multiplet, to the vacant slot at the end, where picking creates a new multiplet.0-9: select a multiplet;0is the reference, which can't be selected when it comes from a ¹H analysis.r: rename the current multiplet (type, then enter; escape cancels).g, then click a marker: join that line's multiplet to the current one.u: move the current line out into a multiplet of its own.d: delete the current line.a: align the spectra to the reference, once it is picked in every plane. This changes only the display; shifts are always stored as measured.↑↓: vertical scale.[]: search radius.m: snapping.backspace: undo.s: save the analysis to the output folder.f: save a figure of the region shown there, saving the analysis first if it hasn't been saved there from this window.q: quit.
Examples
p = peaktrack1d(11:42)
p = peaktrack1d(11:42; process=false) # the processed spectra instead
p = peaktrack1d(11:42; peaklist="out/peaklist.csv") # carry on from a saved analysis
p = peaktrack1d(p) # reopen
h = peaktrack1d(11:42) # ¹H, with DSS picked as the reference
f = peaktrack1d(51:82; reference=h) # ¹⁹F of the same samples, on DSS
clipboard(p)See also peaktrack2d for 2D spectra.
NMRAnalysis.PeakTrack1D.pixelscale — Method
Pixels per data unit along x and y for the current view of ax.
NMRAnalysis.PeakTrack1D.planesfrom — Method
The planes processed from experiment k.
NMRAnalysis.PeakTrack1D.planesof — Method
The planes of one processed spectrum: its shift axis, real intensities and noise, both divided by scale(spec), its base frequency and its source.
NMRAnalysis.PeakTrack1D.ppmtext — Method
A shift as a sentence gives it: 0 ppm rather than 0.0 ppm.
NMRAnalysis.PeakTrack1D.process! — Function
Reprocess every experiment at line broadening lb, writing the planes into s in place.
NMRAnalysis.PeakTrack1D.processingtable — Method
processingtable(p::Processing) -> (header, rows)Column names and rows of processing.csv: one row per experiment, with where its phases came from (phasing), the phases (degrees), and the line broadening, zero-filling and solvent suppression. Passing the file back as phase repeats the processing without phasing again.
NMRAnalysis.PeakTrack1D.quit! — Method
Close every window once the event that asked for it has been handled.
NMRAnalysis.PeakTrack1D.readphases — Method
The (p0, p1) phases, in experiment order, from a processing.csv.
NMRAnalysis.PeakTrack1D.readtable — Method
readtable(path) -> (header, rows)A CSV written by writetable: # comment lines and blank lines are skipped, the first remaining line is the header, and every field is stripped.
NMRAnalysis.PeakTrack1D.referenced — Method
The centre of the multiplet made of lines in plane i, referenced; nothing where undefined.
NMRAnalysis.PeakTrack1D.referencedshift — Method
referencedshift(p, i, δ) -> Union{Float64,Nothing}The measured shift δ (ppm) in plane i, referenced as p.reference says, or nothing where the reference is missing in that plane.
NMRAnalysis.PeakTrack1D.referencename — Method
The reference as a sentence names it: by its own name, such as DSS, or as "the reference peak" while it keeps the default name.
NMRAnalysis.PeakTrack1D.referenceshifts — Method
The reference shift in each of n planes, or nothing if any plane lacks it.
NMRAnalysis.PeakTrack1D.referencetext — Method
How the shifts are referenced, in words.
NMRAnalysis.PeakTrack1D.referencing — Method
referencing(reference, refshift, s) -> (label, Referencing)The reference multiplet's label and how shifts are referenced, from the reference keyword: a name picks the reference in this analysis, placed at refshift; a ¹H PeakTracker references indirectly to the reference picked in it.
NMRAnalysis.PeakTrack1D.refitzero — Method
The zero-order phase of fid fitted with the first-order phase fixed at p1, or nothing.
NMRAnalysis.PeakTrack1D.reheight! — Method
Read the height of every pick in t again from s, after the spectra are reprocessed.
NMRAnalysis.PeakTrack1D.relabel! — Method
relabel!(t, m, name) -> BoolRename multiplet m, cleaning the name with cleanlabel. Returns false, changing nothing, if the name is blank or already taken by another multiplet.
NMRAnalysis.PeakTrack1D.reporting — Method
Run a file operation the user asked for, showing any error at the foot of the window.
NMRAnalysis.PeakTrack1D.restore — Method
restore(s, header, rows; reference="reference", path="the peak list") -> TracksMultiplets and picks from the rows of a peaklist.csv. Each pick is placed exactly at its saved shift, with its height read from s, so a peak list carries over to reprocessed or different data. Lines are numbered within their multiplet as they were saved. The multiplet marked as the reference comes first; without one, an empty reference called reference is added.
NMRAnalysis.PeakTrack1D.sameaxis — Method
Do two shift axes agree, to within a thousandth of a point?
NMRAnalysis.PeakTrack1D.saveanalysis — Method
saveanalysis(p, folder) -> StringWrite the output folder: summary.txt, peaklist.csv (what was picked, which Load reads back), series.csv (every line in every plane), the wide files shifts.csv, referencedshifts.csv (once the reference is picked anywhere) and heights.csv (see linetable), processing.csv for time-domain data, stack.pdf (the region shown in the window), and in peaks/ one CSV and one plot per multiplet. An existing folder is moved aside first, and the figures saved into it with the f key are copied across. Returns the folder.
NMRAnalysis.PeakTrack1D.savefigure! — Method
Save a figure of the region shown into the output folder, first saving the analysis there if it has not been saved to that folder from this window.
NMRAnalysis.PeakTrack1D.savefolder! — Method
Save the analysis to the output folder named in the window, and remember it as the folder last saved to.
NMRAnalysis.PeakTrack1D.seriestable — Method
seriestable(p) -> (header, rows)Column names and rows of series.csv: one row per line per plane, keyed by multiplet label, line (numbered by decreasing shift) and plane, with the plane's coordinates, the line's measured shift (ppm), height and snr, and the multiplet's centre and referenced shift (ppm) in that plane, repeated down its lines. Absent values are NA. A height is the intensity at the line's maximum, divided by scale(spec): a height, not an integral or an amplitude.
NMRAnalysis.PeakTrack1D.setpick! — Method
Place q on line l, replacing any earlier pick of that line in the same plane.
NMRAnalysis.PeakTrack1D.shiftlabel — Method
Axis label for a nucleus such as "1H" or "19F", with the mass number as a superscript.
NMRAnalysis.PeakTrack1D.shown — Method
Where a measured shift δ in plane i appears on screen, and the reverse.
NMRAnalysis.PeakTrack1D.snap — Method
Plane i picked at the tallest peak within w ppm of x, or nothing if the window is empty.
NMRAnalysis.PeakTrack1D.snr — Method
Signal-to-noise ratio of a pick.
NMRAnalysis.PeakTrack1D.spectralist — Method
Spectra ks of n, as a sentence lists them: by number when there are a few, as a count otherwise.
NMRAnalysis.PeakTrack1D.spectrum — Function
FID k processed with exponential line broadening lb and its stored phases.
NMRAnalysis.PeakTrack1D.stackplot — Method
stackplot(p::PeakTracker; size=(252, 340), fontsize=8, markers=true) -> FigureA publication figure of the chemical shift range last shown in the window, with its vertical scale and any alignment. The size is in points, 8.9 × 12 cm by default, a single journal column. There is no legend, so every figure has the same plot area; picks are coloured by multiplet as in the window. Save it with CairoMakie for vector output:
save("stack.pdf", stackplot(p); backend=CairoMakie, pt_per_unit=1)NMRAnalysis.PeakTrack1D.statusline — Method
The line above the stack: every multiplet in its colour, the current one bracketed with the current line's number where it has several (an external reference greyed, since it can't be selected), the vacant slot, and then whatever is being typed or chosen, or the brush settings.
NMRAnalysis.PeakTrack1D.summarypanel! — Method
summarypanel!(position, p, current)The panel beside the stack: the shifts (above) and heights (below, always including zero) of the current line's multiplet against the first coordinate, following the selection and every edit. See summaryseries.
NMRAnalysis.PeakTrack1D.summaryseries — Method
summaryseries(p, line) -> NamedTupleWhat the summary panel shows for the multiplet holding line, against the first numeric coordinate or the plane number: the shift of each line and the multiplet's centre, and the height of each line. Shifts are referenced where the reference is available in every plane, and as measured otherwise, so one panel never mixes the two. Points run in order of the coordinate, with NaN where a plane has no value and between lines, so the drawn lines break there. The vacant slot (line 0) gives empty series and m == 0.
NMRAnalysis.PeakTrack1D.tell! — Method
Show text at the foot of the window, where it can be seen; a warning is shown in red and also logged, since the REPL is usually hidden behind the window.
NMRAnalysis.PeakTrack1D.track — Method
track(s, v, pts, r, scale; snr=5) -> Vector{Pick}The peaks painted by a brush of radius r pixels drawn through pts. Each plane owns the strip between its baseline and the next one up; in each plane the brush crosses, the tallest local maximum whose position lies inside the shaded area within that strip is picked, ignoring maxima below snr times the plane's noise. Narrow the brush to keep a strong neighbour out.
NMRAnalysis.PeakTrack1D.ungroup! — Method
ungroup!(t, l) -> IntMove line l out of its multiplet into a new multiplet of its own, placed just after it. Returns the index of the multiplet that now holds l.
NMRAnalysis.PeakTrack1D.vacantname — Method
vacantname(labels) -> StringThe first of peak1, peak2, ... not already in labels, the name a multiplet takes when it is created by picking.
NMRAnalysis.PeakTrack1D.vertex — Method
vertex(x, y, k) -> (shift, height)The maximum near index k by parabolic interpolation through it and its two neighbours. Where the three points are flat or not concave there is no parabolic maximum, and the point itself is returned.
NMRAnalysis.PeakTrack1D.widetable — Method
widetable(p; digits=4) -> (header, cells)Multiplet centres as measured, one row per plane and one column per multiplet, the reference first: the table shown in the REPL, rounded and with blank cells where a centre is undefined, for reading rather than computing with.
NMRAnalysis.PeakTrack1D.window — Method
Indices of the points within w ppm of x.
NMRAnalysis.PeakTrack1D.wrap180 — Method
An angle in degrees wrapped into [-180, 180).
NMRAnalysis.PeakTrack1D.writesummary — Method
writesummary(path, p, folder)Write summary.txt, the human-readable record, rounded for reading: what was analysed, how it was processed, the reference, each multiplet's lines and the range of its centre, and the call that repeats the analysis from the files saved in folder.
NMRAnalysis.PeakTrack1D.xcoordinate — Method
The first numeric coordinate and its name, or the spectrum numbers and "spectrum".
NMRAnalysis.PeakTrack1D.xiratio — Method
The Ξ ratio of a nucleus on the DSS scale (IUPAC), or NaN where NMRTools has none.