spike.Interactive package

Submodules

spike.Interactive.FTICR_INTER module

A tool to display 2D FT-ICR data-sets

to be embedded in jupyter notebook

class spike.Interactive.FTICR_INTER.Calib(data)[source]

Bases: object

a simple tool to show and modify calibration cste

back(event)[source]
setref(e=None)[source]
update(event)[source]
class spike.Interactive.FTICR_INTER.MR(name, report=True, Debug=False)[source]

Bases: object

this class handles multiresolution datasets

col(i)[source]

return a column with coordinate in index

colmz(i)[source]

return a column with coordinate in m/z

compute_absmax()[source]

computes largest point from smaller resolution, and propagates

load()[source]

load from file

report()[source]

report object content

row(i)[source]

return a row with coordinate in index

rowmz(i)[source]

return a row with coordinate in m/z

to_display(zoom=0, 10000000.0, 0, 10000000.0, verbose=False)[source]

computes and return which dataset to display at a given zoom and scale level” in: zoom = ((F1low, F1up), (F2low,F2up)) - in m/z

out: a tuple (data, zoomwindow), where data is a NPKData and zoomwindow an eventually recalibrated zoom window

so, if DATA is an MR() object and Zoom a defined window in m/z ((F1low, F1up), (F2low,F2up)) the sequence:

datasel, zz = DATA.to_display(Zoom) datasel.display(zoom=zz, scale=…)

will display the selected zone with the best possible resolution

class spike.Interactive.FTICR_INTER.MR_interact(name, figsize=None, report=True, show=True, Debug=False)[source]

Bases: spike.Interactive.FTICR_INTER.MR

I1D()[source]

show the 1D selector

back(*arg)[source]
bb(name, desc, action, layout=None, tooltip='')[source]

build button

check_fig()[source]
check_fig1D()[source]
display(zoom=None, scale=None, redraw=None)[source]
display1D()[source]

display the selected 1D

down(b, factor=1.44)[source]
ext_box()[source]

defines the interactive tools for 1D

forw(*arg)[source]
fullzoom()[source]
left(b, factor=1.44)[source]
reset(b)[source]
reset_track()[source]
right(b, factor=1.44)[source]
scale1(b)[source]
scaledown(b)[source]
scaleup(b)[source]
show()[source]

actually show the graphical tool and the interactive spectrum

up(b, factor=1.44)[source]
update()[source]
property zoom
zoom_box()[source]
zoom_in(b, factor=1.44)[source]
z_in: waft = wbef/factor => waft*factor = wbef

dw = wbef/factor-wbef = wbef*(1-factor) dw = waft*factor*(1-factor)

zoom_out(b, factor=1.44)[source]

z_in: dw = waft*factor*(1-factor) z_out:dw = wbef*(factor*(1-factor))

zoomwidth()[source]
class spike.Interactive.FTICR_INTER.MSPeaker(npkd, pkname)[source]

Bases: object

a peak-picker for MS experiments

display(event={'name': 'value'})[source]

display spectrum and peaks

done(event)[source]

exit GUI

pickpeak(event)[source]

interactive wrapper to peakpick

pkexport(event)[source]

exports the peaklist to file

pklist()[source]

creates peaklist

pkprint(event)[source]
pp()[source]

do the peak-picking calling pp().centroid()

resetzoom(b)[source]
class spike.Interactive.FTICR_INTER.Show1D(**kwargs)[source]

Bases: spike.Interactive.INTER.Show1D

on_reset(b=None)[source]
class spike.Interactive.FTICR_INTER.SpforSuper(i, name)[source]

Bases: object

a holder for SuperImpose

display()[source]
class spike.Interactive.FTICR_INTER.SuperImpose(base=None, filetype='*.msh5', N=None)[source]

Bases: object

a tool to superimpose spectra

Show()[source]
copy(event)[source]
display(event)[source]

spike.Interactive.FTICR_INTER_v2 module

A tool to display FT-ICR data-sets

to be embedded in jupyter notebook

MAD Sept 2019

This version requires ipympl (see: https://github.com/matplotlib/jupyter-matplotlib ) and the notebook to be opened with %matplotlib widget

class spike.Interactive.FTICR_INTER_v2.Calib(data)[source]

Bases: object

a simple tool to show and modify calibration cste

back(event)[source]
update(event)[source]
class spike.Interactive.FTICR_INTER_v2.MR(name, report=True, Debug=False)[source]

Bases: object

this class handles multiresolution datasets

col(i)[source]

return a column with coordinate in index

colmz(i)[source]

return a column with coordinate in m/z

compute_absmax()[source]

computes largest point from smaller resolution, and propagates

load()[source]

load from file

report()[source]

report object content

row(i)[source]

return a row with coordinate in index

rowmz(i)[source]

return a row with coordinate in m/z

to_display(zoom=0, 10000000.0, 0, 10000000.0, verbose=False)[source]

computes and return which dataset to display at a given zoom and scale level” in: zoom = ((F1low, F1up), (F2low,F2up)) - in m/z

out: a tuple (data, zoomwindow), where data is a NPKData and zoomwindow an eventually recalibrated zoom window

so, if DATA is an MR() object and Zoom a defined window in m/z ((F1low, F1up), (F2low,F2up)) the sequence:

datasel, zz = DATA.to_display(Zoom) datasel.display(zoom=zz, scale=…)

will display the selected zone with the best possible resolution

class spike.Interactive.FTICR_INTER_v2.MR_interact(name, figsize=None, report=True, show=True, Debug=False)[source]

Bases: spike.Interactive.FTICR_INTER_v2.MR

I1D()[source]

show the 1D selector

bb(name, desc, action, layout=None, tooltip='')[source]

build a button into self

check_fig()[source]

create figure if missing

check_fig1D()[source]
display(zoom=None, scale=None)[source]

computes pictures (display in the SPIKE sense - not ipywidget one)

display1D()[source]

display the selected 1D

ext_box()[source]

defines the interactive tools for 1D

fullzoom()[source]
ob(event)[source]

observe events and display

reset(b)[source]
reset_track()[source]
scale_up(step)[source]
set_on_redraw()[source]
show()[source]

actually show the graphical tool and the interactive spectrum

spec_box()[source]

defines the spectral box widget

update(e)[source]

update internal zoom coordinates

zoom_box()[source]

defines the zoom box widget

class spike.Interactive.FTICR_INTER_v2.MS2Dscene(**kwargs)[source]

Bases: ipywidgets.widgets.widget_box.HBox

a widget to set all MS tools into one screen

load2D(e)[source]

create 2D object and display

class spike.Interactive.FTICR_INTER_v2.MSPeaker(npkd, pkname)[source]

Bases: object

a peak-picker for MS experiments

display(event={'name': 'value'})[source]

display spectrum and peaks

done(event)[source]

exit GUI

pickpeak(event)[source]

interactive wrapper to peakpick

pkexport(event)[source]

exports the peaklist to file

pklist()[source]

creates peaklist

pkprint(event)[source]
pp()[source]

do the peak-picking calling pp().centroid()

class spike.Interactive.FTICR_INTER_v2.SpforSuper(i, name)[source]

Bases: object

a holder for SuperImpose

display()[source]
class spike.Interactive.FTICR_INTER_v2.SuperImpose(base=None, filetype='*.msh5', N=None)[source]

Bases: object

a tool to superimpose spectra

Show()[source]
copy(event)[source]
display(event)[source]

spike.Interactive.INTER copy module

spike.Interactive.INTER module

A set of utilities to use spike in NMR or FTMS within jupyter

First version MAD june 2017 Intermediate version MAD october 2019 Improvements MAD spring - summer - automn 2021 - winter 2022

class spike.Interactive.INTER.AvProc1D(filename='')[source]

Bases: object

Detailed 1D NMR Processing

apmin_select(e)[source]
apod()[source]
apod_select(e)[source]
display()[source]
load()[source]
process(e)[source]
show()[source]
show_apod(e)[source]

display the Logo

spike.Interactive.INTER.Logofile()[source]

return the address on disk of the Logo file

class spike.Interactive.INTER.NMRIntegrate(**kwargs)[source]

Bases: spike.Interactive.INTER.Show1D

an integrator for NMR experiments

disp()[source]
draw()[source]

refresh display from event - if zoom is True, display only in xbound

int()[source]

do the automatic integration from peaks and parameters

integrate(event)[source]
ob(event)[source]

observe events and redraw

on_add(b)[source]
on_cancel(b)[source]
on_done(b)[source]
on_rem(b)[source]
peak_and_integrate(event)[source]
print(event)[source]
set_value(b)[source]
class spike.Interactive.INTER.NMRPeaker1D(**kwargs)[source]

Bases: spike.Interactive.INTER.Show1D

a peak-picker for NMR experiments

disp()[source]
draw()[source]

interactive wrapper to peakpick

ob(event)[source]

observe events and redraw

on_add(b)[source]
on_cancel(b)[source]
on_done(b)[source]
on_rem(b)[source]
on_reset(b=None)[source]
on_setcalib(e)[source]
pickpeak(event)[source]

interactive wrapper to pp

pklist()[source]

creates peaklist for printing or exporting

pkprint(event)[source]
pp(**kwargs)[source]
class spike.Interactive.INTER.Phaser1D(**kwargs)[source]

Bases: spike.Interactive.INTER.Show1D

An interactive phaser in 1D NMR

Phaser1D(spectrum, …)

ctopivot(p0, p1)[source]

convert from centered to pivot values

disconnect_press()[source]

should be called before close()

disp()[source]

update display and display pivot

draw()[source]

copied from super() as it does not display the spectrum !

ob(event)[source]

observe changes and start phasing

on_Apply(b)[source]
on_cancel(b)[source]
on_movepivot(event)[source]
phase()[source]
phase_n_disp()[source]

apply phase and disp

ppivot()[source]

converts from pivot values to centered ones

rescale_p1(**kwargs)[source]
class spike.Interactive.INTER.Show1D(**kwargs)[source]

Bases: ipywidgets.widgets.widget_box.HBox

An interactive display, 1D NMR

Show1D(spectrum)

disp()[source]
draw()[source]

builds and display the picture

ob(event)[source]

observe events and redraw

obdisp(event)[source]

observe events and display

on_done(b)[source]
on_reset(b=None)[source]
scale_up(**kwargs)[source]
set_on_redraw()[source]

set-up mouse scroll control and click

class spike.Interactive.INTER.Show1Dplus(**kwargs)[source]

Bases: spike.Interactive.INTER.Show1D

copy(event)[source]
draw(zoom=False)[source]

refresh display - if zoom is True, display only in xbound

on_done(e)[source]
class spike.Interactive.INTER.SpforSuper(i, filename='None', axref=False, ref=None)[source]

Bases: object

a holder for one spectrum to SuperImpose

B(text, size='auto')[source]

bold HTML widget

I(text, size='auto')[source]

Italic HTML widget

activate(e)[source]

called when state changes

disp()[source]

refresh

draw(unit='ppm')[source]
injectobserve(method)[source]

used to to observe form outer object for draw

move_xdata()[source]

adapt self.xdata to offset and stretching, then return the value

move_ydata()[source]

adapt self.ydata to direct, scale, and offset and return the value

property mult
nactivate(e)[source]

called to check name validity, when name is entered

property nmrname
ob(event)[source]

observe events and display

simpledisplay()[source]

a simplified widget

class spike.Interactive.INTER.Timer(timeout, callback)[source]

Bases: object

cancel()[source]
start()[source]
spike.Interactive.INTER.UserLogofile()[source]

return the address on disk of the User Logo file - located in $HOME/Spike/Logo.png

class spike.Interactive.INTER.baseline1D(**kwargs)[source]

Bases: spike.Interactive.INTER.Show1D

An interactive baseline for 1D NMR

baseline1D(spectrum, …)

clear()[source]

remove artists created by draw()

corrected()[source]
correction()[source]

returns the correction to apply as a numpy array

disconnect_press()[source]

should be called before close()

disp()[source]

used to refresh view

draw()[source]

used to create the view with additional artists

itoc3(value)[source]
on_auto(e)[source]

automatically set baseline points

on_cancel(e)[source]
on_done(e)[source]
on_set(e)[source]

add baseline points at selector

on_unset(e)[source]

remove baseline points closest from selector

spike.Interactive.INTER.debounce(wait)[source]

Decorator that will postpone a function’s execution until after wait seconds have elapsed since the last time it was invoked.

spike.Interactive.INTER.hidecode(initial='show', message='<i>useful to show/print a clean screen when processing is finished</i>')[source]

this func adds a button to hide/show the code on a jupyter page initial is either ‘show’ or ‘hide’ inspired from: https://stackoverflow.com/questions/27934885/how-to-hide-code-from-cells-in-ipython-notebook-visualized-with-nbviewer/28073228#28073228

spike.Interactive.INTER.hidedoc(initial='show', message='<i>useful to show/print a clean screen when processing is finished</i>')[source]

this func adds a button to hide/show the doc on a jupyter page initial is either ‘show’ or ‘hide’ inspired from: https://stackoverflow.com/questions/27934885/how-to-hide-code-from-cells-in-ipython-notebook-visualized-with-nbviewer/28073228#28073228

spike.Interactive.INTER.initCSS()[source]

adapt some CSS

spike.Interactive.INTER.initialize(verb=1)[source]

initialize notebook interface for Spike

spike.Interactive.INTER.jsalert(msg='Alert text')[source]

send a javascript alert

spike.Interactive.INTER.param_line(acqus, paramlist=None, output='string')[source]

given a acqus dictionary, and a list of parameters to extract, this functions return either a plain text or a HTML table depending on output value either “string” or “HTML” )

spike.Interactive.INTER.param_table(data, output='string')[source]

return the complete parameter table held into data output is either “string” or “HTML

spike.Interactive.INTER.popup_param_table(data)[source]
spike.Interactive.INTER.readplist(paramtoadd, paramdict)[source]

parse lists from acqus files - only that ones defined in arraynames

spike.Interactive.INTER.space(width='80px')[source]

defines a layout of width, width should be a string in CSS syntax

spike.Interactive.INTER.spacer(width='80px')[source]

defines a spacer to be used in widgets.Box - width should be a string in CSS syntax

spike.Interactive.INTER.summary(data, param=True, output='string')[source]

produces a summary of the data set if param is True, a short list of 1D parameters is given, using the globally defined Paramlist output is either “string” or “HTML”

spike.Interactive.INTER_2D module

A set of utilities to use spike in NMR or FTMS within jupyter

First version MAD june 2017 definitive ? version MAD october 2019

class spike.Interactive.INTER_2D.Phaser2D(**kwargs)[source]

Bases: spike.Interactive.INTER_2D.Show2D

An interactive phaser in 2D NMR

Phaser2D(spec)

ctopivot(F1p0, F1p1, F2p0, F2p1)[source]

convert from centered to pivot values

draw(todisplay=None, new=True)[source]

display either the current data or the one provided - red and blue

ob(event)[source]

observe changes and start phasing

on_Apply(b)[source]
on_cancel(b)[source]
on_movepivot(event)[source]
phase()[source]

compute phase and display

phdisp(todisplay=None)[source]

display either the current data or the one provided - red and blue

ppivot()[source]

converts from pivot values to centered ones

class spike.Interactive.INTER_2D.Show2D(**kwargs)[source]

Bases: spike.Interactive.INTER.Show1D

A display for 2D NMR with a scale cursor Show2D(spectrum) where spectrum is a NPKData object - special display for DOSY.

disp(**kwargs)
draw(**kwargs)

builds and display the picture

on_reset(e=None)[source]
class spike.Interactive.INTER_2D.baseline2D_F2(**kwargs)[source]

Bases: spike.Interactive.INTER.baseline1D

on_done(e)[source]
spike.Interactive.INTER_2D.sidedisplay(dt1d, ax)[source]

spike.Interactive.INTER_MS (copy) module

spike.Interactive.INTER_MS module

spike.Interactive.INTER_MS_turn module

A set of utilities to use spike in NMR or FTMS within jupyter

First version MAD june 2017 definitive ? version MAD october 2019

class spike.Interactive.INTER_MS_turn.FloatButt(**kwargs)[source]

Bases: ipywidgets.widgets.widget_box.HBox

a float text with buttons rounds is a list on power of 10 to set

decrem(e)[source]
increm(e)[source]
property value
class spike.Interactive.INTER_MS_turn.Phaser1D(**kwargs)[source]

Bases: spike.Interactive.INTER.Show1D

An interactive phaser in 1D MS

Phaser1D(spectrum)

requires %matplotlib widget

ctopivot(p0, p1, p2, pv)[source]

convert from centered to pivot values - not used in PHASEQUAD

ob(event)[source]

observe changes and start phasing

on_Apply(b)[source]
on_addlist(b)[source]
on_cancel(b)[source]
on_clearlist(b)[source]
on_movepivot(event)[source]
on_printlist(b)[source]
phase()[source]

apply phase and display

ppivot()[source]

converts current pivot values to centered ones - not used in PHASEQUAD

show()[source]

spike.Interactive.ipyfilechooser module

class spike.Interactive.ipyfilechooser.FileChooser(**kwargs)[source]

Bases: ipywidgets.widgets.widget_box.VBox

# FileChooser code is from # https://github.com/crahan/ipyfilechooser

property default

Get the default value

property default_filename

Get the default_filename value

property default_path

Get the default_path value

property nmrname
refresh()[source]

Re-render the form

reset(path=None, filename=None)[source]

Reset the form to the default path and filename

property rows

Get current number of rows

property selected

Get selected value

property selected_filename

Get the selected_filename

property selected_path

Get selected_path value

property show_hidden

Get current number of rows

spike.Interactive.ipyfilechooser.get_dir_contents(path, hidden=False)[source]

Get directory contents

spike.Interactive.ipyfilechooser.get_subpaths(path)[source]

Walk a path and return a list of subpaths

spike.Interactive.ipyfilechooser.has_parent(path)[source]

Check if a path has a parent folder

spike.Interactive.ipyfilechooser.update_path(path, item)[source]

Update path with new item

Module contents