Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .cache/wandb/logs/core-debug-20240926_180813.log +17 -0
- .local/share/jupyter/nbextensions/addbefore/main.js +42 -0
- .local/share/jupyter/nbextensions/autosavetime/icon.png +0 -0
- .local/share/jupyter/nbextensions/autosavetime/main.js +81 -0
- .local/share/jupyter/nbextensions/autoscroll/README.md +22 -0
- .local/share/jupyter/nbextensions/autoscroll/autoscroll.yaml +26 -0
- .local/share/jupyter/nbextensions/cell_filter/README.md +4 -0
- .local/share/jupyter/nbextensions/code_font_size/README.md +4 -0
- .local/share/jupyter/nbextensions/code_prettify/README_autopep8.md +136 -0
- .local/share/jupyter/nbextensions/codefolding/codefolding_editor.png +0 -0
- .local/share/jupyter/nbextensions/highlighter/export_highlights.html +0 -0
- .local/share/jupyter/nbextensions/highlighter/export_highlights.tex +457 -0
- .local/share/jupyter/nbextensions/highlighter/highlighter.js +378 -0
- .local/share/jupyter/nbextensions/highlighter/icon.png +0 -0
- .local/share/jupyter/nbextensions/highlighter/image.gif +0 -0
- .local/share/jupyter/nbextensions/highlighter/readme.md +47 -0
- .local/share/jupyter/nbextensions/highlighter/tst_highlights.pdf +0 -0
- .local/share/jupyter/nbextensions/hinterland/hinterland.js +194 -0
- .local/share/jupyter/nbextensions/move_selected_cells/README.md +12 -0
- .local/share/jupyter/nbextensions/move_selected_cells/move_selected_cells.yaml +6 -0
- .local/share/jupyter/nbextensions/python-markdown/main.js +212 -0
- .local/share/jupyter/nbextensions/python-markdown/python-markdown-pre.png +0 -0
- .local/share/jupyter/nbextensions/python-markdown/untrusted.png +0 -0
- .local/share/jupyter/nbextensions/rubberband/rubberband.yaml +7 -0
- .local/share/jupyter/nbextensions/ruler/edit.js +4 -0
- .local/share/jupyter/nbextensions/ruler/main.js +124 -0
- .local/share/jupyter/nbextensions/runtools/demo.gif +0 -0
- .local/share/jupyter/nbextensions/runtools/gutter.css +3 -0
- .local/share/jupyter/nbextensions/runtools/main.js +745 -0
- .local/share/jupyter/nbextensions/runtools/runtools.yaml +59 -0
- .local/share/jupyter/nbextensions/runtools/runtools_execute.png +0 -0
- .local/share/jupyter/nbextensions/runtools/runtools_lock.png +0 -0
- .local/share/jupyter/nbextensions/runtools/runtools_nb.png +0 -0
- .local/share/jupyter/nbextensions/runtools/runtools_show_hide.png +0 -0
- .local/share/jupyter/nbextensions/scratchpad/LICENSE +27 -0
- .local/share/jupyter/nbextensions/scratchpad/README.md +14 -0
- .local/share/jupyter/nbextensions/scratchpad/main.js +149 -0
- .local/share/jupyter/nbextensions/scroll_down/config.yaml +12 -0
- .local/share/jupyter/nbextensions/select_keymap/select_keymap.yaml +15 -0
- .local/share/jupyter/nbextensions/skill/main.js +14 -0
- .local/share/jupyter/nbextensions/skill/skill.js +0 -0
- .local/share/jupyter/nbextensions/snippets/snippets.yaml +6 -0
- .local/share/jupyter/nbextensions/snippets_menu/snippets_submenus_python/astropy.js +164 -0
- .local/share/jupyter/nbextensions/snippets_menu/snippets_submenus_python/matplotlib.js +186 -0
- .local/share/jupyter/nbextensions/snippets_menu/snippets_submenus_python/pandas.js +182 -0
- .local/share/jupyter/nbextensions/snippets_menu/snippets_submenus_python/python.js +209 -0
- .local/share/jupyter/nbextensions/snippets_menu/snippets_submenus_python/python_regex.js +309 -0
- .local/share/jupyter/nbextensions/snippets_menu/snippets_submenus_python/scipy.js +620 -0
- .local/share/jupyter/nbextensions/snippets_menu/snippets_submenus_python/scipy_constants.js +0 -0
- .local/share/jupyter/nbextensions/snippets_menu/snippets_submenus_python/scipy_special.js +2198 -0
.cache/wandb/logs/core-debug-20240926_180813.log
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{"time":"2024-09-26T18:08:13.661085645Z","level":"INFO","msg":"started logging, with flags","port-filename":"/tmp/tmp586bghqd/port-6168.txt","pid":6168,"debug":false,"disable-analytics":false}
|
2 |
+
{"time":"2024-09-26T18:08:13.66112903Z","level":"INFO","msg":"FeatureState","shutdownOnParentExitEnabled":false}
|
3 |
+
{"time":"2024-09-26T18:08:13.661979363Z","level":"INFO","msg":"Will exit if parent process dies.","ppid":6168}
|
4 |
+
{"time":"2024-09-26T18:08:13.661969217Z","level":"INFO","msg":"server is running","addr":{"IP":"127.0.0.1","Port":43071,"Zone":""}}
|
5 |
+
{"time":"2024-09-26T18:08:13.857998352Z","level":"INFO","msg":"created new connection","id":"127.0.0.1:50862"}
|
6 |
+
{"time":"2024-09-26T18:08:14.29644191Z","level":"INFO","msg":"connection init received","streamId":"1klxtkie","id":"127.0.0.1:50862"}
|
7 |
+
{"time":"2024-09-26T18:08:14.296870522Z","level":"ERROR","msg":"error creating symlink","error":"symlink /root/.cache/wandb/logs/core-debug-20240926_180813.log /root/wandb/run-20240926_180814-1klxtkie/logs/debug-core.log: file exists"}
|
8 |
+
{"time":"2024-09-26T18:08:14.300104442Z","level":"INFO","msg":"connection init completed","streamId":"1klxtkie","id":"127.0.0.1:50862"}
|
9 |
+
{"time":"2024-09-27T00:54:24.403773763Z","level":"INFO","msg":"handle finish received","streamId":"1klxtkie","id":"127.0.0.1:50862"}
|
10 |
+
{"time":"2024-09-27T00:54:24.933689321Z","level":"INFO","msg":"connection init received","streamId":"60260ulk","id":"127.0.0.1:50862"}
|
11 |
+
{"time":"2024-09-27T00:54:24.934341547Z","level":"ERROR","msg":"error creating symlink","error":"symlink /root/.cache/wandb/logs/core-debug-20240926_180813.log /root/wandb/run-20240927_005424-60260ulk/logs/debug-core.log: file exists"}
|
12 |
+
{"time":"2024-09-27T00:54:24.937048792Z","level":"INFO","msg":"connection init completed","streamId":"60260ulk","id":"127.0.0.1:50862"}
|
13 |
+
{"time":"2024-09-27T07:40:10.740842849Z","level":"INFO","msg":"handle finish received","streamId":"60260ulk","id":"127.0.0.1:50862"}
|
14 |
+
{"time":"2024-09-27T07:40:11.365393025Z","level":"INFO","msg":"connection init received","streamId":"gzu8f7wl","id":"127.0.0.1:50862"}
|
15 |
+
{"time":"2024-09-27T07:40:11.365761867Z","level":"ERROR","msg":"error creating symlink","error":"symlink /root/.cache/wandb/logs/core-debug-20240926_180813.log /root/wandb/run-20240927_074011-gzu8f7wl/logs/debug-core.log: file exists"}
|
16 |
+
{"time":"2024-09-27T07:40:11.368624142Z","level":"INFO","msg":"connection init completed","streamId":"gzu8f7wl","id":"127.0.0.1:50862"}
|
17 |
+
{"time":"2024-09-27T14:25:58.663233862Z","level":"INFO","msg":"Parent process exited, terminating service process."}
|
.local/share/jupyter/nbextensions/addbefore/main.js
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
define([
|
2 |
+
'base/js/namespace',
|
3 |
+
'jquery',
|
4 |
+
'require',
|
5 |
+
'base/js/events',
|
6 |
+
'base/js/utils',
|
7 |
+
], function(Jupyter, $, requirejs, events, configmod, utils) {
|
8 |
+
"use strict";
|
9 |
+
|
10 |
+
var load_extension = function() {
|
11 |
+
Jupyter.toolbar.add_buttons_group([
|
12 |
+
Jupyter.keyboard_manager.actions.register ({
|
13 |
+
'help' : 'Insert Cell Above',
|
14 |
+
'icon' : 'fa-arrow-circle-o-up',
|
15 |
+
'handler': function () {
|
16 |
+
Jupyter.notebook.insert_cell_above('code');
|
17 |
+
Jupyter.notebook.select_prev();
|
18 |
+
Jupyter.notebook.focus_cell();
|
19 |
+
}
|
20 |
+
}, 'insert-cell-above', 'addbefore'),
|
21 |
+
Jupyter.keyboard_manager.actions.register ({
|
22 |
+
'help' : 'Insert Cell Below',
|
23 |
+
'icon' : 'fa-arrow-circle-o-down',
|
24 |
+
'handler': function () {
|
25 |
+
Jupyter.notebook.insert_cell_below('code');
|
26 |
+
Jupyter.notebook.select_next();
|
27 |
+
Jupyter.notebook.focus_cell();
|
28 |
+
}
|
29 |
+
}, 'insert-cell-below', 'addbefore'),
|
30 |
+
]);
|
31 |
+
$('#insert_above_below').remove()
|
32 |
+
|
33 |
+
};
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
var extension = {
|
38 |
+
load_jupyter_extension : load_extension,
|
39 |
+
load_ipython_extension : load_extension
|
40 |
+
};
|
41 |
+
return extension;
|
42 |
+
});
|
.local/share/jupyter/nbextensions/autosavetime/icon.png
ADDED
.local/share/jupyter/nbextensions/autosavetime/main.js
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
define([
|
2 |
+
'jquery',
|
3 |
+
'base/js/namespace',
|
4 |
+
'base/js/events'
|
5 |
+
], function(
|
6 |
+
$,
|
7 |
+
IPython,
|
8 |
+
events
|
9 |
+
) {
|
10 |
+
"use strict";
|
11 |
+
|
12 |
+
// define default values for config parameters
|
13 |
+
var params = {
|
14 |
+
autosavetime_set_starting_interval : false,
|
15 |
+
autosavetime_starting_interval : 2,
|
16 |
+
autosavetime_show_selector : true
|
17 |
+
};
|
18 |
+
|
19 |
+
// update params with any specified in the server's config file
|
20 |
+
var update_params = function() {
|
21 |
+
var config = IPython.notebook.config;
|
22 |
+
for (var key in params) {
|
23 |
+
if (config.data.hasOwnProperty(key))
|
24 |
+
params[key] = config.data[key];
|
25 |
+
}
|
26 |
+
};
|
27 |
+
|
28 |
+
var initialize = function () {
|
29 |
+
update_params();
|
30 |
+
|
31 |
+
var si = params.autosavetime_starting_interval;
|
32 |
+
var set_si = params.autosavetime_set_starting_interval;
|
33 |
+
|
34 |
+
if (params.autosavetime_show_selector) {
|
35 |
+
var select = $('<select class="ui-widget-content"/>');
|
36 |
+
select.change(function() {
|
37 |
+
var interval = parseInt($(this).val(), 10) * 60 * 1000;
|
38 |
+
IPython.notebook.set_autosave_interval(interval);
|
39 |
+
});
|
40 |
+
|
41 |
+
var thresholds = [0,2,5,10,15,20,30,60];
|
42 |
+
|
43 |
+
if (set_si && thresholds.indexOf(si) < 0) thresholds.push(si);
|
44 |
+
|
45 |
+
thresholds.sort(function(a, b) { return a-b; });
|
46 |
+
|
47 |
+
for (var i in thresholds) {
|
48 |
+
var thr = thresholds[i];
|
49 |
+
select.append($('<option/>').attr('value', thr).text(thr));
|
50 |
+
}
|
51 |
+
|
52 |
+
select.find('option[value="2"]').text('2 (default)');
|
53 |
+
select.find('option[value="0"]').text('off');
|
54 |
+
|
55 |
+
if (set_si) select.val(si);
|
56 |
+
|
57 |
+
IPython.toolbar.element.append(
|
58 |
+
$('<label class="navbar-text"/>').text('Autosave interval (min):')
|
59 |
+
).append(select);
|
60 |
+
}
|
61 |
+
|
62 |
+
events.on("autosave_enabled.Notebook", function(event, value) {
|
63 |
+
if (set_si) {
|
64 |
+
IPython.notebook.set_autosave_interval(si * 60 * 1000);
|
65 |
+
}
|
66 |
+
else {
|
67 |
+
if (params.autosavetime_show_selector) {
|
68 |
+
select.val(parseInt(value, 10) / 60 / 1000);
|
69 |
+
}
|
70 |
+
}
|
71 |
+
});
|
72 |
+
};
|
73 |
+
|
74 |
+
var load_ipython_extension = function() {
|
75 |
+
return IPython.notebook.config.loaded.then(initialize);
|
76 |
+
};
|
77 |
+
|
78 |
+
return {
|
79 |
+
load_ipython_extension : load_ipython_extension
|
80 |
+
};
|
81 |
+
});
|
.local/share/jupyter/nbextensions/autoscroll/README.md
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
autoscroll
|
2 |
+
==========
|
3 |
+
|
4 |
+
|
5 |
+
Description
|
6 |
+
-----------
|
7 |
+
|
8 |
+
Optionally set the output autoscroll threshold, and/or add a selector to the
|
9 |
+
toolbar to set it, and/or add a toolbar button to enable/disable it.
|
10 |
+
|
11 |
+
|
12 |
+
Parameters
|
13 |
+
----------
|
14 |
+
|
15 |
+
* `autoscroll_set_on_load` -
|
16 |
+
Set an autoscroll threshold on notebook load. If false, the default is unchanged.
|
17 |
+
* `autoscroll_starting_threshold` -
|
18 |
+
Autoscroll threshold which would be set on notebook load. `-1` disables autoscrolling.
|
19 |
+
* `autoscroll_show_selector` -
|
20 |
+
Add a selector to the toolbar to change the autoscroll threshold
|
21 |
+
* `autoscroll_show_button` -
|
22 |
+
Add a button to the toolbar to disable/enable autoscrolling
|
.local/share/jupyter/nbextensions/autoscroll/autoscroll.yaml
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Type: IPython Notebook Extension
|
2 |
+
Compatibility: 3.x, 4.x
|
3 |
+
Name: Autoscroll
|
4 |
+
Main: main.js
|
5 |
+
Icon: icon.png
|
6 |
+
Link: README.md
|
7 |
+
Description: Optionally set the output autoscroll threshold, and/or add a selector to the toolbar to set it, and/or add a toolbar button to enable/disable it
|
8 |
+
Parameters:
|
9 |
+
- name: autoscroll_set_on_load
|
10 |
+
description: Set an autoscroll threshold on notebook load. If false, the default is unchanged.
|
11 |
+
input_type: checkbox
|
12 |
+
default: false
|
13 |
+
- name: autoscroll_starting_threshold
|
14 |
+
description: Autoscroll threshold which would be set on notebook load. -1 disables autoscrolling.
|
15 |
+
input_type: number
|
16 |
+
min: -1
|
17 |
+
step: 1
|
18 |
+
default: 100
|
19 |
+
- name: autoscroll_show_selector
|
20 |
+
description: add a selector to the toolbar to change the autoscroll threshold
|
21 |
+
input_type: checkbox
|
22 |
+
default: true
|
23 |
+
- name: autoscroll_show_button
|
24 |
+
description: add a button to the toolbar to disable/enable autoscrolling
|
25 |
+
input_type: checkbox
|
26 |
+
default: false
|
.local/share/jupyter/nbextensions/cell_filter/README.md
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Cell filter
|
2 |
+
===========
|
3 |
+
|
4 |
+
An extension that allows you to filter cells by tags. Keywords entered into the search bar separated by spaces joins them with logical AND.
|
.local/share/jupyter/nbextensions/code_font_size/README.md
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Code Font Size
|
2 |
+
==============
|
3 |
+
|
4 |
+
Adds toolbar buttons to increase and decrease code's font size. This is useful, for example, when projecting the notebook.
|
.local/share/jupyter/nbextensions/code_prettify/README_autopep8.md
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jupyter-autopep8
|
2 |
+
================
|
3 |
+
|
4 |
+
This nbextension reformats/prettifies code in notebook python code cells.
|
5 |
+
|
6 |
+
Under the hood, it uses a call to the current notebook kernel to reformat the
|
7 |
+
code.
|
8 |
+
The conversion run by the kernel uses the python [autopep8] package, and thus is compatible only with python kernels.
|
9 |
+
|
10 |
+
The nbextension provides
|
11 |
+
|
12 |
+
- a toolbar button (configurable to be added or not)
|
13 |
+
|
14 |
+
- a keyboard shortcut for reformatting the current code-cell (default shortcut
|
15 |
+
is `Alt-A`, can also be configured not to add the keyboard shortcut).
|
16 |
+
|
17 |
+
- a keyboard shortcut for reformatting the whole notebook (default shortcut
|
18 |
+
is `Alt-Shift-A`, can also be configured not to add the keyboard shortcut).
|
19 |
+
|
20 |
+
Syntax needs to be correct, but the nbextension may be able to point out basic
|
21 |
+
syntax errors.
|
22 |
+
|
23 |
+
|
24 |
+
Prerequisites
|
25 |
+
-------------
|
26 |
+
|
27 |
+
Of course, you must have the necessary kernel-specific package installed for
|
28 |
+
the prettifier call to work:
|
29 |
+
|
30 |
+
pip install autopep8
|
31 |
+
|
32 |
+
|
33 |
+
Options
|
34 |
+
-------
|
35 |
+
|
36 |
+
All options are provided by the [KerneExecOnCells library] - see the
|
37 |
+
[internals] section below for details.
|
38 |
+
There are a few nbextension-wide options, configurable using the
|
39 |
+
[jupyter_nbextensions_configurator] or by editing the `notebook` section config
|
40 |
+
file directly.
|
41 |
+
The options are as follows:
|
42 |
+
|
43 |
+
- `autopep8.add_toolbar_button`:
|
44 |
+
Whether to add a toolbar button to transform the selected cell(s).
|
45 |
+
Defaults to `true`.
|
46 |
+
|
47 |
+
- `autopep8.button_icon`:
|
48 |
+
A font-awesome class defining the icon used for the toolbar button and actions.
|
49 |
+
See [fontawesome] for available icon classes.
|
50 |
+
Defaults to `fa-cog`.
|
51 |
+
|
52 |
+
- `autopep8.button_label`:
|
53 |
+
Toolbar button label text. Also used in the actions' help text.
|
54 |
+
Defaults to `Prettify (using autopep8)`.
|
55 |
+
|
56 |
+
- `autopep8.register_hotkey`:
|
57 |
+
Whether to register hotkeys to transform the selected cell(s)/whole notebook.
|
58 |
+
Defaults to `true`.
|
59 |
+
|
60 |
+
- `autopep8.hotkeys.process_all`:
|
61 |
+
Hotkey to use to transform all the code cells in the notebook.
|
62 |
+
Defaults to `Alt-Shift-A`.
|
63 |
+
|
64 |
+
- `autopep8.hotkeys.process_selected`:
|
65 |
+
Hotkey to use to transform the selected cell(s).
|
66 |
+
Defaults to `Alt-A`.
|
67 |
+
|
68 |
+
- `autopep8.show_alerts_for_not_supported_kernel`:
|
69 |
+
Whether to show alerts if the kernel is not supported.
|
70 |
+
Defaults to `false`.
|
71 |
+
|
72 |
+
- `autopep8.show_alerts_for_errors`:
|
73 |
+
Whether to show alerts for errors in the kernel calls.
|
74 |
+
Defaults to `true`.
|
75 |
+
|
76 |
+
- `autopep8.kernel_config_map_json`:
|
77 |
+
The value of this key is a string which can be parsed into a json object
|
78 |
+
giving the config for each kernel language.
|
79 |
+
|
80 |
+
The following give the per-kernel options of the parsed json, using the
|
81 |
+
language key `python `:
|
82 |
+
|
83 |
+
* `autopep8.kernel_config_map_json.python.library`:
|
84 |
+
String to execute in the kernel in order to load any necessary kernel
|
85 |
+
libraries.
|
86 |
+
|
87 |
+
* `autopep8.kernel_config_map_json.python.replacements_json_to_kernel`:
|
88 |
+
a list of pairs of strings, used as arguments to javascript's
|
89 |
+
`String.replace(from, to)` to translate from a json string into a valid
|
90 |
+
representation of the same string in the kernel language. Since json
|
91 |
+
strings are particularly simple, this can often (as with the python
|
92 |
+
language) be left as the default, an empty list.
|
93 |
+
|
94 |
+
* `autopep8.kernel_config_map_json.python.prefix` and
|
95 |
+
`autopep8.kernel_config_map_json.python.postfix`:
|
96 |
+
Strings added as bookends to the kernel string (translated from the json
|
97 |
+
string using the replacements above) to make up the kernel prettifier call
|
98 |
+
kernel's prettifier libraries.
|
99 |
+
|
100 |
+
* `autopep8.kernel_config_map_json.python.trim_formatted_text`:
|
101 |
+
Whether to trim whitespace from the transformed cell text. Since jupyter
|
102 |
+
cells don't usually have leading or trailing whitespace, the default
|
103 |
+
behaviour is to trim the transformed text, in order to prevent the
|
104 |
+
transform adding extra newlines at the end (a common behaviour for source
|
105 |
+
files, where having a trailing newline is often considered good practice).
|
106 |
+
|
107 |
+
|
108 |
+
Internals
|
109 |
+
---------
|
110 |
+
|
111 |
+
Under the hood, this nbextension uses the [KerneExecOnCells library], a shared
|
112 |
+
library for creating Jupyter nbextensions which transform code cell text using
|
113 |
+
calls to the active kernel.
|
114 |
+
|
115 |
+
See the [shared README] for the internal model used by the nbextension.
|
116 |
+
|
117 |
+
|
118 |
+
History
|
119 |
+
-------
|
120 |
+
|
121 |
+
The project was forked by [@kenkoooo] from [@jfbercher]'s [code_prettify],
|
122 |
+
retaining most of the code.
|
123 |
+
|
124 |
+
It has since been altered to use the [KerneExecOnCells library], a shared
|
125 |
+
library for creating Jupyter nbextensions which transform code cell text using
|
126 |
+
calls to the active kernel.
|
127 |
+
|
128 |
+
[@jfbercher]: https://github.com/jfbercher
|
129 |
+
[@kenkoooo]: https://github.com/kenkoooo
|
130 |
+
[autopep8]: https://github.com/hhatto/autopep8
|
131 |
+
[code_prettify]: https://github.com/jfbercher/code_prettify
|
132 |
+
[fontawesome]: https://fontawesome.com/icons
|
133 |
+
[internals]: #Internals
|
134 |
+
[jupyter_nbextensions_configurator]: https://github.com/Jupyter-contrib/jupyter_nbextensions_configurator
|
135 |
+
[KerneExecOnCells library]: README.md
|
136 |
+
[shared README]: README.md
|
.local/share/jupyter/nbextensions/codefolding/codefolding_editor.png
ADDED
.local/share/jupyter/nbextensions/highlighter/export_highlights.html
ADDED
The diff for this file is too large to render.
See raw diff
|
|
.local/share/jupyter/nbextensions/highlighter/export_highlights.tex
ADDED
@@ -0,0 +1,457 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
% Default to the notebook output style
|
3 |
+
|
4 |
+
|
5 |
+
% Inherit from the specified cell style.
|
6 |
+
|
7 |
+
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
+
|
12 |
+
\documentclass{article}
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
\usepackage{graphicx} % Used to insert images
|
18 |
+
\usepackage{adjustbox} % Used to constrain images to a maximum size
|
19 |
+
\usepackage{color} % Allow colors to be defined
|
20 |
+
\usepackage{enumerate} % Needed for markdown enumerations to work
|
21 |
+
\usepackage{geometry} % Used to adjust the document margins
|
22 |
+
\usepackage{amsmath} % Equations
|
23 |
+
\usepackage{amssymb} % Equations
|
24 |
+
\usepackage{eurosym} % defines \euro
|
25 |
+
\usepackage[mathletters]{ucs} % Extended unicode (utf-8) support
|
26 |
+
\usepackage[utf8x]{inputenc} % Allow utf-8 characters in the tex document
|
27 |
+
\usepackage{fancyvrb} % verbatim replacement that allows latex
|
28 |
+
\usepackage{grffile} % extends the file name processing of package graphics
|
29 |
+
% to support a larger range
|
30 |
+
% The hyperref package gives us a pdf with properly built
|
31 |
+
% internal navigation ('pdf bookmarks' for the table of contents,
|
32 |
+
% internal cross-reference links, web links for URLs, etc.)
|
33 |
+
\usepackage{hyperref}
|
34 |
+
\usepackage{longtable} % longtable support required by pandoc >1.10
|
35 |
+
\usepackage{booktabs} % table support for pandoc > 1.12.2
|
36 |
+
|
37 |
+
\usepackage{color}
|
38 |
+
\usepackage{soul}
|
39 |
+
\usepackage[framemethod=tikz]{mdframed}
|
40 |
+
|
41 |
+
|
42 |
+
|
43 |
+
|
44 |
+
\definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
|
45 |
+
\definecolor{darkorange}{rgb}{.71,0.21,0.01}
|
46 |
+
\definecolor{darkgreen}{rgb}{.12,.54,.11}
|
47 |
+
\definecolor{myteal}{rgb}{.26, .44, .56}
|
48 |
+
\definecolor{gray}{gray}{0.45}
|
49 |
+
\definecolor{lightgray}{gray}{.95}
|
50 |
+
\definecolor{mediumgray}{gray}{.8}
|
51 |
+
\definecolor{inputbackground}{rgb}{.95, .95, .85}
|
52 |
+
\definecolor{outputbackground}{rgb}{.95, .95, .95}
|
53 |
+
\definecolor{traceback}{rgb}{1, .95, .95}
|
54 |
+
% ansi colors
|
55 |
+
\definecolor{red}{rgb}{.6,0,0}
|
56 |
+
\definecolor{green}{rgb}{0,.65,0}
|
57 |
+
\definecolor{brown}{rgb}{0.6,0.6,0}
|
58 |
+
\definecolor{blue}{rgb}{0,.145,.698}
|
59 |
+
\definecolor{purple}{rgb}{.698,.145,.698}
|
60 |
+
\definecolor{cyan}{rgb}{0,.698,.698}
|
61 |
+
\definecolor{lightgray}{gray}{0.5}
|
62 |
+
|
63 |
+
% bright ansi colors
|
64 |
+
\definecolor{darkgray}{gray}{0.25}
|
65 |
+
\definecolor{lightred}{rgb}{1.0,0.39,0.28}
|
66 |
+
\definecolor{lightgreen}{rgb}{0.48,0.99,0.0}
|
67 |
+
\definecolor{lightblue}{rgb}{0.53,0.81,0.92}
|
68 |
+
\definecolor{lightpurple}{rgb}{0.87,0.63,0.87}
|
69 |
+
\definecolor{lightcyan}{rgb}{0.5,1.0,0.83}
|
70 |
+
|
71 |
+
% commands and environments needed by pandoc snippets
|
72 |
+
% extracted from the output of `pandoc -s`
|
73 |
+
\providecommand{\tightlist}{%
|
74 |
+
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
|
75 |
+
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
|
76 |
+
% Add ',fontsize=\small' for more characters per line
|
77 |
+
\newenvironment{Shaded}{}{}
|
78 |
+
\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}}
|
79 |
+
\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{{#1}}}
|
80 |
+
\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
|
81 |
+
\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
|
82 |
+
\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
|
83 |
+
\newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
|
84 |
+
\newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
|
85 |
+
\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{{#1}}}}
|
86 |
+
\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}}
|
87 |
+
\newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
|
88 |
+
\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{{#1}}}
|
89 |
+
\newcommand{\RegionMarkerTok}[1]{{#1}}
|
90 |
+
\newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
|
91 |
+
\newcommand{\NormalTok}[1]{{#1}}
|
92 |
+
|
93 |
+
% Define a nice break command that doesn't care if a line doesn't already
|
94 |
+
% exist.
|
95 |
+
\def\br{\hspace*{\fill} \\* }
|
96 |
+
% Math Jax compatability definitions
|
97 |
+
\def\gt{>}
|
98 |
+
\def\lt{<}
|
99 |
+
% Document parameters
|
100 |
+
\title{export\_highlights}
|
101 |
+
|
102 |
+
|
103 |
+
\author{}
|
104 |
+
|
105 |
+
|
106 |
+
|
107 |
+
% Pygments definitions
|
108 |
+
|
109 |
+
\makeatletter
|
110 |
+
\def\PY@reset{\let\PY@it=\relax \let\PY@bf=\relax%
|
111 |
+
\let\PY@ul=\relax \let\PY@tc=\relax%
|
112 |
+
\let\PY@bc=\relax \let\PY@ff=\relax}
|
113 |
+
\def\PY@tok#1{\csname PY@tok@#1\endcsname}
|
114 |
+
\def\PY@toks#1+{\ifx\relax#1\empty\else%
|
115 |
+
\PY@tok{#1}\expandafter\PY@toks\fi}
|
116 |
+
\def\PY@do#1{\PY@bc{\PY@tc{\PY@ul{%
|
117 |
+
\PY@it{\PY@bf{\PY@ff{#1}}}}}}}
|
118 |
+
\def\PY#1#2{\PY@reset\PY@toks#1+\relax+\PY@do{#2}}
|
119 |
+
|
120 |
+
\expandafter\def\csname PY@tok@gp\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}
|
121 |
+
\expandafter\def\csname PY@tok@no\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.53,0.00,0.00}{##1}}}
|
122 |
+
\expandafter\def\csname PY@tok@il\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
|
123 |
+
\expandafter\def\csname PY@tok@sx\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
|
124 |
+
\expandafter\def\csname PY@tok@kt\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.69,0.00,0.25}{##1}}}
|
125 |
+
\expandafter\def\csname PY@tok@mo\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
|
126 |
+
\expandafter\def\csname PY@tok@sh\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
|
127 |
+
\expandafter\def\csname PY@tok@bp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
|
128 |
+
\expandafter\def\csname PY@tok@gd\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.63,0.00,0.00}{##1}}}
|
129 |
+
\expandafter\def\csname PY@tok@sb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
|
130 |
+
\expandafter\def\csname PY@tok@err\endcsname{\def\PY@bc##1{\setlength{\fboxsep}{0pt}\fcolorbox[rgb]{1.00,0.00,0.00}{1,1,1}{\strut ##1}}}
|
131 |
+
\expandafter\def\csname PY@tok@nd\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}}
|
132 |
+
\expandafter\def\csname PY@tok@gr\endcsname{\def\PY@tc##1{\textcolor[rgb]{1.00,0.00,0.00}{##1}}}
|
133 |
+
\expandafter\def\csname PY@tok@kd\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
|
134 |
+
\expandafter\def\csname PY@tok@s\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
|
135 |
+
\expandafter\def\csname PY@tok@cs\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
|
136 |
+
\expandafter\def\csname PY@tok@sd\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
|
137 |
+
\expandafter\def\csname PY@tok@ss\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
|
138 |
+
\expandafter\def\csname PY@tok@nn\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
|
139 |
+
\expandafter\def\csname PY@tok@w\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.73,0.73}{##1}}}
|
140 |
+
\expandafter\def\csname PY@tok@kn\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
|
141 |
+
\expandafter\def\csname PY@tok@sc\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
|
142 |
+
\expandafter\def\csname PY@tok@s1\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
|
143 |
+
\expandafter\def\csname PY@tok@ge\endcsname{\let\PY@it=\textit}
|
144 |
+
\expandafter\def\csname PY@tok@cp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.74,0.48,0.00}{##1}}}
|
145 |
+
\expandafter\def\csname PY@tok@gh\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}
|
146 |
+
\expandafter\def\csname PY@tok@gi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.63,0.00}{##1}}}
|
147 |
+
\expandafter\def\csname PY@tok@vc\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
|
148 |
+
\expandafter\def\csname PY@tok@si\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}}
|
149 |
+
\expandafter\def\csname PY@tok@ow\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}}
|
150 |
+
\expandafter\def\csname PY@tok@vg\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
|
151 |
+
\expandafter\def\csname PY@tok@sr\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}}
|
152 |
+
\expandafter\def\csname PY@tok@cm\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
|
153 |
+
\expandafter\def\csname PY@tok@c\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
|
154 |
+
\expandafter\def\csname PY@tok@mi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
|
155 |
+
\expandafter\def\csname PY@tok@kc\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
|
156 |
+
\expandafter\def\csname PY@tok@ne\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.82,0.25,0.23}{##1}}}
|
157 |
+
\expandafter\def\csname PY@tok@nf\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
|
158 |
+
\expandafter\def\csname PY@tok@go\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}}
|
159 |
+
\expandafter\def\csname PY@tok@m\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
|
160 |
+
\expandafter\def\csname PY@tok@mh\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
|
161 |
+
\expandafter\def\csname PY@tok@nc\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
|
162 |
+
\expandafter\def\csname PY@tok@mb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
|
163 |
+
\expandafter\def\csname PY@tok@se\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.13}{##1}}}
|
164 |
+
\expandafter\def\csname PY@tok@gt\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.27,0.87}{##1}}}
|
165 |
+
\expandafter\def\csname PY@tok@nv\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
|
166 |
+
\expandafter\def\csname PY@tok@c1\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
|
167 |
+
\expandafter\def\csname PY@tok@kp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
|
168 |
+
\expandafter\def\csname PY@tok@s2\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
|
169 |
+
\expandafter\def\csname PY@tok@nb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
|
170 |
+
\expandafter\def\csname PY@tok@ni\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.60,0.60,0.60}{##1}}}
|
171 |
+
\expandafter\def\csname PY@tok@k\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
|
172 |
+
\expandafter\def\csname PY@tok@na\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.49,0.56,0.16}{##1}}}
|
173 |
+
\expandafter\def\csname PY@tok@o\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
|
174 |
+
\expandafter\def\csname PY@tok@mf\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
|
175 |
+
\expandafter\def\csname PY@tok@nl\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.63,0.63,0.00}{##1}}}
|
176 |
+
\expandafter\def\csname PY@tok@nt\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
|
177 |
+
\expandafter\def\csname PY@tok@gs\endcsname{\let\PY@bf=\textbf}
|
178 |
+
\expandafter\def\csname PY@tok@vi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
|
179 |
+
\expandafter\def\csname PY@tok@gu\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.50,0.00,0.50}{##1}}}
|
180 |
+
\expandafter\def\csname PY@tok@kr\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
|
181 |
+
|
182 |
+
\def\PYZbs{\char`\\}
|
183 |
+
\def\PYZus{\char`\_}
|
184 |
+
\def\PYZob{\char`\{}
|
185 |
+
\def\PYZcb{\char`\}}
|
186 |
+
\def\PYZca{\char`\^}
|
187 |
+
\def\PYZam{\char`\&}
|
188 |
+
\def\PYZlt{\char`\<}
|
189 |
+
\def\PYZgt{\char`\>}
|
190 |
+
\def\PYZsh{\char`\#}
|
191 |
+
\def\PYZpc{\char`\%}
|
192 |
+
\def\PYZdl{\char`\$}
|
193 |
+
\def\PYZhy{\char`\-}
|
194 |
+
\def\PYZsq{\char`\'}
|
195 |
+
\def\PYZdq{\char`\"}
|
196 |
+
\def\PYZti{\char`\~}
|
197 |
+
% for compatibility with earlier versions
|
198 |
+
\def\PYZat{@}
|
199 |
+
\def\PYZlb{[}
|
200 |
+
\def\PYZrb{]}
|
201 |
+
\makeatother
|
202 |
+
|
203 |
+
|
204 |
+
|
205 |
+
|
206 |
+
|
207 |
+
|
208 |
+
% Prevent overflowing lines due to hard-to-break entities
|
209 |
+
\sloppy
|
210 |
+
% Setup hyperref package
|
211 |
+
\hypersetup{
|
212 |
+
breaklinks=true, % so long urls are correctly broken across lines
|
213 |
+
colorlinks=true,
|
214 |
+
urlcolor=blue,
|
215 |
+
linkcolor=darkorange,
|
216 |
+
citecolor=darkgreen,
|
217 |
+
}
|
218 |
+
% Slightly bigger margins than the latex defaults
|
219 |
+
|
220 |
+
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}
|
221 |
+
|
222 |
+
|
223 |
+
\newcommand{\highlighta}[1]{{\sethlcolor{yellow} \textcolor{red}{\hl{#1}}}}
|
224 |
+
\newcommand{\highlightb}[1]{{\sethlcolor{red} \textcolor{yellow}{\hl{#1}}}}
|
225 |
+
\newcommand{\highlightc}[1]{{\sethlcolor{green} \textcolor{yellow}{\hl{#1}}}}
|
226 |
+
\newenvironment{highlightA}{\begin{mdframed}[hidealllines=true,backgroundcolor=yellow!20]}{\end{mdframed}}
|
227 |
+
\newenvironment{highlightB}{\begin{mdframed}[hidealllines=true,backgroundcolor=red!20]}{\end{mdframed}}
|
228 |
+
\newenvironment{highlightC}{\begin{mdframed}[hidealllines=true,backgroundcolor=green!20]}{\end{mdframed}}
|
229 |
+
|
230 |
+
|
231 |
+
%\usepackage{foo}
|
232 |
+
|
233 |
+
\begin{document}
|
234 |
+
|
235 |
+
|
236 |
+
\maketitle
|
237 |
+
|
238 |
+
|
239 |
+
|
240 |
+
|
241 |
+
\section{Exporting the notebook}\label{exporting-the-notebook}
|
242 |
+
|
243 |
+
As suggested by @juhasch, it is interesting to keep the highlights when
|
244 |
+
exporting the notebook to another format. We give and explain below some
|
245 |
+
possibilities:
|
246 |
+
|
247 |
+
\subsection{Short version}\label{short-version}
|
248 |
+
|
249 |
+
\begin{itemize}
|
250 |
+
\item
|
251 |
+
Html export:
|
252 |
+
|
253 |
+
\begin{Shaded}
|
254 |
+
\begin{Highlighting}[]
|
255 |
+
\KeywordTok{jupyter} \NormalTok{nbconvert FILE --config JUPYTER_DATA_DIR/extensions/highlight_html_cfg.py }
|
256 |
+
\end{Highlighting}
|
257 |
+
\end{Shaded}
|
258 |
+
\item
|
259 |
+
LaTeX export:
|
260 |
+
|
261 |
+
\begin{Shaded}
|
262 |
+
\begin{Highlighting}[]
|
263 |
+
\KeywordTok{jupyter} \NormalTok{nbconvert FILE --config JUPYTER_DATA_DIR/extensions/highlight_latex_cfg.py }
|
264 |
+
\end{Highlighting}
|
265 |
+
\end{Shaded}
|
266 |
+
|
267 |
+
where JUPYTER\_DATA\_DIR can be found from the output of
|
268 |
+
|
269 |
+
\begin{Shaded}
|
270 |
+
\begin{Highlighting}[]
|
271 |
+
\KeywordTok{jupyter} \NormalTok{--paths}
|
272 |
+
\end{Highlighting}
|
273 |
+
\end{Shaded}
|
274 |
+
|
275 |
+
eg \texttt{\textasciitilde{}/.local/share/jupyter} in my case. Seems
|
276 |
+
to be
|
277 |
+
\texttt{c:\textbackslash{}users\textbackslash{}NAME\textbackslash{}AppData\textbackslash{}Roaming\textbackslash{}jupyter}
|
278 |
+
under Windows.
|
279 |
+
\end{itemize}
|
280 |
+
|
281 |
+
Examples can be found here: \href{tst_highlights.ipynb}{initial
|
282 |
+
notebook}, \href{tst_highlights.html}{html version},
|
283 |
+
\href{tst_highlights.pdf}{pdf version} (after an additional LaTeX
|
284 |
+
\(\rightarrow\) pdf compilation).
|
285 |
+
|
286 |
+
\subsection{Html export}\label{html-export}
|
287 |
+
|
288 |
+
This is quite easy. Actually, highlight formatting embedded in markdown
|
289 |
+
cells is preserved while converting with the standard
|
290 |
+
|
291 |
+
\begin{Shaded}
|
292 |
+
\begin{Highlighting}[]
|
293 |
+
\KeywordTok{jupyter} \NormalTok{nbconvert file.ipynb}
|
294 |
+
\end{Highlighting}
|
295 |
+
\end{Shaded}
|
296 |
+
|
297 |
+
However, the css file is missing and must be added. Here we have several
|
298 |
+
possibilities
|
299 |
+
|
300 |
+
\begin{itemize}
|
301 |
+
\item
|
302 |
+
Embed the css \emph{within} the notebook. For that, consider the last
|
303 |
+
cell of the present notebook. This code reads the css file
|
304 |
+
\texttt{highlighter.css} in the extension directory and displays the
|
305 |
+
corresponding style. So doing the
|
306 |
+
\texttt{\textless{}style\textgreater{}\ ...\textless{}/style\textgreater{}}
|
307 |
+
section will be present in the cell output and interpreted by the web
|
308 |
+
browser. Drawbacks of this solution is that user still have to execute
|
309 |
+
this cell and that the this is not language agnostic.
|
310 |
+
\item
|
311 |
+
Use a \textbf{template file} to link or include the css file during
|
312 |
+
conversion. Such a file is provided as
|
313 |
+
\texttt{templates/highlighter.tpl}. It was choosen here to
|
314 |
+
\emph{include} the css content in the produced html file rather than
|
315 |
+
linking it. This avoids the necessity to keep the css file with the
|
316 |
+
html files.
|
317 |
+
\item
|
318 |
+
This works directly if the css resides in the same directory as the
|
319 |
+
file the user is attempting to convert --thus requires the user to
|
320 |
+
copy \texttt{highlighter.css} in the current directory. Then the
|
321 |
+
conversion is simply
|
322 |
+
|
323 |
+
\begin{Shaded}
|
324 |
+
\begin{Highlighting}[]
|
325 |
+
\KeywordTok{jupyter} \NormalTok{nbconvert file.ipynb --template highlighter}
|
326 |
+
\end{Highlighting}
|
327 |
+
\end{Shaded}
|
328 |
+
\item
|
329 |
+
It still remains two problems with this approach. First, it can be
|
330 |
+
annoying to have to systematically copy the css file in the current
|
331 |
+
directory. Second, the data within the html tags is not converted (and
|
332 |
+
thus markdown remains unmodified). A solution is to use a pair of
|
333 |
+
preprocessor/postprocessor that modify the html tags and enable the
|
334 |
+
subsequent markdown to html converter to operate on the included data.
|
335 |
+
Also, a config file is provided which redefines the template path to
|
336 |
+
enable direct inclusion of the css file in the extension directory.
|
337 |
+
Unfortunately, \highlighta{it seems that the \emph{full path} to
|
338 |
+
the config file has to be provided}. This file resides in the
|
339 |
+
extensions subdirectory of the jupyter\_data\_dir. The path can be
|
340 |
+
found by looking at the output of
|
341 |
+
|
342 |
+
\begin{Shaded}
|
343 |
+
\begin{Highlighting}[]
|
344 |
+
\KeywordTok{jupyter} \NormalTok{--paths}
|
345 |
+
\end{Highlighting}
|
346 |
+
\end{Shaded}
|
347 |
+
|
348 |
+
Then the command to issue for converting the notebook to html is
|
349 |
+
|
350 |
+
\begin{Shaded}
|
351 |
+
\begin{Highlighting}[]
|
352 |
+
\KeywordTok{jupyter} \NormalTok{nbconvert FILE --config JUPYTER_DATA_DIR/extensions/highlight_html_cfg.py }
|
353 |
+
\end{Highlighting}
|
354 |
+
\end{Shaded}
|
355 |
+
\end{itemize}
|
356 |
+
|
357 |
+
For instance
|
358 |
+
|
359 |
+
\begin{Shaded}
|
360 |
+
\begin{Highlighting}[]
|
361 |
+
\KeywordTok{jupyter} \NormalTok{nbconvert tst_highlights.ipynb --config ~/.local/share/jupyter/extensions/highlight_html_cfg.py }
|
362 |
+
\end{Highlighting}
|
363 |
+
\end{Shaded}
|
364 |
+
|
365 |
+
\subsection{LaTeX export}\label{latex-export}
|
366 |
+
|
367 |
+
This is a bit more complicated since the direct conversion removes all
|
368 |
+
html formatting present in markdown cells. Thus use again a
|
369 |
+
\textbf{preprocessor} which runs before the markdown \(\rightarrow\)
|
370 |
+
LaTeX conversion. In turn, it appears that we also need to postprocess
|
371 |
+
the result.
|
372 |
+
|
373 |
+
Three LaTeX commands, namely \emph{highlighta, highlightb, highlightc},
|
374 |
+
and three environments \emph{highlightA, highlightB, highlightC} are
|
375 |
+
defined. Highlighting html markup is then transformed into the
|
376 |
+
corresponding LaTeX commands and the text for completely highlighted
|
377 |
+
cells is put in the adequate LaTeX environment.
|
378 |
+
|
379 |
+
Pre and PostProcessor classes are defined in the file
|
380 |
+
\texttt{pp\_highlighter.py} located in the \texttt{extensions}
|
381 |
+
directory. A LaTeX template, that includes the necessary packages and
|
382 |
+
the definitions of commands/environments is provides as
|
383 |
+
\texttt{highlighter.tplx} in the template directory. The template
|
384 |
+
inherits from \texttt{article.ltx}. For more complex scenarios,
|
385 |
+
typically if the latex template file has be customized, the user shall
|
386 |
+
modify its template or inherit from his base template rather than from
|
387 |
+
article.
|
388 |
+
|
389 |
+
Finally, a config file fixes the different options for the conversion.
|
390 |
+
Then the command to issue is simply
|
391 |
+
|
392 |
+
\begin{Shaded}
|
393 |
+
\begin{Highlighting}[]
|
394 |
+
\KeywordTok{jupyter} \NormalTok{nbconvert FILE --config JUPYTER_DATA_DIR/extensions/highlight_latex_cfg.py }
|
395 |
+
\end{Highlighting}
|
396 |
+
\end{Shaded}
|
397 |
+
|
398 |
+
e.g.
|
399 |
+
|
400 |
+
\begin{Shaded}
|
401 |
+
\begin{Highlighting}[]
|
402 |
+
\KeywordTok{jupyter} \NormalTok{nbconvert tst_highlights.ipynb --config ~/.local/share/jupyter/extensions/highlight_latex_cfg.py }
|
403 |
+
\end{Highlighting}
|
404 |
+
\end{Shaded}
|
405 |
+
|
406 |
+
\subsection{Configuring paths}\label{configuring-paths}
|
407 |
+
|
408 |
+
\highlighta{For those who do not have taken the extension from the
|
409 |
+
\texttt{jupyter_contrib_nbextensions} repository or have not configured
|
410 |
+
extensions via its \texttt{setup.py} utility,} a file
|
411 |
+
\texttt{set\_paths.py} is present in the extension directory (it is
|
412 |
+
merely a verbatim copy of the relevant parts in setup.py). This file
|
413 |
+
configure the paths to the \texttt{templates} and \texttt{extension}
|
414 |
+
directories. It should be executed by something like
|
415 |
+
|
416 |
+
\begin{Shaded}
|
417 |
+
\begin{Highlighting}[]
|
418 |
+
\KeywordTok{python3} \NormalTok{set_paths.py}
|
419 |
+
\end{Highlighting}
|
420 |
+
\end{Shaded}
|
421 |
+
|
422 |
+
Additionaly, you may also have to execute \texttt{mv\_paths.py} if you
|
423 |
+
installed from the original repo via
|
424 |
+
\texttt{jupyter\ nbextension\ install\ ..}
|
425 |
+
|
426 |
+
\begin{Shaded}
|
427 |
+
\begin{Highlighting}[]
|
428 |
+
\KeywordTok{python3} \NormalTok{mv_paths.py}
|
429 |
+
\end{Highlighting}
|
430 |
+
\end{Shaded}
|
431 |
+
|
432 |
+
\subsection{Example for embedding the css within the notebook before
|
433 |
+
conversion}\label{example-for-embedding-the-css-within-the-notebook-before-conversion}
|
434 |
+
|
435 |
+
\begin{Verbatim}[commandchars=\\\{\}]
|
436 |
+
>>> \PY{k+kn}{from} \PY{n+nn}{IPython}\PY{n+nn}{.}\PY{n+nn}{core}\PY{n+nn}{.}\PY{n+nn}{display} \PY{k}{import} \PY{n}{display}\PY{p}{,} \PY{n}{HTML}
|
437 |
+
... \PY{k+kn}{from} \PY{n+nn}{jupyter\PYZus{}core}\PY{n+nn}{.}\PY{n+nn}{paths} \PY{k}{import} \PY{n}{jupyter\PYZus{}config\PYZus{}dir}\PY{p}{,} \PY{n}{jupyter\PYZus{}data\PYZus{}dir}
|
438 |
+
... \PY{k+kn}{import} \PY{n+nn}{os}
|
439 |
+
... \PY{n}{csspath}\PY{o}{=}\PY{n}{os}\PY{o}{.}\PY{n}{path}\PY{o}{.}\PY{n}{join}\PY{p}{(}\PY{n}{jupyter\PYZus{}data\PYZus{}dir}\PY{p}{(}\PY{p}{)}\PY{p}{,}\PY{l+s}{\PYZsq{}}\PY{l+s}{nbextensions}\PY{l+s}{\PYZsq{}}\PY{p}{,}
|
440 |
+
... \PY{l+s}{\PYZsq{}}\PY{l+s}{highlighter}\PY{l+s}{\PYZsq{}}\PY{p}{,}\PY{l+s}{\PYZsq{}}\PY{l+s}{highlighter.css}\PY{l+s}{\PYZsq{}}\PY{p}{)}
|
441 |
+
... \PY{n}{HTML}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{\PYZlt{}style\PYZgt{}}\PY{l+s}{\PYZsq{}}\PY{o}{+}\PY{n+nb}{open}\PY{p}{(}\PY{n}{csspath}\PY{p}{,} \PY{l+s}{\PYZdq{}}\PY{l+s}{r}\PY{l+s}{\PYZdq{}}\PY{p}{)}\PY{o}{.}\PY{n}{read}\PY{p}{(}\PY{p}{)}\PY{o}{+}\PY{l+s}{\PYZsq{}}\PY{l+s}{\PYZlt{}/style\PYZgt{}}\PY{l+s}{\PYZsq{}}\PY{p}{)}
|
442 |
+
\end{Verbatim}
|
443 |
+
|
444 |
+
|
445 |
+
|
446 |
+
\begin{verbatim}
|
447 |
+
<IPython.core.display.HTML object>
|
448 |
+
\end{verbatim}
|
449 |
+
|
450 |
+
|
451 |
+
|
452 |
+
|
453 |
+
% Add a bibliography block to the postdoc
|
454 |
+
|
455 |
+
|
456 |
+
|
457 |
+
\end{document}
|
.local/share/jupyter/nbextensions/highlighter/highlighter.js
ADDED
@@ -0,0 +1,378 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
Three different highlighting schemes "mark"|"burk"|"girk"|"birk"|"pirk" are defined in the css highlighter.css
|
3 |
+
The following functions highlight the selected text, according to the scheme chosen by a menu button. More precisely, they replace selected text, both in edit or command mode, by
|
4 |
+
a span tag with a given class and the selected text as data.
|
5 |
+
if no text is selected, then the whole cell is highlighted (using a div tag and a class corresponding to the chosen scheme). A function to remove all hihlightings is also provided.
|
6 |
+
*/
|
7 |
+
|
8 |
+
function removeFullCellHighlight(cell_text) {
|
9 |
+
cell_text = cell_text.replace(/<div class=(?:"mark"|"burk"|"girk"|"birk"|"pirk")>\n([\s\S]*?)<\/div><i class="fa fa-lightbulb-o "><\/i>/g, function (w, g) {
|
10 |
+
return g
|
11 |
+
})
|
12 |
+
return cell_text
|
13 |
+
}
|
14 |
+
|
15 |
+
function fullCellHighlight(cell_text, scheme) {
|
16 |
+
cell_text = removeFullCellHighlight(cell_text);
|
17 |
+
return '<div class=' + '"' + scheme + '"' + '>\n' + cell_text + '</div><i class="fa fa-lightbulb-o "><\/i>'
|
18 |
+
}
|
19 |
+
|
20 |
+
function highlight(text, scheme) {
|
21 |
+
var scheme = scheme;
|
22 |
+
// replace by a span, wile preserving leading and trailing spaces
|
23 |
+
var rep = text.replace(/(\S[\S\s]*\S)/, function (w, internal_text) {
|
24 |
+
return '<span class=' + '"' + scheme + '"' + '>' + internal_text + '</span>'
|
25 |
+
})
|
26 |
+
return rep
|
27 |
+
//return '<span class='+'"'+scheme+'"'+'>'+text+'</span>'
|
28 |
+
}
|
29 |
+
|
30 |
+
|
31 |
+
function add_div(text) {
|
32 |
+
if (text.match(/^<div>([\S\s]*)<\/div>$/) == null) {
|
33 |
+
return '<div>' + text + '</div>'
|
34 |
+
} else {
|
35 |
+
return text
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
function rem_div(text) {
|
40 |
+
return text.replace(/^<div>([\S\s]*)<\/div>$/, function (w, g) {
|
41 |
+
return g
|
42 |
+
})
|
43 |
+
}
|
44 |
+
|
45 |
+
function highlightInCmdMode(event, scheme) {
|
46 |
+
var cell = IPython.notebook.get_selected_cell()
|
47 |
+
var cm = IPython.notebook.get_selected_cell().code_mirror
|
48 |
+
var selectedText = window.getSelection().toString();
|
49 |
+
var cell_text = cell.get_text();
|
50 |
+
if (selectedText.length == 0) {
|
51 |
+
cell_text = fullCellHighlight(cell_text, scheme);
|
52 |
+
} else {
|
53 |
+
var identifiedText = align(selectedText, cell_text);
|
54 |
+
cell_text = cell_text.replace(identifiedText, highlight(identifiedText, scheme));
|
55 |
+
}
|
56 |
+
cell.set_text(cell_text);
|
57 |
+
cell.render();
|
58 |
+
return false;
|
59 |
+
}
|
60 |
+
|
61 |
+
function highlightInEditMode(event, scheme) {
|
62 |
+
var cell = IPython.notebook.get_selected_cell()
|
63 |
+
var cm = cell.code_mirror
|
64 |
+
var selectedText = cm.getSelection()
|
65 |
+
if (selectedText.length == 0) {
|
66 |
+
var cell_text = cell.get_text();
|
67 |
+
cell_text = fullCellHighlight(cell_text, scheme);
|
68 |
+
cell.set_text(cell_text);
|
69 |
+
} else {
|
70 |
+
cm.replaceSelection(highlight(selectedText, scheme))
|
71 |
+
}
|
72 |
+
return false;
|
73 |
+
}
|
74 |
+
|
75 |
+
function removeHighlights() {
|
76 |
+
var cell = IPython.notebook.get_selected_cell();
|
77 |
+
var cell_text = removeFullCellHighlight(cell.get_text());
|
78 |
+
cell_text = cell_text.replace(/<span class=(?:"mark"|"burk"|"girk"|"birk"|"pirk")>([\s\S]*?)<\/span>/g,
|
79 |
+
function (w, g) {
|
80 |
+
return g
|
81 |
+
}
|
82 |
+
)
|
83 |
+
cell.set_text(cell_text)
|
84 |
+
cell.render();
|
85 |
+
}
|
86 |
+
|
87 |
+
//*****************************************************************************************
|
88 |
+
// Utilitary functions for finding a candidate corresponding text from an unformatted selection
|
89 |
+
|
90 |
+
/* In case of text selection in rendered cells, the returned text retains no formatting
|
91 |
+
therefore, when looking for this text in the actual formatted text, we need to do a
|
92 |
+
kind of "fuzzy" alignment. Though there exists specialized libraries for such task,
|
93 |
+
we have developed here a simple heuristics that should work 90% of the time,
|
94 |
+
but the problem cannot get a perfect solution.
|
95 |
+
A first point is to replace special characters that could be interpreded with
|
96 |
+
a special meaning in regular expressions. Then the idea is to find the exact matches
|
97 |
+
on the longest substring from the beginning of text, then the longest substring
|
98 |
+
from the end of the text. Finally, given the locations of the two substring,
|
99 |
+
we extract the corresponding global match in the original text.
|
100 |
+
*/
|
101 |
+
function escapeRegExp(str) {
|
102 |
+
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "#");
|
103 |
+
// return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
104 |
+
return str
|
105 |
+
}
|
106 |
+
|
107 |
+
// Extract the longest matching substring from the beginning of the text
|
108 |
+
function exsub_up(sub, text) {
|
109 |
+
for (k = 0; k <= sub.length; k++) {
|
110 |
+
if (text.match(sub.substr(0, k)) == null) {
|
111 |
+
k = k - 2
|
112 |
+
break
|
113 |
+
}
|
114 |
+
}
|
115 |
+
return text.match(sub.substr(0, k + 1))
|
116 |
+
}
|
117 |
+
|
118 |
+
// Extract the longest matching substring from the end of the text
|
119 |
+
function exsub_down(sub, text) {
|
120 |
+
var L = sub.length
|
121 |
+
try {
|
122 |
+
for (k = 0; k <= sub.length; k++) {
|
123 |
+
tst = sub.substr(L - k - 1, L);
|
124 |
+
if (text.match(tst) == null) {
|
125 |
+
// console.log(tst)
|
126 |
+
k = k - 1
|
127 |
+
break
|
128 |
+
}
|
129 |
+
}
|
130 |
+
return text.match(sub.substr(L - k - 1, L))
|
131 |
+
} catch (e) {
|
132 |
+
console.log('Error', e)
|
133 |
+
return ""
|
134 |
+
}
|
135 |
+
|
136 |
+
}
|
137 |
+
|
138 |
+
// Function that tries to find the best match of the unformatted
|
139 |
+
// text in the formatted one.
|
140 |
+
|
141 |
+
function align(tofind, text) {
|
142 |
+
|
143 |
+
sub = escapeRegExp(tofind)
|
144 |
+
textModified = escapeRegExp(text)
|
145 |
+
//console.log(textModified.match(sub))
|
146 |
+
if (textModified.match(sub) == null) {
|
147 |
+
a = exsub_up(sub, textModified)
|
148 |
+
b = exsub_down(sub, textModified)
|
149 |
+
return text.substr(a.index, b.index + b[0].length - a.index)
|
150 |
+
} else {
|
151 |
+
var tmpMatch = textModified.match(sub)
|
152 |
+
return text.substr(tmpMatch.index, tmpMatch[0].length)
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
|
157 |
+
|
158 |
+
// ***************** Keyboard shortcuts ******************************
|
159 |
+
|
160 |
+
var add_cmd_shortcuts = {
|
161 |
+
'Alt-g': {
|
162 |
+
help: 'highlight selected text',
|
163 |
+
help_index: 'ht',
|
164 |
+
handler: function (event) {
|
165 |
+
highlightInCmdMode("", mark);
|
166 |
+
return false;
|
167 |
+
}
|
168 |
+
},
|
169 |
+
'Alt-h': {
|
170 |
+
help: 'highlight selected text',
|
171 |
+
help_index: 'ht',
|
172 |
+
handler: function (event) {
|
173 |
+
highlightInCmdMode("", burk);
|
174 |
+
return false;
|
175 |
+
}
|
176 |
+
},
|
177 |
+
};
|
178 |
+
|
179 |
+
|
180 |
+
var add_edit_shortcuts = {
|
181 |
+
'Alt-g': {
|
182 |
+
help: 'highlight selected text',
|
183 |
+
help_index: 'ht',
|
184 |
+
handler: function (event) {
|
185 |
+
var highlight = mark;
|
186 |
+
highlightInEditMode("", mark);
|
187 |
+
return false;
|
188 |
+
}
|
189 |
+
},
|
190 |
+
'Alt-h': {
|
191 |
+
help: 'highlight selected text',
|
192 |
+
help_index: 'ht',
|
193 |
+
handler: function (event) {
|
194 |
+
var highlight = burk;
|
195 |
+
highlightInEditMode("", burk);
|
196 |
+
return false;
|
197 |
+
}
|
198 |
+
},
|
199 |
+
};
|
200 |
+
|
201 |
+
|
202 |
+
//******Toolbar buttons *************************************************
|
203 |
+
|
204 |
+
function highlightText(scheme) {
|
205 |
+
var cell = IPython.notebook.get_selected_cell();
|
206 |
+
var rendered = cell.rendered;
|
207 |
+
if (rendered) highlightInCmdMode("", scheme);
|
208 |
+
else highlightInEditMode("", scheme);
|
209 |
+
}
|
210 |
+
|
211 |
+
|
212 |
+
function build_toolbar() {
|
213 |
+
var test = ' <div id="hgl" class="toolbar btn-group" role="toolbar"> \
|
214 |
+
<button type="button" class="btn btn-default btn-group" id="higlighter_menu" href="#">\
|
215 |
+
<i id="menu-hgl" class="fa fa-caret-right"></i></button>\
|
216 |
+
<div id="submenu" class="btn-group" style="font-weight:bold;margin-left:0" > \
|
217 |
+
<button type="button" class="btn btn-default highlighter-btn burk" style="font-weight:bold;margin-left:0" href="#" id="b1"></button>\
|
218 |
+
<button type="button" class="btn btn-default highlighter-btn mark" style="font-weight:bold;margin-left:0" href="#" id="b2"></button>\
|
219 |
+
<button type="button" class="btn btn-default highlighter-btn girk" style="font-weight:bold;margin-left:0" href="#" id="b3"></button>\
|
220 |
+
<button type="button" class="btn btn-default highlighter-btn birk" style="font-weight:bold;margin-left:0" href="#" id="b4"></button>\
|
221 |
+
<button type="button" class="btn btn-default highlighter-btn pirk" style="font-weight:bold;margin-left:0" href="#" id="b5"></button>\
|
222 |
+
<button type="button" class="btn btn-default" style="font-weight:bold;margin-left:0"\
|
223 |
+
href="#" id="remove_highlights">\<i class="fa fa-times highlighter-close"></i> </button></div>\
|
224 |
+
</div>'
|
225 |
+
|
226 |
+
|
227 |
+
$("#maintoolbar-container").append(test);
|
228 |
+
$("#test").css({
|
229 |
+
'padding': '5px'
|
230 |
+
});
|
231 |
+
|
232 |
+
$("#submenu").hide(); // initially hide the submenu
|
233 |
+
|
234 |
+
//buttons initial css -- shall check if this is really necessary
|
235 |
+
// $("#higlighter_menu").css({
|
236 |
+
// 'padding': '2px 8px',
|
237 |
+
// 'display': 'inline-block',
|
238 |
+
// 'border': '1px solid',
|
239 |
+
// 'border-color': '#cccccc',
|
240 |
+
// 'font-weight': 'bold',
|
241 |
+
// 'text-align': 'center',
|
242 |
+
// 'vertical-align': 'middle',
|
243 |
+
// 'margin-left': '0px',
|
244 |
+
// 'margin-right': '0px'
|
245 |
+
// })
|
246 |
+
|
247 |
+
|
248 |
+
//Actions
|
249 |
+
|
250 |
+
|
251 |
+
$("#higlighter_menu")
|
252 |
+
.on('click', function () {
|
253 |
+
$("#submenu").toggle();
|
254 |
+
$("#menu-hgl").toggleClass("fa-caret-right")
|
255 |
+
$("#menu-hgl").toggleClass("fa-caret-left")
|
256 |
+
})
|
257 |
+
.attr('title', 'Highlight Selected Text');
|
258 |
+
|
259 |
+
|
260 |
+
$("#b1")
|
261 |
+
.on('click', function () {
|
262 |
+
highlightText("burk")
|
263 |
+
})
|
264 |
+
.on('mouseover', function () {
|
265 |
+
$("#b1").removeClass("btn btn-default").addClass("btn burk")
|
266 |
+
//.addClass("burk");
|
267 |
+
}) //!!
|
268 |
+
.on('mouseout', function () {
|
269 |
+
$("#b1").addClass("btn btn-default")
|
270 |
+
})
|
271 |
+
|
272 |
+
|
273 |
+
$("#b2")
|
274 |
+
.on('click', function () {
|
275 |
+
highlightText("mark")
|
276 |
+
})
|
277 |
+
.on('mouseover', function () {
|
278 |
+
$("#b2").removeClass("btn btn-default").addClass("btn mark")
|
279 |
+
}) //!!
|
280 |
+
.on('mouseout', function () {
|
281 |
+
$("#b2").addClass("btn btn-default")
|
282 |
+
})
|
283 |
+
|
284 |
+
$("#b3")
|
285 |
+
.on('click', function () {
|
286 |
+
highlightText("girk")
|
287 |
+
})
|
288 |
+
.on('mouseover', function () {
|
289 |
+
$(this).removeClass("btn btn-default").addClass("btn girk")
|
290 |
+
}) //!!
|
291 |
+
.on('mouseout', function () {
|
292 |
+
$(this).addClass("btn btn-default")
|
293 |
+
})
|
294 |
+
|
295 |
+
$("#b4")
|
296 |
+
.on('click', function () {
|
297 |
+
highlightText("birk")
|
298 |
+
})
|
299 |
+
.on('mouseover', function () {
|
300 |
+
$(this).removeClass("btn btn-default").addClass("btn birk")
|
301 |
+
}) //!!
|
302 |
+
.on('mouseout', function () {
|
303 |
+
$(this).addClass("btn btn-default")
|
304 |
+
})
|
305 |
+
|
306 |
+
$("#b5")
|
307 |
+
.on('click', function () {
|
308 |
+
highlightText("pirk")
|
309 |
+
})
|
310 |
+
.on('mouseover', function () {
|
311 |
+
$(this).removeClass("btn btn-default").addClass("btn pirk")
|
312 |
+
}) //!!
|
313 |
+
.on('mouseout', function () {
|
314 |
+
$(this).addClass("btn btn-default")
|
315 |
+
})
|
316 |
+
|
317 |
+
|
318 |
+
$("#remove_highlights")
|
319 |
+
.on('click', function () {
|
320 |
+
removeHighlights()
|
321 |
+
})
|
322 |
+
.attr('title', 'Remove highlightings in selected cell');
|
323 |
+
} // end build_toolbar
|
324 |
+
|
325 |
+
//******************************* MAIN FUNCTION **************************
|
326 |
+
|
327 |
+
define(["require",
|
328 |
+
'base/js/namespace'
|
329 |
+
], function (requirejs, Jupyter) {
|
330 |
+
|
331 |
+
var security = requirejs("base/js/security")
|
332 |
+
|
333 |
+
var load_css = function (name) {
|
334 |
+
var link = document.createElement("link");
|
335 |
+
link.type = "text/css";
|
336 |
+
link.rel = "stylesheet";
|
337 |
+
link.href = requirejs.toUrl(name);
|
338 |
+
document.getElementsByTagName("head")[0].appendChild(link);
|
339 |
+
|
340 |
+
};
|
341 |
+
|
342 |
+
//Load_ipython_extension
|
343 |
+
var load_ipython_extension = requirejs(['base/js/namespace'], function (Jupyter) {
|
344 |
+
"use strict";
|
345 |
+
if (Jupyter.version[0] < 3) {
|
346 |
+
console.log("This extension requires Jupyter or IPython >= 3.x")
|
347 |
+
return
|
348 |
+
}
|
349 |
+
|
350 |
+
console.log("[highlighter] Loading highlighter.css");
|
351 |
+
load_css('./highlighter.css')
|
352 |
+
|
353 |
+
IPython.keyboard_manager.edit_shortcuts.add_shortcuts(add_edit_shortcuts);
|
354 |
+
IPython.keyboard_manager.command_shortcuts.add_shortcuts(add_cmd_shortcuts);
|
355 |
+
|
356 |
+
build_toolbar();
|
357 |
+
|
358 |
+
var _on_reload = true; /* make sure cells render on reload */
|
359 |
+
|
360 |
+
//highlighter_init_cells(); /* initialize cells */
|
361 |
+
|
362 |
+
|
363 |
+
/* on reload */
|
364 |
+
$([Jupyter.events]).on('status_started.Kernel', function () {
|
365 |
+
|
366 |
+
//highlighter_init_cells();
|
367 |
+
console.log("[highlighter] reload...");
|
368 |
+
_on_reload = false;
|
369 |
+
})
|
370 |
+
|
371 |
+
}); //end of load_ipython_extension function
|
372 |
+
|
373 |
+
return {
|
374 |
+
load_ipython_extension: load_ipython_extension,
|
375 |
+
};
|
376 |
+
}); //End of main function
|
377 |
+
|
378 |
+
console.log("Loading ./highlighter.js");
|
.local/share/jupyter/nbextensions/highlighter/icon.png
ADDED
.local/share/jupyter/nbextensions/highlighter/image.gif
ADDED
.local/share/jupyter/nbextensions/highlighter/readme.md
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Highlighter
|
2 |
+
===========
|
3 |
+
|
4 |
+
- Firstable, the extension provides <span class="mark">several toolbar buttons</span> for highlighting a selected text _within a markdown cell_. Three different \`color schemes' are provided, which can be easily customized in the stylesheet `highlighter.css`. The last button enables to remove all highlightings in the current cell.
|
5 |
+
- This works both <span class="burk">when the cell is _rendered_ and when the cell is in edit mode</span>;
|
6 |
+
- In both modes, it is possible to highlight formatted portions of text (In rendered mode, since the selected text loose its formatting, an heuristic is applied to find the best alignment with the actual text)
|
7 |
+
- When no text is selected, the whole cell is highlighted;
|
8 |
+
- The extension also provides two keyboard shortcuts (Alt-G and Alt-H) which fire the highlighting of the selected text.
|
9 |
+
- Highlights can be preserved when exporting to html or to LaTeX -- details are provided in [export_highlights](https://rawgit.com/jfbercher/small_nbextensions/master/usability/highlighter/export_highlights.html)
|
10 |
+
|
11 |
+
|
12 |
+
![](image.gif)
|
13 |
+
|
14 |
+
|
15 |
+
Installation
|
16 |
+
------------
|
17 |
+
|
18 |
+
The extension can be installed with the nice UI available on jupyter_nbextensions_configurator website, which also allows to enable/disable the extension.
|
19 |
+
|
20 |
+
You may also install the extension from the original repo: issue
|
21 |
+
|
22 |
+
```bash
|
23 |
+
jupyter nbextension install https://rawgit.com/jfbercher/small_nbextensions/master/highlighter.zip --user
|
24 |
+
```
|
25 |
+
at the command line.
|
26 |
+
|
27 |
+
|
28 |
+
Testing
|
29 |
+
-------
|
30 |
+
|
31 |
+
Use a code cell with
|
32 |
+
|
33 |
+
```python
|
34 |
+
%%javascript
|
35 |
+
require("base/js/utils").load_extensions("highlighter/highlighter")
|
36 |
+
```
|
37 |
+
|
38 |
+
|
39 |
+
Automatic load
|
40 |
+
--------------
|
41 |
+
|
42 |
+
You may also automatically load the extension for any notebook via
|
43 |
+
|
44 |
+
```bash
|
45 |
+
jupyter nbextension enable highlighter/highlighter
|
46 |
+
```
|
47 |
+
|
.local/share/jupyter/nbextensions/highlighter/tst_highlights.pdf
ADDED
Binary file (68.6 kB). View file
|
|
.local/share/jupyter/nbextensions/hinterland/hinterland.js
ADDED
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
define([
|
2 |
+
'module',
|
3 |
+
'jquery',
|
4 |
+
'base/js/namespace',
|
5 |
+
'base/js/keyboard',
|
6 |
+
'notebook/js/cell',
|
7 |
+
'notebook/js/codecell',
|
8 |
+
'notebook/js/completer',
|
9 |
+
], function (
|
10 |
+
module,
|
11 |
+
$,
|
12 |
+
Jupyter,
|
13 |
+
keyboard,
|
14 |
+
cell,
|
15 |
+
codecell,
|
16 |
+
completer
|
17 |
+
) {
|
18 |
+
'use strict';
|
19 |
+
|
20 |
+
var Cell = cell.Cell;
|
21 |
+
var CodeCell = codecell.CodeCell;
|
22 |
+
var Completer = completer.Completer;
|
23 |
+
|
24 |
+
var log_prefix = '[' + module.id + ']';
|
25 |
+
|
26 |
+
// default config (updated on nbextension load)
|
27 |
+
var config = {
|
28 |
+
enable_at_start: true,
|
29 |
+
exclude_regexp: ':',
|
30 |
+
include_regexp: '',
|
31 |
+
tooltip_regexp: '\\(',
|
32 |
+
hint_delay: 20,
|
33 |
+
hint_inside_comments: false,
|
34 |
+
};
|
35 |
+
// flag denoting whether hinting is enabled
|
36 |
+
var do_hinting;
|
37 |
+
|
38 |
+
// ignore most specially-named keys
|
39 |
+
var specials = [
|
40 |
+
keyboard.keycodes.enter,
|
41 |
+
keyboard.keycodes.esc,
|
42 |
+
keyboard.keycodes.backspace,
|
43 |
+
keyboard.keycodes.tab,
|
44 |
+
keyboard.keycodes.up,
|
45 |
+
keyboard.keycodes.down,
|
46 |
+
keyboard.keycodes.left,
|
47 |
+
keyboard.keycodes.right,
|
48 |
+
keyboard.keycodes.shift,
|
49 |
+
keyboard.keycodes.ctrl,
|
50 |
+
keyboard.keycodes.alt,
|
51 |
+
keyboard.keycodes.meta,
|
52 |
+
keyboard.keycodes.capslock,
|
53 |
+
keyboard.keycodes.space,
|
54 |
+
keyboard.keycodes.pageup,
|
55 |
+
keyboard.keycodes.pagedown,
|
56 |
+
keyboard.keycodes.end,
|
57 |
+
keyboard.keycodes.home,
|
58 |
+
keyboard.keycodes.insert,
|
59 |
+
keyboard.keycodes.delete,
|
60 |
+
keyboard.keycodes.numlock,
|
61 |
+
keyboard.keycodes.f1,
|
62 |
+
keyboard.keycodes.f2,
|
63 |
+
keyboard.keycodes.f3,
|
64 |
+
keyboard.keycodes.f4,
|
65 |
+
keyboard.keycodes.f5,
|
66 |
+
keyboard.keycodes.f6,
|
67 |
+
keyboard.keycodes.f7,
|
68 |
+
keyboard.keycodes.f8,
|
69 |
+
keyboard.keycodes.f9,
|
70 |
+
keyboard.keycodes.f10,
|
71 |
+
keyboard.keycodes.f11,
|
72 |
+
keyboard.keycodes.f12,
|
73 |
+
keyboard.keycodes.f13,
|
74 |
+
keyboard.keycodes.f14,
|
75 |
+
keyboard.keycodes.f15
|
76 |
+
];
|
77 |
+
|
78 |
+
/**
|
79 |
+
* copied from base/js/keyboard, since it isn't exported
|
80 |
+
* Return `true` if the event only contains modifiers keys.
|
81 |
+
* false otherwise
|
82 |
+
**/
|
83 |
+
function only_modifier_event (event) {
|
84 |
+
var key = keyboard.inv_keycodes[event.which];
|
85 |
+
return (
|
86 |
+
(event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) &&
|
87 |
+
(key === 'alt'|| key === 'ctrl'|| key === 'meta'|| key === 'shift')
|
88 |
+
);
|
89 |
+
}
|
90 |
+
|
91 |
+
function patch_cell_keyevent () {
|
92 |
+
console.log(log_prefix, 'patching Cell.prototype.handle_codemirror_keyevent');
|
93 |
+
var orig_handle_codemirror_keyevent = Cell.prototype.handle_codemirror_keyevent;
|
94 |
+
Cell.prototype.handle_codemirror_keyevent = function (editor, event) {
|
95 |
+
if (do_hinting && (this instanceof CodeCell) && !only_modifier_event(event)) {
|
96 |
+
// Tab completion.
|
97 |
+
this.tooltip.remove_and_cancel_tooltip();
|
98 |
+
// don't attempt completion when selecting, or when using multicursor
|
99 |
+
if ( !editor.somethingSelected() &&
|
100 |
+
editor.getSelections().length <= 1 &&
|
101 |
+
!this.completer.visible &&
|
102 |
+
specials.indexOf(event.keyCode) == -1) {
|
103 |
+
var cell = this;
|
104 |
+
// set a timeout to try to ensure that CodeMirror inserts
|
105 |
+
// the new key *before* the completion request happens
|
106 |
+
setTimeout(function () {
|
107 |
+
var cur = editor.getCursor();
|
108 |
+
var pre_cursor = editor.getRange({
|
109 |
+
line: cur.line,
|
110 |
+
ch: cur.ch - 1
|
111 |
+
}, cur);
|
112 |
+
if ( pre_cursor !== '' &&
|
113 |
+
(config.hint_inside_comments || editor.getTokenAt(cur).type !== "comment") &&
|
114 |
+
(config.include_regexp.test(pre_cursor) || config.tooltip_regexp.test(pre_cursor)) &&
|
115 |
+
!config.exclude_regexp.test(pre_cursor) ) {
|
116 |
+
if (config.tooltip_regexp.test(pre_cursor)) {
|
117 |
+
cell.tooltip.request(cell);
|
118 |
+
}
|
119 |
+
else {
|
120 |
+
cell.completer.startCompletion();
|
121 |
+
cell.completer.autopick = false;
|
122 |
+
}
|
123 |
+
}
|
124 |
+
}, config.hint_delay);
|
125 |
+
}
|
126 |
+
}
|
127 |
+
return orig_handle_codemirror_keyevent.apply(this, arguments);
|
128 |
+
};
|
129 |
+
}
|
130 |
+
|
131 |
+
function set_hinterland_state (new_state) {
|
132 |
+
do_hinting = new_state;
|
133 |
+
$('.hinterland-toggle > .fa')
|
134 |
+
.toggleClass('fa-check', do_hinting);
|
135 |
+
console.log(log_prefix, 'continuous hinting', do_hinting ? 'on' : 'off');
|
136 |
+
}
|
137 |
+
|
138 |
+
function toggle_hinterland () {
|
139 |
+
set_hinterland_state(!do_hinting);
|
140 |
+
}
|
141 |
+
|
142 |
+
function add_menu_item () {
|
143 |
+
if ($('#help_menu').find('.hinterland_toggle').length > 0) {
|
144 |
+
return;
|
145 |
+
}
|
146 |
+
var menu_item = $('<li/>')
|
147 |
+
.insertAfter('#keyboard_shortcuts');
|
148 |
+
var menu_link = $('<a/>')
|
149 |
+
.text('Continuous hints')
|
150 |
+
.addClass('hinterland-toggle')
|
151 |
+
.attr('title', 'Provide continuous code hints')
|
152 |
+
.on('click', toggle_hinterland)
|
153 |
+
.appendTo(menu_item);
|
154 |
+
$('<i/>')
|
155 |
+
.addClass('fa menu-icon pull-right')
|
156 |
+
.prependTo(menu_link);
|
157 |
+
}
|
158 |
+
|
159 |
+
function load_notebook_extension () {
|
160 |
+
|
161 |
+
Jupyter.notebook.config.loaded.then(function on_success () {
|
162 |
+
$.extend(true, config, Jupyter.notebook.config.data.hinterland);
|
163 |
+
// special defaults:
|
164 |
+
// default include is taken from Completer, rather than the blank
|
165 |
+
if (config.include_regexp === '') {
|
166 |
+
config.include_regexp = Completer.reinvoke_re;
|
167 |
+
}
|
168 |
+
// now turn regexps loaded from config (which will be strings) into
|
169 |
+
// actual RegExp objects.
|
170 |
+
var regexp_names = ['exclude_regexp', 'include_regexp', 'tooltip_regexp'];
|
171 |
+
for (var ii=0; ii < regexp_names.length; ii++) {
|
172 |
+
if (config[regexp_names[ii]] === '') {
|
173 |
+
continue;
|
174 |
+
}
|
175 |
+
try {
|
176 |
+
config[regexp_names[ii]] = new RegExp(config[regexp_names[ii]]);
|
177 |
+
}
|
178 |
+
catch (err) {
|
179 |
+
console.warn(log_prefix, 'error parsing', regexp_names[ii] + ':', err);
|
180 |
+
}
|
181 |
+
}
|
182 |
+
}, function on_error (err) {
|
183 |
+
console.warn(log_prefix, 'error loading config:', err);
|
184 |
+
}).then(function on_success () {
|
185 |
+
patch_cell_keyevent();
|
186 |
+
add_menu_item();
|
187 |
+
set_hinterland_state(config.enable_at_start);
|
188 |
+
});
|
189 |
+
}
|
190 |
+
|
191 |
+
return {
|
192 |
+
load_ipython_extension : load_notebook_extension
|
193 |
+
};
|
194 |
+
});
|
.local/share/jupyter/nbextensions/move_selected_cells/README.md
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Move selected cells
|
2 |
+
|
3 |
+
This is a quick (and dirty) extension - move up or down several selected cell*s*. Moving cells or series of cells via simple keystrokes can be super useful.
|
4 |
+
Note: Alternatively, it is now possible to use the `keyboard_shortcut_editor` to bind the move cell up & move cell down actions to Alt-up and Alt-down (or anything else).
|
5 |
+
|
6 |
+
Initial version for Jupyter 4.0: a bit dirty because it would be better to act on DOM elements and write a correct move_cells() function.
|
7 |
+
New version, updated to Jupyter 4.2+, now takes advantage of `Jupyter.notebook.move_selection_{down, up}` new functions
|
8 |
+
|
9 |
+
|
10 |
+
Keyboard shortcuts: *Alt-up* and *Alt-down* (works also with single cells!)
|
11 |
+
|
12 |
+
**Cell selection**: Cells can be selected using the rubberband (if this extension is enabled) or via Shift-up/Shift-down or Shift-K/Shift-J
|
.local/share/jupyter/nbextensions/move_selected_cells/move_selected_cells.yaml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Type: IPython Notebook Extension
|
2 |
+
Name: Move selected cells
|
3 |
+
Description: Move selected cell*s* using keybaord shortcuts Alt-up and Alt-down
|
4 |
+
Link: README.md
|
5 |
+
Main: main.js
|
6 |
+
Compatibility: 4.x, 5.x
|
.local/share/jupyter/nbextensions/python-markdown/main.js
ADDED
@@ -0,0 +1,212 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Allow Python-code in markdown cells
|
2 |
+
// Encapsulate using {{...}}
|
3 |
+
// - You can also return html or markdown from your Python code
|
4 |
+
// - You can embed images, however they will be sanitized on reload.
|
5 |
+
|
6 |
+
// TODO: Markdown cells will only be reevaluated when a notebook is dirty
|
7 |
+
// (i.e. you have made changes). If you save it before reevaluating MD cells,
|
8 |
+
// they will show the old value.
|
9 |
+
|
10 |
+
define([
|
11 |
+
'base/js/namespace',
|
12 |
+
'jquery',
|
13 |
+
'require',
|
14 |
+
'notebook/js/cell',
|
15 |
+
'base/js/security',
|
16 |
+
'components/marked/lib/marked',
|
17 |
+
'base/js/events',
|
18 |
+
'notebook/js/textcell'
|
19 |
+
], function(IPython, $, requirejs, cell, security, marked, events, textcell) {
|
20 |
+
"use strict";
|
21 |
+
|
22 |
+
/*
|
23 |
+
* Find Python expression enclosed in {{ }}, execute and add to text as
|
24 |
+
* <span> tags. The actual content gets filled in later by a callback.
|
25 |
+
* Already executed expressions are cached in cell metadata.
|
26 |
+
*
|
27 |
+
* @method execute_python
|
28 |
+
* @param cell {Cell} notebook cell
|
29 |
+
* @param text {String} text in cell
|
30 |
+
*/
|
31 |
+
var execute_python = function(cell,text) {
|
32 |
+
/* never execute code in untrusted notebooks */
|
33 |
+
if (IPython.notebook.trusted === false ) {
|
34 |
+
return undefined
|
35 |
+
}
|
36 |
+
/* always clear stored variables if notebook is dirty */
|
37 |
+
if (IPython.notebook.dirty === true ) delete cell.metadata.variables;
|
38 |
+
// search for code in double curly braces: {{}}
|
39 |
+
var found = false;
|
40 |
+
var newtext = text.replace(/{{(.*?)}}/g, function(match,tag,cha) {
|
41 |
+
found = true;
|
42 |
+
if (tag === "") return undefined;
|
43 |
+
var code = tag;
|
44 |
+
var id = 'python_'+cell.cell_id+'_'+cha; /* create an individual ID */
|
45 |
+
var thiscell = cell;
|
46 |
+
var thismatch = tag;
|
47 |
+
|
48 |
+
/* there a two possible options:
|
49 |
+
a) notebook dirty or variable not stored in metadata: evaluate variable
|
50 |
+
b) notebook clean and variable stored in metadata: display stored value
|
51 |
+
*/
|
52 |
+
if (typeof cell.metadata.variables === "undefined") {
|
53 |
+
cell.metadata.variables = {}
|
54 |
+
}
|
55 |
+
var val = cell.metadata.variables[thismatch];
|
56 |
+
if (IPython.notebook.dirty === true || val === undefined || jQuery.isEmptyObject(val)) {
|
57 |
+
cell.metadata.variables[thismatch] = {};
|
58 |
+
var execute_callback = function (out_data)
|
59 |
+
{
|
60 |
+
var html;
|
61 |
+
if (out_data.msg_type === "error") {
|
62 |
+
var text = "**" + out_data.content.ename + "**: " + out_data.content.evalue;
|
63 |
+
html = marked(text);
|
64 |
+
} else if (out_data.msg_type === "stream") {
|
65 |
+
html = marked(out_data.content.text);
|
66 |
+
var t = html.match(/^\s*<p>([\s\S]*?)<\/p>\s*$/); //strip <p> and </p> that marked (maybe) adds and we don't want
|
67 |
+
html = t !== null ? t[1] : html;
|
68 |
+
var q = html.match(/^'([\s\S]*?)'$/); // strip quotes from strings
|
69 |
+
if (q !== null) html = q[1]
|
70 |
+
} else if (out_data.msg_type === "execute_result" | out_data.msg_type === "display_data" ) {
|
71 |
+
var ul = out_data.content.data;
|
72 |
+
if (ul != undefined) {
|
73 |
+
if (ul['text/latex'] != undefined) {
|
74 |
+
html = ul['text/latex'];
|
75 |
+
} else if (ul['image/svg+xml'] != undefined) {
|
76 |
+
var svg = ul['image/svg+xml'];
|
77 |
+
/* embed SVG in an <img> tag, still get eaten by sanitizer... */
|
78 |
+
svg = btoa(svg);
|
79 |
+
html = '<img src="data:image/svg+xml;base64,' + svg + '"/>';
|
80 |
+
} else if (ul['image/jpeg'] != undefined) {
|
81 |
+
var jpeg = ul['image/jpeg'];
|
82 |
+
html = '<img src="data:image/jpeg;base64,' + jpeg + '"/>';
|
83 |
+
} else if (ul['image/png'] != undefined) {
|
84 |
+
var png = ul['image/png'];
|
85 |
+
html = '<img src="data:image/png;base64,' + png + '"/>';
|
86 |
+
} else if (ul['text/markdown'] != undefined) {
|
87 |
+
html = marked(ul['text/markdown']);
|
88 |
+
} else if (ul['text/html'] != undefined) {
|
89 |
+
html = ul['text/html'];
|
90 |
+
} else {
|
91 |
+
html = marked(ul['text/plain']);
|
92 |
+
// [\s\S] is used to also catch newlines
|
93 |
+
var t = html.match(/^\s*<p>([\s\S]*?)<\/p>\s*$/); //strip <p> and </p> that marked adds and we don't want
|
94 |
+
html = t !== null ? t[1] : html;
|
95 |
+
var q = html.match(/^'([\s\S]*?)'$/); // strip quotes from strings
|
96 |
+
if (q !== null) html = q[1]
|
97 |
+
}
|
98 |
+
}
|
99 |
+
} else {
|
100 |
+
return;
|
101 |
+
}
|
102 |
+
thiscell.metadata.variables[thismatch] = html;
|
103 |
+
var el = document.getElementById(id);
|
104 |
+
el.innerHTML = el.innerHTML + html; // output result
|
105 |
+
};
|
106 |
+
var callbacks = { iopub : { output: execute_callback } };
|
107 |
+
if (cell.notebook.kernel != null) {
|
108 |
+
cell.notebook.kernel.execute(code, callbacks, {silent: false, store_history : false, stop_on_error: false });
|
109 |
+
return "<span id='"+id+"'></span>"; // add HTML tag with ID where output will be placed
|
110 |
+
}
|
111 |
+
return undefined;
|
112 |
+
} else {
|
113 |
+
/* Notebook not dirty: replace tags with metadata */
|
114 |
+
val = cell.metadata.variables[tag];
|
115 |
+
return "<span id='"+id+"'>"+val+"</span>"
|
116 |
+
}
|
117 |
+
});
|
118 |
+
if (found == true) return newtext;
|
119 |
+
return undefined
|
120 |
+
};
|
121 |
+
|
122 |
+
/*
|
123 |
+
* Render markdown cell and replace {{...}} with python code
|
124 |
+
*
|
125 |
+
*/
|
126 |
+
var render_cell = function(cell) {
|
127 |
+
var element = cell.element.find('div.text_cell_render');
|
128 |
+
var text = execute_python(cell, element[0].innerHTML);
|
129 |
+
if (text !== undefined) {
|
130 |
+
element[0].innerHTML = text;
|
131 |
+
MathJax.Hub.Queue(["Typeset",MathJax.Hub,element[0]]);
|
132 |
+
}
|
133 |
+
};
|
134 |
+
|
135 |
+
/* force rendering of markdown cell if notebook is dirty */
|
136 |
+
var original_render = textcell.MarkdownCell.prototype.render;
|
137 |
+
textcell.MarkdownCell.prototype.render = function() {
|
138 |
+
if (IPython.notebook.dirty === true) {
|
139 |
+
this.rendered = false
|
140 |
+
}
|
141 |
+
return original_render.apply(this)
|
142 |
+
};
|
143 |
+
|
144 |
+
var set_trusted_indicator = function() {
|
145 |
+
var ind = $('.notebook-trusted');
|
146 |
+
if (IPython.notebook.trusted === true) {
|
147 |
+
ind.attr('title','Notebook is trusted');
|
148 |
+
ind.removeClass('fa-question');
|
149 |
+
ind.addClass('fa-check');
|
150 |
+
} else {
|
151 |
+
ind.attr('title','Notebook is not trusted');
|
152 |
+
ind.removeClass('fa-check');
|
153 |
+
ind.addClass('fa-question');
|
154 |
+
}
|
155 |
+
};
|
156 |
+
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Add CSS file
|
160 |
+
*
|
161 |
+
* @param name filename
|
162 |
+
*/
|
163 |
+
var load_css = function (name) {
|
164 |
+
var link = document.createElement("link");
|
165 |
+
link.type = "text/css";
|
166 |
+
link.rel = "stylesheet";
|
167 |
+
link.href = requirejs.toUrl(name);
|
168 |
+
document.getElementsByTagName("head")[0].appendChild(link);
|
169 |
+
};
|
170 |
+
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Update all references variables in markdown cells
|
174 |
+
*
|
175 |
+
*/
|
176 |
+
var update_md_cells = function () {
|
177 |
+
var ncells = IPython.notebook.ncells();
|
178 |
+
var cells = IPython.notebook.get_cells();
|
179 |
+
for (var i = 0; i < ncells; i++) {
|
180 |
+
var cell = cells[i];
|
181 |
+
if (cell.metadata.hasOwnProperty('variables')) {
|
182 |
+
render_cell(cell)
|
183 |
+
}
|
184 |
+
}
|
185 |
+
};
|
186 |
+
|
187 |
+
var load_ipython_extension = function() {
|
188 |
+
load_css('./main.css');
|
189 |
+
events.on("rendered.MarkdownCell", function (event, data) {
|
190 |
+
render_cell(data.cell);
|
191 |
+
});
|
192 |
+
events.on("trust_changed.Notebook", set_trusted_indicator);
|
193 |
+
|
194 |
+
$('#save_widget').append('<i id="notebook-trusted-indicator" class="fa fa-question notebook-trusted" />');
|
195 |
+
set_trusted_indicator();
|
196 |
+
|
197 |
+
/* Show values stored in metadata on reload */
|
198 |
+
events.on("kernel_ready.Kernel", function () {
|
199 |
+
if (Jupyter.notebook !== undefined && Jupyter.notebook._fully_loaded) {
|
200 |
+
update_md_cells()
|
201 |
+
} else {
|
202 |
+
events.on("notebook_loaded.Notebook", function () {
|
203 |
+
update_md_cells()
|
204 |
+
})
|
205 |
+
}
|
206 |
+
});
|
207 |
+
};
|
208 |
+
|
209 |
+
return {
|
210 |
+
load_ipython_extension : load_ipython_extension
|
211 |
+
};
|
212 |
+
});
|
.local/share/jupyter/nbextensions/python-markdown/python-markdown-pre.png
ADDED
.local/share/jupyter/nbextensions/python-markdown/untrusted.png
ADDED
.local/share/jupyter/nbextensions/rubberband/rubberband.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Type: IPython Notebook Extension
|
2 |
+
Name: Rubberband
|
3 |
+
Description: The rubberband extension allows selecting multiple cells
|
4 |
+
Link: readme.md
|
5 |
+
Icon: icon.png
|
6 |
+
Main: main.js
|
7 |
+
Compatibility: 4.x, 5.x
|
.local/share/jupyter/nbextensions/ruler/edit.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
define(['./main'], function (ruler) {
|
2 |
+
"use strict";
|
3 |
+
return ruler;
|
4 |
+
});
|
.local/share/jupyter/nbextensions/ruler/main.js
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Add rulers to codecells
|
2 |
+
define([
|
3 |
+
'base/js/namespace',
|
4 |
+
'base/js/events',
|
5 |
+
'services/config',
|
6 |
+
'notebook/js/codecell',
|
7 |
+
'codemirror/lib/codemirror',
|
8 |
+
'codemirror/addon/display/rulers'
|
9 |
+
], function (Jupyter, events, configmod, codecell, codemirror) {
|
10 |
+
"use strict";
|
11 |
+
|
12 |
+
var log_prefix = '[ruler]';
|
13 |
+
|
14 |
+
// define default config parameter values
|
15 |
+
var params = {
|
16 |
+
ruler_column: [78],
|
17 |
+
ruler_color: ["#ff0000"],
|
18 |
+
ruler_linestyle: ["dashed"],
|
19 |
+
ruler_do_css_patch: false
|
20 |
+
};
|
21 |
+
|
22 |
+
|
23 |
+
var rulers = [];
|
24 |
+
|
25 |
+
var isNumber = function (n) {
|
26 |
+
return !isNaN(parseFloat(n)) && isFinite(n);
|
27 |
+
};
|
28 |
+
|
29 |
+
// updates default params with any specified in the provided config data
|
30 |
+
var update_params = function (config_data) {
|
31 |
+
for (var key in params) {
|
32 |
+
if (config_data.hasOwnProperty(key)) {
|
33 |
+
params[key] = config_data[key];
|
34 |
+
}
|
35 |
+
}
|
36 |
+
};
|
37 |
+
|
38 |
+
var on_config_loaded = function () {
|
39 |
+
|
40 |
+
if (Jupyter.notebook !== undefined) {
|
41 |
+
var i, config = Jupyter.notebook.config;
|
42 |
+
} else {
|
43 |
+
var i, config = Jupyter.editor.config;
|
44 |
+
}
|
45 |
+
|
46 |
+
if (config.data.hasOwnProperty('ruler_color') && config.data.ruler_color.length > 0) {
|
47 |
+
params.ruler_color = config.data.ruler_color;
|
48 |
+
}
|
49 |
+
|
50 |
+
if (config.data.hasOwnProperty('ruler_column')) {
|
51 |
+
var new_columns = [];
|
52 |
+
for (i in config.data.ruler_column) {
|
53 |
+
if (isNumber(config.data.ruler_column[i])) {
|
54 |
+
new_columns.push(config.data.ruler_column[i]);
|
55 |
+
}
|
56 |
+
}
|
57 |
+
if (new_columns.length > 0) {
|
58 |
+
params.ruler_column = new_columns;
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
if (config.data.hasOwnProperty('ruler_linestyle') && config.data.ruler_linestyle.length > 0) {
|
63 |
+
params.ruler_linestyle = config.data.ruler_linestyle;
|
64 |
+
}
|
65 |
+
|
66 |
+
for (i in params.ruler_column) {
|
67 |
+
rulers.push({
|
68 |
+
color: params.ruler_color[i % params.ruler_color.length],
|
69 |
+
column: params.ruler_column[i],
|
70 |
+
lineStyle: params.ruler_linestyle[i % params.ruler_linestyle.length]
|
71 |
+
});
|
72 |
+
}
|
73 |
+
console.debug(log_prefix, 'ruler specs:', rulers);
|
74 |
+
|
75 |
+
if (Jupyter.notebook !== undefined) {
|
76 |
+
var i, config = Jupyter.notebook.config;
|
77 |
+
|
78 |
+
// Change default for new cells
|
79 |
+
codecell.CodeCell.options_default.cm_config.rulers = rulers;
|
80 |
+
// Apply to any already-existing cells
|
81 |
+
var cells = Jupyter.notebook.get_cells().forEach(function (cell) {
|
82 |
+
if (cell instanceof codecell.CodeCell) {
|
83 |
+
cell.code_mirror.setOption('rulers', rulers);
|
84 |
+
}
|
85 |
+
});
|
86 |
+
|
87 |
+
}
|
88 |
+
else {
|
89 |
+
Jupyter.editor.codemirror.setOption('rulers', rulers);
|
90 |
+
}
|
91 |
+
};
|
92 |
+
|
93 |
+
var load_extension = function () {
|
94 |
+
|
95 |
+
// first, check which view we're in, in order to decide whether to load
|
96 |
+
var conf_sect;
|
97 |
+
if (Jupyter.notebook) {
|
98 |
+
// we're in notebook view
|
99 |
+
conf_sect = Jupyter.notebook.config;
|
100 |
+
}
|
101 |
+
else if (Jupyter.editor) {
|
102 |
+
// we're in file-editor view
|
103 |
+
conf_sect = Jupyter.editor.config;
|
104 |
+
}
|
105 |
+
else {
|
106 |
+
// we're some other view like dashboard, terminal, etc, so bail now
|
107 |
+
return;
|
108 |
+
}
|
109 |
+
|
110 |
+
conf_sect.loaded
|
111 |
+
.then(function () {
|
112 |
+
update_params(conf_sect.data);
|
113 |
+
})
|
114 |
+
.then(on_config_loaded)
|
115 |
+
.catch(function on_error(reason) {
|
116 |
+
console.warn(log_prefix, 'error:', reason);
|
117 |
+
});
|
118 |
+
};
|
119 |
+
|
120 |
+
var extension = {
|
121 |
+
load_ipython_extension: load_extension
|
122 |
+
};
|
123 |
+
return extension;
|
124 |
+
});
|
.local/share/jupyter/nbextensions/runtools/demo.gif
ADDED
.local/share/jupyter/nbextensions/runtools/gutter.css
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
.CodeMirror-cellstate {
|
2 |
+
width: 0.5em;
|
3 |
+
}
|
.local/share/jupyter/nbextensions/runtools/main.js
ADDED
@@ -0,0 +1,745 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Extended code execution commands and more
|
2 |
+
|
3 |
+
define([
|
4 |
+
'base/js/namespace',
|
5 |
+
'jquery',
|
6 |
+
'require',
|
7 |
+
'base/js/events',
|
8 |
+
'services/config',
|
9 |
+
'base/js/utils',
|
10 |
+
'notebook/js/codecell'
|
11 |
+
], function(Jupyter, $, requirejs, events, configmod, utils, codecell) {
|
12 |
+
"use strict";
|
13 |
+
|
14 |
+
var run_list = []; /* list of cells to be run */
|
15 |
+
|
16 |
+
// define default config parameter values
|
17 |
+
var params = {
|
18 |
+
run_cells_above: 'Alt-a',
|
19 |
+
run_cells_below: 'Alt-b',
|
20 |
+
toggle_marker: 'Alt-t',
|
21 |
+
mark_all_codecells: 'Alt-m',
|
22 |
+
unmark_all_codecells: 'Alt-u',
|
23 |
+
run_marked_cells: 'Alt-r',
|
24 |
+
run_all_cells: 'Alt-x',
|
25 |
+
run_all_cells_ignore_errors: 'Alt-f',
|
26 |
+
stop_execution: 'Ctrl-c',
|
27 |
+
marked_color: '#20f224',
|
28 |
+
scheduled_color: '#00def0',
|
29 |
+
run_color: '#f30a2d'
|
30 |
+
};
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Add event if user clicks on codemirror gutter
|
34 |
+
*
|
35 |
+
*/
|
36 |
+
function add_gutter_events() {
|
37 |
+
var ncells = Jupyter.notebook.ncells();
|
38 |
+
var cells = Jupyter.notebook.get_cells();
|
39 |
+
for (var i = 0; i < ncells; i++) {
|
40 |
+
var cell = cells[i];
|
41 |
+
if ((cell.cell_type === "code")) {
|
42 |
+
cell.code_mirror.on("gutterClick", changeEvent);
|
43 |
+
if (is_marked(cell)) {
|
44 |
+
var g = cell.code_mirror.getGutterElement();
|
45 |
+
$(g).css({
|
46 |
+
"background-color": params.marked_color
|
47 |
+
});
|
48 |
+
}
|
49 |
+
}
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
/*
|
54 |
+
* Initialize toolbar and gutter after config was loaded
|
55 |
+
*/
|
56 |
+
function initialize() {
|
57 |
+
$.extend(true, params, Jupyter.notebook.config.data.runtools);
|
58 |
+
|
59 |
+
add_gutter_events();
|
60 |
+
|
61 |
+
/* Add run control buttons to toolbar */
|
62 |
+
$(Jupyter.toolbar.add_buttons_group([
|
63 |
+
Jupyter.keyboard_manager.actions.register ({
|
64 |
+
help: 'Toggle Runtools Toolbar',
|
65 |
+
icon: 'fa-cogs',
|
66 |
+
handler: toggle_toolbar
|
67 |
+
}, 'toggle-runtools-toolbar', 'runtools')
|
68 |
+
])).find('.btn').attr('id', 'toggle_runtools').css({
|
69 |
+
'outline': 'none'
|
70 |
+
});
|
71 |
+
|
72 |
+
/* Add keyboard shortcuts */
|
73 |
+
var add_command_shortcuts = {};
|
74 |
+
add_command_shortcuts[params["run_cells_above"]] = {
|
75 |
+
help: 'Run cells above',
|
76 |
+
help_index: 'xa',
|
77 |
+
handler: function() {
|
78 |
+
execute_cells_above();
|
79 |
+
return false;
|
80 |
+
}
|
81 |
+
};
|
82 |
+
add_command_shortcuts[params["run_cells_below"]] = {
|
83 |
+
help: 'Run cells below',
|
84 |
+
help_index: 'aa',
|
85 |
+
handler: function() {
|
86 |
+
execute_cells_below();
|
87 |
+
return false;
|
88 |
+
}
|
89 |
+
};
|
90 |
+
add_command_shortcuts[params["toggle_marker"]] = {
|
91 |
+
help: 'Toggle marker',
|
92 |
+
help_index: 'mt',
|
93 |
+
handler: function() {
|
94 |
+
toggle_marker();
|
95 |
+
return false;
|
96 |
+
}
|
97 |
+
};
|
98 |
+
add_command_shortcuts[params["mark_all_codecells"]] = {
|
99 |
+
help: 'Mark all codecells',
|
100 |
+
help_index: 'ma',
|
101 |
+
handler: function() {
|
102 |
+
mark_all();
|
103 |
+
return false;
|
104 |
+
}
|
105 |
+
};
|
106 |
+
add_command_shortcuts[params["unmark_all_codecells"]] = {
|
107 |
+
help: 'Unmark all codecells',
|
108 |
+
help_index: 'mu',
|
109 |
+
handler: function() {
|
110 |
+
mark_none();
|
111 |
+
return false;
|
112 |
+
}
|
113 |
+
};
|
114 |
+
add_command_shortcuts[params["run_marked_cells"]] = {
|
115 |
+
help: 'Run marked cells',
|
116 |
+
help_index: 'rm',
|
117 |
+
handler: function() {
|
118 |
+
run_marked_cells();
|
119 |
+
return false;
|
120 |
+
}
|
121 |
+
};
|
122 |
+
add_command_shortcuts[params["run_all_cells"]] = {
|
123 |
+
help: 'Run all cells',
|
124 |
+
help_index: 'ra',
|
125 |
+
handler: function() {
|
126 |
+
var pos = Jupyter.notebook.element.scrollTop();
|
127 |
+
execute_all_cells();
|
128 |
+
Jupyter.notebook.element.animate({
|
129 |
+
scrollTop: pos
|
130 |
+
}, 100);
|
131 |
+
return false;
|
132 |
+
}
|
133 |
+
};
|
134 |
+
add_command_shortcuts[params["run_all_cells_ignore_errors"]] = {
|
135 |
+
help: 'Run all cells - ignore errors',
|
136 |
+
help_index: 'rf',
|
137 |
+
handler: function() {
|
138 |
+
run_all_cells_ignore_errors();
|
139 |
+
return false;
|
140 |
+
}
|
141 |
+
};
|
142 |
+
Jupyter.keyboard_manager.command_shortcuts.add_shortcuts(add_command_shortcuts);
|
143 |
+
Jupyter.keyboard_manager.edit_shortcuts.add_shortcuts(add_command_shortcuts);
|
144 |
+
|
145 |
+
events.on('finished_execute.CodeCell', finished_execute_event);
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Hide or show a cell
|
150 |
+
*
|
151 |
+
* @param cell
|
152 |
+
* @param io 'i' for cell input, 'o' for cell output
|
153 |
+
* @param showme {Boolean} show (true) or hide (false) cell
|
154 |
+
*/
|
155 |
+
function showCell(cell, io, showme) {
|
156 |
+
if (io === 'i') {
|
157 |
+
if (showme === true) {
|
158 |
+
cell.element.find("div.input").show();
|
159 |
+
cell.metadata.hide_input = false;
|
160 |
+
} else {
|
161 |
+
cell.element.find("div.input").hide();
|
162 |
+
cell.metadata.hide_input = true;
|
163 |
+
}
|
164 |
+
} else {
|
165 |
+
if (showme === true) {
|
166 |
+
cell.element.find('div.output').show();
|
167 |
+
cell.metadata.hide_output = false;
|
168 |
+
} else {
|
169 |
+
cell.element.find('div.output').hide();
|
170 |
+
cell.metadata.hide_output = true;
|
171 |
+
}
|
172 |
+
}
|
173 |
+
}
|
174 |
+
|
175 |
+
function _show_input_output_of_marked(show, char) {
|
176 |
+
var cells = Jupyter.notebook.get_cells();
|
177 |
+
var ncells = cells.length;
|
178 |
+
for (var i = 0; i < ncells; i++) {
|
179 |
+
var _cell = cells[i];
|
180 |
+
if (is_marked(_cell))
|
181 |
+
showCell(_cell, char, show);
|
182 |
+
}
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Hide or show input of all marked code cells
|
187 |
+
*
|
188 |
+
* @param show {Boolean} show (true) or hide (false) code cells
|
189 |
+
*/
|
190 |
+
function show_input(show) {
|
191 |
+
_show_input_output_of_marked(show, 'i');
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Hide or show output area of all marked code cells
|
196 |
+
*
|
197 |
+
* @param {Boolean} show show (true) or hide (false)
|
198 |
+
*/
|
199 |
+
function show_output(show) {
|
200 |
+
_show_input_output_of_marked(show, 'o');
|
201 |
+
}
|
202 |
+
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Execute next cell in run list, if it is still marked
|
206 |
+
*
|
207 |
+
*/
|
208 |
+
function execute_next_marked_cell() {
|
209 |
+
var cells = Jupyter.notebook.get_cells();
|
210 |
+
var end = cells.length;
|
211 |
+
while (run_list.length > 0) {
|
212 |
+
var runcell = run_list.shift();
|
213 |
+
for (var i = 0; i < end; i++) {
|
214 |
+
if (runcell === cells[i]) {
|
215 |
+
if (runcell.metadata.run_control !== undefined && runcell.metadata.run_control.marked === true) {
|
216 |
+
var g = runcell.code_mirror.getGutterElement();
|
217 |
+
$(g).css({
|
218 |
+
"background-color": params.run_color
|
219 |
+
});
|
220 |
+
runcell.execute();
|
221 |
+
return;
|
222 |
+
}
|
223 |
+
}
|
224 |
+
}
|
225 |
+
}
|
226 |
+
}
|
227 |
+
|
228 |
+
function _execute_without_selecting(idx_start, idx_end, stop_on_error) {
|
229 |
+
// notebook.execute_cells alters selection, this doesn't
|
230 |
+
var cells = Jupyter.notebook.get_cells();
|
231 |
+
idx_start = idx_start !== undefined ? idx_start : 0;
|
232 |
+
idx_end = idx_end !== undefined ? idx_end : cells.length;
|
233 |
+
for (var ii = idx_start; ii < idx_end; ii++) {
|
234 |
+
cells[ii].execute(stop_on_error);
|
235 |
+
}
|
236 |
+
}
|
237 |
+
|
238 |
+
function execute_cells_above() {
|
239 |
+
_execute_without_selecting(0, Jupyter.notebook.get_selected_index());
|
240 |
+
}
|
241 |
+
|
242 |
+
function execute_cells_below() {
|
243 |
+
_execute_without_selecting(Jupyter.notebook.get_selected_index(), undefined);
|
244 |
+
}
|
245 |
+
|
246 |
+
function execute_all_cells(stop_on_error) {
|
247 |
+
_execute_without_selecting(0, undefined, stop_on_error);
|
248 |
+
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Run code cells marked in metadata
|
252 |
+
*
|
253 |
+
*/
|
254 |
+
function run_marked_cells() {
|
255 |
+
var cells = Jupyter.notebook.get_cells();
|
256 |
+
var end = cells.length;
|
257 |
+
run_list = [];
|
258 |
+
/* Show all marked cells as scheduled to be run with new gutter background color */
|
259 |
+
for (var i = 0; i < end; i++) {
|
260 |
+
var cell = cells[i];
|
261 |
+
if (cell instanceof codecell.CodeCell) {
|
262 |
+
var last_line = cell.code_mirror.lastLine();
|
263 |
+
var cell_empty = ( last_line === 0 && cell.code_mirror.getLine(last_line) === "");
|
264 |
+
if (cell.metadata.run_control !== undefined && cell_empty === false) {
|
265 |
+
if (cell.metadata.run_control.marked === true) {
|
266 |
+
var g = cell.code_mirror.getGutterElement();
|
267 |
+
$(g).css({
|
268 |
+
"background-color": params.scheduled_color
|
269 |
+
});
|
270 |
+
run_list.push(cell);
|
271 |
+
}
|
272 |
+
}
|
273 |
+
}
|
274 |
+
}
|
275 |
+
execute_next_marked_cell();
|
276 |
+
}
|
277 |
+
|
278 |
+
/*
|
279 |
+
* Execute next cell in run_list when notified execution of last cell has been finished
|
280 |
+
* @param evt Event
|
281 |
+
* @param data Cell that has finished executing
|
282 |
+
*/
|
283 |
+
var finished_execute_event = function(evt, data) {
|
284 |
+
var cell = data.cell;
|
285 |
+
/* Reset gutter color no non-queued state */
|
286 |
+
if (is_marked(cell)) {
|
287 |
+
var g = cell.code_mirror.getGutterElement();
|
288 |
+
$(g).css({
|
289 |
+
"background-color": params.marked_color
|
290 |
+
});
|
291 |
+
}
|
292 |
+
execute_next_marked_cell();
|
293 |
+
};
|
294 |
+
|
295 |
+
/**
|
296 |
+
*
|
297 |
+
* @param cell
|
298 |
+
* @param value
|
299 |
+
*/
|
300 |
+
function setCell(cell, value) {
|
301 |
+
if (!(cell instanceof codecell.CodeCell)) return;
|
302 |
+
if (cell.metadata.run_control === undefined) cell.metadata.run_control = {};
|
303 |
+
if (cell.metadata.run_control.marked === undefined) cell.metadata.run_control.marked = false;
|
304 |
+
if (value === undefined) value = !cell.metadata.run_control.marked;
|
305 |
+
var g = cell.code_mirror.getGutterElement();
|
306 |
+
if (value === false) {
|
307 |
+
cell.metadata.run_control.marked = false;
|
308 |
+
$(g).css({
|
309 |
+
"background-color": ""
|
310 |
+
});
|
311 |
+
} else {
|
312 |
+
cell.metadata.run_control.marked = true;
|
313 |
+
$(g).css({
|
314 |
+
"background-color": params.marked_color
|
315 |
+
});
|
316 |
+
}
|
317 |
+
}
|
318 |
+
|
319 |
+
function setCellsMarked(cells, value) {
|
320 |
+
var ncells = cells.length;
|
321 |
+
for (var i = 0; i < ncells; i++) {
|
322 |
+
setCell(cells[i], value);
|
323 |
+
}
|
324 |
+
}
|
325 |
+
|
326 |
+
/**
|
327 |
+
* Toggle code cell marker
|
328 |
+
*/
|
329 |
+
function toggle_marker() {
|
330 |
+
setCellsMarked(Jupyter.notebook.get_selected_cells(), undefined);
|
331 |
+
}
|
332 |
+
|
333 |
+
/**
|
334 |
+
*
|
335 |
+
*/
|
336 |
+
function mark_all() {
|
337 |
+
setCellsMarked(Jupyter.notebook.get_cells(), true);
|
338 |
+
}
|
339 |
+
|
340 |
+
/**
|
341 |
+
*
|
342 |
+
*/
|
343 |
+
function mark_none() {
|
344 |
+
setCellsMarked(Jupyter.notebook.get_cells(), false);
|
345 |
+
}
|
346 |
+
|
347 |
+
/**
|
348 |
+
*
|
349 |
+
* @param cell notebook cell instance
|
350 |
+
* @param state {string} state to be display [ '', 'locked', 'executed', 'modified' ]
|
351 |
+
*/
|
352 |
+
function set_cell_state(cell, state) {
|
353 |
+
var icon = "";
|
354 |
+
if (state === 'locked') {
|
355 |
+
icon = '<div class="fa fa-lock" style="font-size:70%;" /div>'
|
356 |
+
}
|
357 |
+
cell.code_mirror.setGutterMarker(0, "CodeMirror-cellstate", celltypeMarker(icon))
|
358 |
+
}
|
359 |
+
|
360 |
+
/**
|
361 |
+
* Change event to mark/unmark cell
|
362 |
+
*
|
363 |
+
* @param cm codemirror instance
|
364 |
+
* @param line current line
|
365 |
+
* @param gutter not used
|
366 |
+
*/
|
367 |
+
function changeEvent(cm, line, gutter) {
|
368 |
+
if (gutter === "CodeMirror-foldgutter") return; /* Don't collide with codefolding extension */
|
369 |
+
|
370 |
+
var cmline = cm.doc.children[0].lines[line];
|
371 |
+
if (cmline === undefined) {
|
372 |
+
return;
|
373 |
+
}
|
374 |
+
var cell = $(cm.display.gutters).closest('.cell').data('cell');
|
375 |
+
if (cell.metadata.run_control === undefined)
|
376 |
+
cell.metadata.run_control = {};
|
377 |
+
setCell(cell, !cell.metadata.run_control.marked);
|
378 |
+
}
|
379 |
+
|
380 |
+
/**
|
381 |
+
*
|
382 |
+
* @param cell cell to be tested
|
383 |
+
* @returns {boolean} true if marked
|
384 |
+
*/
|
385 |
+
var is_marked = function(cell) {
|
386 |
+
return (cell instanceof codecell.CodeCell) &&
|
387 |
+
cell.metadata.run_control !== undefined &&
|
388 |
+
cell.metadata.run_control.marked;
|
389 |
+
};
|
390 |
+
|
391 |
+
/**
|
392 |
+
* Return div element to set in cellstate gutter
|
393 |
+
*
|
394 |
+
* @param val HTML string
|
395 |
+
* @returns {Element} div Element
|
396 |
+
*/
|
397 |
+
function celltypeMarker(val) {
|
398 |
+
var marker = document.createElement("div");
|
399 |
+
marker.style.color = "#822";
|
400 |
+
marker.innerHTML = val;
|
401 |
+
return marker;
|
402 |
+
}
|
403 |
+
|
404 |
+
/**
|
405 |
+
* Lock/Unlock current code cell
|
406 |
+
* if (cell.metadata.run_control != undefined && cell.metadata.run_control.read_only) {
|
407 |
+
* cell.code_mirror.setOption('readOnly', cell.metadata.run_control.read_only);
|
408 |
+
*/
|
409 |
+
var lock_cell = function(locked) {
|
410 |
+
var ncells = Jupyter.notebook.ncells();
|
411 |
+
for (var i = ncells - 2; i >= 0; i--) {
|
412 |
+
var cells = Jupyter.notebook.get_cells();
|
413 |
+
if ((cells[i].cell_type === "code") && is_marked(cells[i])) {
|
414 |
+
if (locked === true) {
|
415 |
+
cells[i].metadata.editable = false;
|
416 |
+
set_cell_state(cells[i], 'locked')
|
417 |
+
} else {
|
418 |
+
cells[i].metadata.editable = true;
|
419 |
+
set_cell_state(cells[i], '')
|
420 |
+
}
|
421 |
+
}
|
422 |
+
}
|
423 |
+
};
|
424 |
+
|
425 |
+
/**
|
426 |
+
* Execute all cells and don't stop on errors
|
427 |
+
*
|
428 |
+
*/
|
429 |
+
var run_all_cells_ignore_errors = function() {
|
430 |
+
execute_all_cells(false);
|
431 |
+
};
|
432 |
+
|
433 |
+
/**
|
434 |
+
* Create floating toolbar
|
435 |
+
*
|
436 |
+
*/
|
437 |
+
var create_runtools_div = function() {
|
438 |
+
var btn = '<div class="btn-toolbar">\
|
439 |
+
<div class="btn-group">\
|
440 |
+
<button type="button" id="run_c" class="btn-primary fa fa-step-forward" title="Run current cell"></button>\
|
441 |
+
<button type="button" id="run_ca" class="btn-primary fa icon-run-to" title="' +
|
442 |
+
'Run cells above (' + params["run_cells_above"] + ')"</button>\
|
443 |
+
<button type="button" id="run_cb" class="btn-primary fa icon-run-from" title="' +
|
444 |
+
'Run cells below (' + params["run_cells_below"] + ')"</button>\
|
445 |
+
<button type="button" id="run_a" class="btn-primary fa icon-run-all" title="' +
|
446 |
+
'Run all cells (' + params["run_all_cells"] + ')"</button>\
|
447 |
+
<button type="button" id="run_af" class="btn-primary fa icon-run-all-forced" title="' +
|
448 |
+
'Run all - ignore errors (' + params["run_all_cells_ignore_errors"] + ')"</button>\
|
449 |
+
<button type="button" id="run_m" class="btn-primary fa icon-run-marked" title="' +
|
450 |
+
'Run marked codecells (' + params["run_marked_cells"] + ')"</button>\
|
451 |
+
<button type="button" id="interrupt_b" class="btn-primary fa fa-stop" title="' +
|
452 |
+
'Stop execution (' + params["stop_execution"] + ')"</button>\
|
453 |
+
</div>\
|
454 |
+
<div class="btn-group">\
|
455 |
+
<button type="button" id="mark_toggle" class="btn-primary fa icon-mark-toggle" title="Mark single code cell"></button>\
|
456 |
+
<button type="button" id="mark_all" class="btn-primary fa icon-mark-all" title="Mark all code cells"></button>\
|
457 |
+
<button type="button" id="mark_none" class="btn-primary fa icon-mark-none" title="Unmark all code cells"></button>\
|
458 |
+
</div>\
|
459 |
+
<div class="btn-group">\
|
460 |
+
<button type="button" id="show_input" class="btn-primary fa icon-show-input" title="Show input of code cell"></button>\
|
461 |
+
<button type="button" id="hide_input" class="btn-primary fa icon-hide-input" title="Hide input of code cell"></button>\
|
462 |
+
<button type="button" id="show_output" class="btn-primary fa icon-show-output" title="Show output of code cell"></button>\
|
463 |
+
<button type="button" id="hide_output" class="btn-primary fa icon-hide-output" title="Hide output of code cell"></button>\
|
464 |
+
<button type="button" id="lock_marked" class="btn-primary fa fa-lock" title="Lock marked cells"></button>\
|
465 |
+
<button type="button" id="unlock_marked" class="btn-primary fa fa-unlock" title="Unlock marked cells"></button>\
|
466 |
+
</div>\
|
467 |
+
</div>';
|
468 |
+
|
469 |
+
var runtools_wrapper = $('<div id="runtools-wrapper">')
|
470 |
+
.text("Runtools")
|
471 |
+
.append(btn)
|
472 |
+
.draggable()
|
473 |
+
.append("</div>");
|
474 |
+
|
475 |
+
$("#header").append(runtools_wrapper);
|
476 |
+
$("#runtools-wrapper").css({
|
477 |
+
'position': 'absolute'
|
478 |
+
});
|
479 |
+
$('#run_c').on('click', function(e) {
|
480 |
+
var idx = Jupyter.notebook.get_selected_index();
|
481 |
+
_execute_without_selecting(idx, idx + 1);
|
482 |
+
e.target.blur();
|
483 |
+
})
|
484 |
+
.tooltip({
|
485 |
+
delay: {
|
486 |
+
show: 500,
|
487 |
+
hide: 100
|
488 |
+
}
|
489 |
+
});
|
490 |
+
$('#run_ca').on('click', function(e) {
|
491 |
+
execute_cells_above();
|
492 |
+
e.target.blur();
|
493 |
+
})
|
494 |
+
.tooltip({
|
495 |
+
delay: {
|
496 |
+
show: 500,
|
497 |
+
hide: 100
|
498 |
+
}
|
499 |
+
});
|
500 |
+
$('#run_cb').on('click', function(e) {
|
501 |
+
execute_cells_below();
|
502 |
+
e.target.blur();
|
503 |
+
})
|
504 |
+
.tooltip({
|
505 |
+
delay: {
|
506 |
+
show: 500,
|
507 |
+
hide: 100
|
508 |
+
}
|
509 |
+
});
|
510 |
+
$('#run_a').on('click', function(e) {
|
511 |
+
execute_all_cells();
|
512 |
+
e.target.blur();
|
513 |
+
})
|
514 |
+
.tooltip({
|
515 |
+
delay: {
|
516 |
+
show: 500,
|
517 |
+
hide: 100
|
518 |
+
}
|
519 |
+
});
|
520 |
+
$('#run_af').on('click', function(e) {
|
521 |
+
run_all_cells_ignore_errors();
|
522 |
+
e.target.blur()
|
523 |
+
})
|
524 |
+
.tooltip({
|
525 |
+
delay: {
|
526 |
+
show: 500,
|
527 |
+
hide: 100
|
528 |
+
}
|
529 |
+
});
|
530 |
+
$('#run_m').on('click', function(e) {
|
531 |
+
run_marked_cells();
|
532 |
+
e.target.blur()
|
533 |
+
})
|
534 |
+
.tooltip({
|
535 |
+
delay: {
|
536 |
+
show: 500,
|
537 |
+
hide: 100
|
538 |
+
}
|
539 |
+
});
|
540 |
+
$('#interrupt_b').on('click', function(e) {
|
541 |
+
interrupt_execution();
|
542 |
+
e.target.blur()
|
543 |
+
})
|
544 |
+
.tooltip({
|
545 |
+
delay: {
|
546 |
+
show: 500,
|
547 |
+
hide: 100
|
548 |
+
}
|
549 |
+
});
|
550 |
+
$('#mark_toggle').on('click', function() {
|
551 |
+
toggle_marker()
|
552 |
+
})
|
553 |
+
.tooltip({
|
554 |
+
delay: {
|
555 |
+
show: 500,
|
556 |
+
hide: 100
|
557 |
+
}
|
558 |
+
});
|
559 |
+
$('#mark_all').on('click', function() {
|
560 |
+
mark_all()
|
561 |
+
})
|
562 |
+
.tooltip({
|
563 |
+
delay: {
|
564 |
+
show: 500,
|
565 |
+
hide: 100
|
566 |
+
}
|
567 |
+
});
|
568 |
+
$('#mark_none').on('click', function() {
|
569 |
+
mark_none()
|
570 |
+
})
|
571 |
+
.tooltip({
|
572 |
+
delay: {
|
573 |
+
show: 500,
|
574 |
+
hide: 100
|
575 |
+
}
|
576 |
+
});
|
577 |
+
$('#show_input').on('click', function() {
|
578 |
+
show_input(true);
|
579 |
+
this.blur()
|
580 |
+
})
|
581 |
+
.tooltip({
|
582 |
+
delay: {
|
583 |
+
show: 500,
|
584 |
+
hide: 100
|
585 |
+
}
|
586 |
+
});
|
587 |
+
$('#hide_input').on('click', function() {
|
588 |
+
show_input(false);
|
589 |
+
this.blur()
|
590 |
+
})
|
591 |
+
.tooltip({
|
592 |
+
delay: {
|
593 |
+
show: 500,
|
594 |
+
hide: 100
|
595 |
+
}
|
596 |
+
});
|
597 |
+
$('#show_output').on('click', function() {
|
598 |
+
show_output(true);
|
599 |
+
this.blur()
|
600 |
+
})
|
601 |
+
.tooltip({
|
602 |
+
delay: {
|
603 |
+
show: 500,
|
604 |
+
hide: 100
|
605 |
+
}
|
606 |
+
});
|
607 |
+
$('#hide_output').on('click', function() {
|
608 |
+
show_output(false);
|
609 |
+
this.blur()
|
610 |
+
})
|
611 |
+
.tooltip({
|
612 |
+
delay: {
|
613 |
+
show: 500,
|
614 |
+
hide: 100
|
615 |
+
}
|
616 |
+
});
|
617 |
+
$('#lock_marked').on('click', function() {
|
618 |
+
lock_cell(true);
|
619 |
+
this.blur()
|
620 |
+
})
|
621 |
+
.tooltip({
|
622 |
+
delay: {
|
623 |
+
show: 500,
|
624 |
+
hide: 100
|
625 |
+
}
|
626 |
+
});
|
627 |
+
$('#unlock_marked').on('click', function() {
|
628 |
+
lock_cell(false);
|
629 |
+
this.blur()
|
630 |
+
})
|
631 |
+
.tooltip({
|
632 |
+
delay: {
|
633 |
+
show: 500,
|
634 |
+
hide: 100
|
635 |
+
}
|
636 |
+
});
|
637 |
+
};
|
638 |
+
|
639 |
+
/**
|
640 |
+
* Show/hide toolbar
|
641 |
+
*
|
642 |
+
*/
|
643 |
+
var toggle_toolbar = function() {
|
644 |
+
var dom = $("#runtools-wrapper");
|
645 |
+
|
646 |
+
if (dom.is(':visible')) {
|
647 |
+
$('#toggle_runtools').removeClass('active').blur();
|
648 |
+
dom.hide();
|
649 |
+
} else {
|
650 |
+
$('#toggle_runtools').addClass('active');
|
651 |
+
dom.show();
|
652 |
+
}
|
653 |
+
|
654 |
+
if (dom.length === 0) {
|
655 |
+
create_runtools_div()
|
656 |
+
}
|
657 |
+
};
|
658 |
+
|
659 |
+
|
660 |
+
/**
|
661 |
+
* Add CSS file
|
662 |
+
*
|
663 |
+
* @param name filename
|
664 |
+
*/
|
665 |
+
var load_css = function(name) {
|
666 |
+
var link = document.createElement("link");
|
667 |
+
link.type = "text/css";
|
668 |
+
link.rel = "stylesheet";
|
669 |
+
link.href = requirejs.toUrl(name);
|
670 |
+
document.getElementsByTagName("head")[0].appendChild(link);
|
671 |
+
};
|
672 |
+
|
673 |
+
/**
|
674 |
+
* Add gutter to a new cell
|
675 |
+
*
|
676 |
+
* @param event
|
677 |
+
* @param nbcell
|
678 |
+
*
|
679 |
+
*/
|
680 |
+
var createCell = function(event, nbcell) {
|
681 |
+
var cell = nbcell.cell;
|
682 |
+
if (cell instanceof codecell.CodeCell) {
|
683 |
+
var gutters = cell.code_mirror.getOption('gutters').slice();
|
684 |
+
if ($.inArray("CodeMirror-cellstate", gutters) < 0) {
|
685 |
+
gutters.push('CodeMirror-cellstate');
|
686 |
+
cell.code_mirror.setOption('gutters', gutters);
|
687 |
+
cell.code_mirror.on("gutterClick", changeEvent);
|
688 |
+
|
689 |
+
}
|
690 |
+
}
|
691 |
+
};
|
692 |
+
|
693 |
+
|
694 |
+
/**
|
695 |
+
* Initialize all cells with new gutter
|
696 |
+
*/
|
697 |
+
var initGutter = function() {
|
698 |
+
var cells = Jupyter.notebook.get_cells();
|
699 |
+
var ncells = cells.length;
|
700 |
+
for (var i = 0; i < ncells; i++) {
|
701 |
+
var cell = cells[i];
|
702 |
+
if (cell instanceof codecell.CodeCell) {
|
703 |
+
var gutters = cell.code_mirror.getOption('gutters').slice();
|
704 |
+
if ($.inArray("CodeMirror-cellstate", gutters) < 0) {
|
705 |
+
gutters.push('CodeMirror-cellstate');
|
706 |
+
cell.code_mirror.setOption('gutters', gutters);
|
707 |
+
}
|
708 |
+
}
|
709 |
+
/**
|
710 |
+
* Restore hide/show status after reload
|
711 |
+
*/
|
712 |
+
if (cell.metadata.hasOwnProperty('hide_input') && cell.metadata.hide_input === true)
|
713 |
+
showCell(cell, 'i', false);
|
714 |
+
if (cell.metadata.hasOwnProperty('hide_output') && cell.metadata.hide_output === true)
|
715 |
+
showCell(cell, 'o', false);
|
716 |
+
if (cell.is_editable() === false) {
|
717 |
+
set_cell_state(cell, 'locked');
|
718 |
+
}
|
719 |
+
cell.code_mirror.refresh();
|
720 |
+
}
|
721 |
+
events.on('create.Cell', createCell);
|
722 |
+
};
|
723 |
+
|
724 |
+
/**
|
725 |
+
* Called from notebook after extension was loaded
|
726 |
+
*
|
727 |
+
*/
|
728 |
+
var load_extension = function() {
|
729 |
+
load_css('./main.css');
|
730 |
+
load_css('./gutter.css'); /* set gutter width */
|
731 |
+
requirejs(['./cellstate'], function() {
|
732 |
+
if (Jupyter.notebook._fully_loaded) {
|
733 |
+
initGutter();
|
734 |
+
} else {
|
735 |
+
events.one('notebook_loaded.Notebook', initGutter);
|
736 |
+
}
|
737 |
+
});
|
738 |
+
Jupyter.notebook.config.loaded.then(initialize);
|
739 |
+
};
|
740 |
+
|
741 |
+
return {
|
742 |
+
load_jupyter_extension: load_extension,
|
743 |
+
load_ipython_extension: load_extension
|
744 |
+
};
|
745 |
+
});
|
.local/share/jupyter/nbextensions/runtools/runtools.yaml
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Type: IPython Notebook Extension
|
2 |
+
Name: Runtools
|
3 |
+
Description: Runtools provide a number of additional functions for working with code cells in the IPython notebook
|
4 |
+
Link: readme.md
|
5 |
+
Icon: icon.png
|
6 |
+
Main: main.js
|
7 |
+
Compatibility: 5.x
|
8 |
+
Parameters:
|
9 |
+
- name: runtools.run_cells_above
|
10 |
+
description: run cells above
|
11 |
+
input_type: hotkey
|
12 |
+
default: Alt-a
|
13 |
+
- name: runtools.run_cells_below
|
14 |
+
description: run cells below
|
15 |
+
input_type: hotkey
|
16 |
+
default: Alt-b
|
17 |
+
- name: runtools.toggle_marker
|
18 |
+
description: Toggle marker
|
19 |
+
input_type: hotkey
|
20 |
+
default: Alt-t
|
21 |
+
- name: runtools.mark_all_codecells
|
22 |
+
description: Mark all codecells
|
23 |
+
input_type: hotkey
|
24 |
+
default: Alt-m
|
25 |
+
- name: runtools.unmark_all_codecells
|
26 |
+
description: Unmark all codecells
|
27 |
+
input_type: hotkey
|
28 |
+
default: Alt-u
|
29 |
+
- name: runtools.run_marked_cells
|
30 |
+
description: run marked cells
|
31 |
+
input_type: hotkey
|
32 |
+
default: Alt-r
|
33 |
+
- name: runtools.stop_execution
|
34 |
+
description: stop execution
|
35 |
+
input_type: hotkey
|
36 |
+
default: Ctrl-c
|
37 |
+
- name: runtools.run_all_cells
|
38 |
+
description: run all cells
|
39 |
+
input_type: hotkey
|
40 |
+
default: Alt-x
|
41 |
+
- name: runtools.run_alls_cells_ignore_errors
|
42 |
+
description: run all cells - ignore errors
|
43 |
+
input_type: hotkey
|
44 |
+
default: Alt-f
|
45 |
+
- name: runtools.marked_color
|
46 |
+
description: |
|
47 |
+
Color for marking a codecell
|
48 |
+
default: '#20f224'
|
49 |
+
input_type: color
|
50 |
+
- name: runtools.scheduled_color
|
51 |
+
description: |
|
52 |
+
Color when a codecell is scheduled to be rund
|
53 |
+
default: '#00def0'
|
54 |
+
input_type: color
|
55 |
+
- name: runtools.run_color
|
56 |
+
description: |
|
57 |
+
Color while a codecell is being run
|
58 |
+
default: '#f30a2d'
|
59 |
+
input_type: color
|
.local/share/jupyter/nbextensions/runtools/runtools_execute.png
ADDED
.local/share/jupyter/nbextensions/runtools/runtools_lock.png
ADDED
.local/share/jupyter/nbextensions/runtools/runtools_nb.png
ADDED
.local/share/jupyter/nbextensions/runtools/runtools_show_hide.png
ADDED
.local/share/jupyter/nbextensions/scratchpad/LICENSE
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Copyright (c) 2016, Min RK
|
2 |
+
All rights reserved.
|
3 |
+
|
4 |
+
Redistribution and use in source and binary forms, with or without
|
5 |
+
modification, are permitted provided that the following conditions are met:
|
6 |
+
|
7 |
+
* Redistributions of source code must retain the above copyright notice, this
|
8 |
+
list of conditions and the following disclaimer.
|
9 |
+
|
10 |
+
* Redistributions in binary form must reproduce the above copyright notice,
|
11 |
+
this list of conditions and the following disclaimer in the documentation
|
12 |
+
and/or other materials provided with the distribution.
|
13 |
+
|
14 |
+
* Neither the name of nbextension-scratchpad nor the names of its
|
15 |
+
contributors may be used to endorse or promote products derived from
|
16 |
+
this software without specific prior written permission.
|
17 |
+
|
18 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
19 |
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
20 |
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
21 |
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
22 |
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
23 |
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
24 |
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
25 |
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
26 |
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
27 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
.local/share/jupyter/nbextensions/scratchpad/README.md
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Scratchpad notebook extension
|
2 |
+
|
3 |
+
Adds a scratchpad cell to Jupyter notebook.
|
4 |
+
This is a cell in which you can execute code against the current kernel without modifying the notebook document.
|
5 |
+
|
6 |
+
Scratchpad cells can be executed using `Shift-Enter` (other shortcuts are appled to the notebook document). The scratchpad can be toggled by clicking the icon in the bottom-right, or via the keyboard shortcut `Ctrl-B`.
|
7 |
+
|
8 |
+
![demo](demo.gif)
|
9 |
+
|
10 |
+
|
11 |
+
## Credits
|
12 |
+
|
13 |
+
This extension is a copy of the extension from MinRK here:
|
14 |
+
`git clone git://github.com/minrk/nbextension-scratchpad`.
|
.local/share/jupyter/nbextensions/scratchpad/main.js
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
define([
|
2 |
+
'require',
|
3 |
+
'jquery',
|
4 |
+
'base/js/namespace',
|
5 |
+
'base/js/events',
|
6 |
+
'base/js/utils',
|
7 |
+
'notebook/js/codecell',
|
8 |
+
], function (
|
9 |
+
requirejs,
|
10 |
+
$,
|
11 |
+
Jupyter,
|
12 |
+
events,
|
13 |
+
utils,
|
14 |
+
codecell
|
15 |
+
) {
|
16 |
+
"use strict";
|
17 |
+
var CodeCell = codecell.CodeCell;
|
18 |
+
|
19 |
+
var Scratchpad = function (nb) {
|
20 |
+
var scratchpad = this;
|
21 |
+
this.notebook = nb;
|
22 |
+
this.kernel = nb.kernel;
|
23 |
+
this.km = nb.keyboard_manager;
|
24 |
+
this.collapsed = true;
|
25 |
+
|
26 |
+
// create elements
|
27 |
+
this.element = $("<div id='nbextension-scratchpad'>");
|
28 |
+
this.close_button = $("<i>").addClass("fa fa-caret-square-o-down scratchpad-btn scratchpad-close");
|
29 |
+
this.open_button = $("<i>").addClass("fa fa-caret-square-o-up scratchpad-btn scratchpad-open");
|
30 |
+
this.element.append(this.close_button);
|
31 |
+
this.element.append(this.open_button);
|
32 |
+
this.open_button.click(function () {
|
33 |
+
scratchpad.expand();
|
34 |
+
});
|
35 |
+
this.close_button.click(function () {
|
36 |
+
scratchpad.collapse();
|
37 |
+
});
|
38 |
+
|
39 |
+
// create my cell
|
40 |
+
var cell = this.cell = new CodeCell(nb.kernel, {
|
41 |
+
events: nb.events,
|
42 |
+
config: nb.config,
|
43 |
+
keyboard_manager: nb.keyboard_manager,
|
44 |
+
notebook: nb,
|
45 |
+
tooltip: nb.tooltip,
|
46 |
+
});
|
47 |
+
cell.set_input_prompt();
|
48 |
+
this.element.append($("<div/>").addClass('cell-wrapper').append(this.cell.element));
|
49 |
+
cell.render();
|
50 |
+
cell.refresh();
|
51 |
+
this.collapse();
|
52 |
+
|
53 |
+
// override ctrl/shift-enter to execute me if I'm focused instead of the notebook's cell
|
54 |
+
var execute_and_select_action = this.km.actions.register({
|
55 |
+
handler: $.proxy(this.execute_and_select_event, this),
|
56 |
+
}, 'scratchpad-execute-and-select');
|
57 |
+
var execute_action = this.km.actions.register({
|
58 |
+
handler: $.proxy(this.execute_event, this),
|
59 |
+
}, 'scratchpad-execute');
|
60 |
+
var toggle_action = this.km.actions.register({
|
61 |
+
handler: $.proxy(this.toggle, this),
|
62 |
+
}, 'scratchpad-toggle');
|
63 |
+
|
64 |
+
var shortcuts = {
|
65 |
+
'shift-enter': execute_and_select_action,
|
66 |
+
'ctrl-enter': execute_action,
|
67 |
+
'ctrl-b': toggle_action,
|
68 |
+
}
|
69 |
+
this.km.edit_shortcuts.add_shortcuts(shortcuts);
|
70 |
+
this.km.command_shortcuts.add_shortcuts(shortcuts);
|
71 |
+
|
72 |
+
// finally, add me to the page
|
73 |
+
$("body").append(this.element);
|
74 |
+
};
|
75 |
+
|
76 |
+
Scratchpad.prototype.toggle = function () {
|
77 |
+
if (this.collapsed) {
|
78 |
+
this.expand();
|
79 |
+
} else {
|
80 |
+
this.collapse();
|
81 |
+
}
|
82 |
+
return false;
|
83 |
+
};
|
84 |
+
|
85 |
+
Scratchpad.prototype.expand = function () {
|
86 |
+
this.collapsed = false;
|
87 |
+
var site_height = $("#site").height();
|
88 |
+
this.element.animate({
|
89 |
+
height: site_height,
|
90 |
+
}, 200);
|
91 |
+
this.open_button.hide();
|
92 |
+
this.close_button.show();
|
93 |
+
this.cell.element.show();
|
94 |
+
this.cell.focus_editor();
|
95 |
+
//$("#notebook-container").css('margin-left', 0);
|
96 |
+
};
|
97 |
+
|
98 |
+
Scratchpad.prototype.collapse = function () {
|
99 |
+
this.collapsed = true;
|
100 |
+
//$("#notebook-container").css('margin-left', 'auto');
|
101 |
+
this.element.animate({
|
102 |
+
height: 0,
|
103 |
+
}, 100);
|
104 |
+
this.close_button.hide();
|
105 |
+
this.open_button.show();
|
106 |
+
this.cell.element.hide();
|
107 |
+
};
|
108 |
+
|
109 |
+
Scratchpad.prototype.execute_and_select_event = function (evt) {
|
110 |
+
if (utils.is_focused(this.element)) {
|
111 |
+
this.cell.execute();
|
112 |
+
} else {
|
113 |
+
this.notebook.execute_cell_and_select_below();
|
114 |
+
}
|
115 |
+
};
|
116 |
+
|
117 |
+
Scratchpad.prototype.execute_event = function (evt) {
|
118 |
+
if (utils.is_focused(this.element)) {
|
119 |
+
this.cell.execute();
|
120 |
+
} else {
|
121 |
+
this.notebook.execute_selected_cells();
|
122 |
+
}
|
123 |
+
};
|
124 |
+
|
125 |
+
function setup_scratchpad () {
|
126 |
+
// lazy, hook it up to Jupyter.notebook as the handle on all the singletons
|
127 |
+
console.log("Setting up scratchpad");
|
128 |
+
return new Scratchpad(Jupyter.notebook);
|
129 |
+
}
|
130 |
+
|
131 |
+
function load_extension () {
|
132 |
+
// add css
|
133 |
+
var link = document.createElement("link");
|
134 |
+
link.type = "text/css";
|
135 |
+
link.rel = "stylesheet";
|
136 |
+
link.href = requirejs.toUrl("./scratchpad.css");
|
137 |
+
document.getElementsByTagName("head")[0].appendChild(link);
|
138 |
+
// load when the kernel's ready
|
139 |
+
if (Jupyter.notebook.kernel) {
|
140 |
+
setup_scratchpad();
|
141 |
+
} else {
|
142 |
+
events.on('kernel_ready.Kernel', setup_scratchpad);
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
return {
|
147 |
+
load_ipython_extension: load_extension,
|
148 |
+
};
|
149 |
+
});
|
.local/share/jupyter/nbextensions/scroll_down/config.yaml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Type: IPython Notebook Extension
|
2 |
+
Name: ScrollDown
|
3 |
+
Description: Scroll outputs down automatically
|
4 |
+
Link: readme.md
|
5 |
+
Icon: icon.png
|
6 |
+
Main: main.js
|
7 |
+
Compatibility: 4.x, 5.x
|
8 |
+
Parameters:
|
9 |
+
- name: scrollDownIsEnabled
|
10 |
+
description: enable scroll_down toolbar button
|
11 |
+
input_type: checkbox
|
12 |
+
default: false
|
.local/share/jupyter/nbextensions/select_keymap/select_keymap.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Type: Jupyter Notebook Extension
|
2 |
+
Name: Select CodeMirror Keymap
|
3 |
+
Link: README.md
|
4 |
+
Description: "A little extension to choose between CodeMirror keymaps: default, emacs, vim, and sublime"
|
5 |
+
Main: main.js
|
6 |
+
Compatibility: 4.x, 5.x
|
7 |
+
Parameters:
|
8 |
+
- name: select_keymap_line_wrap
|
9 |
+
description: Enable line wrap in CodeMirror
|
10 |
+
input_type: checkbox
|
11 |
+
default: true
|
12 |
+
- name: select_keymap_local_storage
|
13 |
+
description: Store keymap selection on the client instead of server config
|
14 |
+
input_type: checkbox
|
15 |
+
default: true
|
.local/share/jupyter/nbextensions/skill/main.js
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
define(function() {
|
2 |
+
"use strict";
|
3 |
+
// jupyter nbextensions must export a load_ipython_extension function to
|
4 |
+
// avoid throwing an error. Also, loading the module should do nothing
|
5 |
+
// unless the function is called, so we wrap requiring the codemirror mode
|
6 |
+
// in the load call.
|
7 |
+
return {
|
8 |
+
load_ipython_extension: function () {
|
9 |
+
requirejs(['./skill'], function () {
|
10 |
+
console.log('[SKILL Syntax] loaded');
|
11 |
+
});
|
12 |
+
}
|
13 |
+
};
|
14 |
+
});
|
.local/share/jupyter/nbextensions/skill/skill.js
ADDED
The diff for this file is too large to render.
See raw diff
|
|
.local/share/jupyter/nbextensions/snippets/snippets.yaml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Type: IPython Notebook Extension
|
2 |
+
Compatibility: 4.x, 5.x
|
3 |
+
Name: Snippets
|
4 |
+
Main: main.js
|
5 |
+
Description: Adds a drop-down menu to insert snippet cells into the current notebook.
|
6 |
+
Link: README.md
|
.local/share/jupyter/nbextensions/snippets_menu/snippets_submenus_python/astropy.js
ADDED
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
define({
|
2 |
+
'name' : 'Astropy',
|
3 |
+
'sub-menu' : [
|
4 |
+
{
|
5 |
+
'name' : 'Constants',
|
6 |
+
'sub-menu' : [
|
7 |
+
{
|
8 |
+
'name' : 'Setup',
|
9 |
+
'snippet' : ['import astropy.constants'],
|
10 |
+
},
|
11 |
+
'---',
|
12 |
+
{
|
13 |
+
'name' : 'Extracting value',
|
14 |
+
'snippet' : ['astropy.constants.G.value'],
|
15 |
+
},
|
16 |
+
{
|
17 |
+
'name' : 'Extracting units',
|
18 |
+
'snippet' : ['astropy.constants.G.unit'],
|
19 |
+
},
|
20 |
+
{
|
21 |
+
'name' : 'Extracting uncertainty',
|
22 |
+
'snippet' : ['astropy.constants.G.uncertainty'],
|
23 |
+
},
|
24 |
+
{
|
25 |
+
'name' : 'Converting to SI',
|
26 |
+
'snippet' : ['astropy.constants.G.si'],
|
27 |
+
},
|
28 |
+
{
|
29 |
+
'name' : 'Converting to cgs',
|
30 |
+
'snippet' : ['astropy.constants.G.cgs'],
|
31 |
+
},
|
32 |
+
'---',
|
33 |
+
{
|
34 |
+
'name' : 'Gravitational constant [\\(\\mathrm{m}^3 / (\\mathrm{kg}\\, \\mathrm{s}^2)\\)]',
|
35 |
+
'snippet' : ['astropy.constants.G',],
|
36 |
+
},
|
37 |
+
{
|
38 |
+
'name' : 'Solar luminosity [\\(\\mathrm{W}\\)]',
|
39 |
+
'snippet' : ['astropy.constants.L_sun',],
|
40 |
+
},
|
41 |
+
{
|
42 |
+
'name' : 'Earth mass [\\(\\mathrm{kg}\\)]',
|
43 |
+
'snippet' : ['astropy.constants.M_earth',],
|
44 |
+
},
|
45 |
+
{
|
46 |
+
'name' : 'Jupiter mass [\\(\\mathrm{kg}\\)]',
|
47 |
+
'snippet' : ['astropy.constants.M_jup',],
|
48 |
+
},
|
49 |
+
{
|
50 |
+
'name' : 'Solar mass [\\(\\mathrm{kg}\\)]',
|
51 |
+
'snippet' : ['astropy.constants.M_sun',],
|
52 |
+
},
|
53 |
+
{
|
54 |
+
'name' : 'Avogadro’s number [\\(1 / \\mathrm{mol}\\)]',
|
55 |
+
'snippet' : ['astropy.constants.N_A',],
|
56 |
+
},
|
57 |
+
{
|
58 |
+
'name' : 'Gas constant [\\(\\mathrm{J} / (\\mathrm{K}\\, \\mathrm{mol})\\)]',
|
59 |
+
'snippet' : ['astropy.constants.R',],
|
60 |
+
},
|
61 |
+
{
|
62 |
+
'name' : 'Earth equatorial radius [\\(\\mathrm{m}\\)]',
|
63 |
+
'snippet' : ['astropy.constants.R_earth',],
|
64 |
+
},
|
65 |
+
{
|
66 |
+
'name' : 'Jupiter equatorial radius [\\(\\mathrm{m}\\)]',
|
67 |
+
'snippet' : ['astropy.constants.R_jup',],
|
68 |
+
},
|
69 |
+
{
|
70 |
+
'name' : 'Solar radius [\\(\\mathrm{m}\\)]',
|
71 |
+
'snippet' : ['astropy.constants.R_sun',],
|
72 |
+
},
|
73 |
+
{
|
74 |
+
'name' : 'Rydberg constant [\\(1 / \\mathrm{m}\\)]',
|
75 |
+
'snippet' : ['astropy.constants.Ryd',],
|
76 |
+
},
|
77 |
+
{
|
78 |
+
'name' : 'Bohr radius [\\(\\mathrm{m}\\)]',
|
79 |
+
'snippet' : ['astropy.constants.a0',],
|
80 |
+
},
|
81 |
+
{
|
82 |
+
'name' : 'Fine-structure constant (dimensionless)',
|
83 |
+
'snippet' : ['astropy.constants.alpha',],
|
84 |
+
},
|
85 |
+
{
|
86 |
+
'name' : 'Atmosphere [\\(\\mathrm{Pa}\\)]',
|
87 |
+
'snippet' : ['astropy.constants.atmosphere',],
|
88 |
+
},
|
89 |
+
{
|
90 |
+
'name' : 'Astronomical Unit [\\(\\mathrm{m}\\)]',
|
91 |
+
'snippet' : ['astropy.constants.au',],
|
92 |
+
},
|
93 |
+
{
|
94 |
+
'name' : 'Wien wavelength displacement law constant [\\(\\mathrm{m}\\, \\mathrm{K}\\)]',
|
95 |
+
'snippet' : ['astropy.constants.b_wien',],
|
96 |
+
},
|
97 |
+
{
|
98 |
+
'name' : 'Speed of light in vacuum [\\(\\mathrm{m} / \\mathrm{s}\\)]',
|
99 |
+
'snippet' : ['astropy.constants.c',],
|
100 |
+
},
|
101 |
+
{
|
102 |
+
'name' : 'Electron charge [\\(\\mathrm{C}\\)]',
|
103 |
+
'snippet' : ['astropy.constants.e',],
|
104 |
+
},
|
105 |
+
{
|
106 |
+
'name' : 'Electric constant [\\(\\mathrm{F}/\\mathrm{m}\\)]',
|
107 |
+
'snippet' : ['astropy.constants.eps0',],
|
108 |
+
},
|
109 |
+
{
|
110 |
+
'name' : 'Standard acceleration of gravity [\\(\\mathrm{m} / \\mathrm{s}^2\\)]',
|
111 |
+
'snippet' : ['astropy.constants.g0',],
|
112 |
+
},
|
113 |
+
{
|
114 |
+
'name' : 'Planck constant [\\(\\mathrm{J}\\, \\mathrm{s}\\)]',
|
115 |
+
'snippet' : ['astropy.constants.h',],
|
116 |
+
},
|
117 |
+
{
|
118 |
+
'name' : 'Reduced Planck constant [\\(\\mathrm{J}\\, \\mathrm{s}\\)]',
|
119 |
+
'snippet' : ['astropy.constants.hbar',],
|
120 |
+
},
|
121 |
+
{
|
122 |
+
'name' : 'Boltzmann constant [\\(\\mathrm{J} / \\mathrm{K}\\)]',
|
123 |
+
'snippet' : ['astropy.constants.k_B',],
|
124 |
+
},
|
125 |
+
{
|
126 |
+
'name' : 'Kiloparsec [\\(\\mathrm{m}\\)]',
|
127 |
+
'snippet' : ['astropy.constants.kpc',],
|
128 |
+
},
|
129 |
+
{
|
130 |
+
'name' : 'Electron mass [\\(\\mathrm{kg}\\)]',
|
131 |
+
'snippet' : ['astropy.constants.m_e',],
|
132 |
+
},
|
133 |
+
{
|
134 |
+
'name' : 'Neutron mass [\\(\\mathrm{kg}\\)]',
|
135 |
+
'snippet' : ['astropy.constants.m_n',],
|
136 |
+
},
|
137 |
+
{
|
138 |
+
'name' : 'Proton mass [\\(\\mathrm{kg}\\)]',
|
139 |
+
'snippet' : ['astropy.constants.m_p',],
|
140 |
+
},
|
141 |
+
{
|
142 |
+
'name' : 'Magnetic constant [\\(\\mathrm{N}/\\mathrm{A}^2\\)]',
|
143 |
+
'snippet' : ['astropy.constants.mu0',],
|
144 |
+
},
|
145 |
+
{
|
146 |
+
'name' : 'Bohr magneton [\\(\\mathrm{J}/\\mathrm{T}\\)]',
|
147 |
+
'snippet' : ['astropy.constants.muB',],
|
148 |
+
},
|
149 |
+
{
|
150 |
+
'name' : 'Parsec [\\(\\mathrm{m}\\)]',
|
151 |
+
'snippet' : ['astropy.constants.pc',],
|
152 |
+
},
|
153 |
+
{
|
154 |
+
'name' : 'Stefan-Boltzmann constant [\\(\\mathrm{W} / (\\mathrm{K}^4\\, \\mathrm{m}^2)\\)]',
|
155 |
+
'snippet' : ['astropy.constants.sigma_sb',],
|
156 |
+
},
|
157 |
+
{
|
158 |
+
'name' : 'Atomic mass [\\(\\mathrm{kg}\\)]',
|
159 |
+
'snippet' : ['astropy.constants.u',],
|
160 |
+
},
|
161 |
+
],
|
162 |
+
},
|
163 |
+
],
|
164 |
+
});
|
.local/share/jupyter/nbextensions/snippets_menu/snippets_submenus_python/matplotlib.js
ADDED
@@ -0,0 +1,186 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
define({
|
2 |
+
'name' : 'Matplotlib',
|
3 |
+
'sub-menu' : [
|
4 |
+
{
|
5 |
+
'name' : 'Setup for notebook',
|
6 |
+
'snippet' : [
|
7 |
+
'from __future__ import print_function, division',
|
8 |
+
'import numpy as np',
|
9 |
+
'import matplotlib as mpl',
|
10 |
+
'import matplotlib.pyplot as plt',
|
11 |
+
'%matplotlib inline',
|
12 |
+
],
|
13 |
+
},
|
14 |
+
{
|
15 |
+
'name' : 'Setup for scripts',
|
16 |
+
'snippet' : [
|
17 |
+
'import matplotlib as mpl',
|
18 |
+
'mpl.use("Agg") # Must come after importing mpl, but before importing plt',
|
19 |
+
'import matplotlib.pyplot as plt',
|
20 |
+
],
|
21 |
+
},
|
22 |
+
{
|
23 |
+
'name' : 'Documentation',
|
24 |
+
'external-link' : 'http://matplotlib.org/contents.html',
|
25 |
+
},
|
26 |
+
'---',
|
27 |
+
{
|
28 |
+
'name' : 'Example plots',
|
29 |
+
'sub-menu' : [
|
30 |
+
{
|
31 |
+
'name' : 'Basic line plot',
|
32 |
+
'snippet' : [
|
33 |
+
'# Silly example data',
|
34 |
+
'bp_x = np.linspace(0, 2*np.pi, num=40, endpoint=True)',
|
35 |
+
'bp_y = np.sin(bp_x)',
|
36 |
+
'',
|
37 |
+
'# Make the plot',
|
38 |
+
'plt.plot(bp_x, bp_y, linewidth=3, linestyle="--",',
|
39 |
+
' color="blue", label=r"Legend label $\\sin(x)$")',
|
40 |
+
'plt.xlabel(r"Description of $x$ coordinate (units)")',
|
41 |
+
'plt.ylabel(r"Description of $y$ coordinate (units)")',
|
42 |
+
'plt.title(r"Title here (remove for papers)")',
|
43 |
+
'plt.xlim(0, 2*np.pi)',
|
44 |
+
'plt.ylim(-1.1, 1.1)',
|
45 |
+
'plt.legend(loc="lower left")',
|
46 |
+
'plt.show()',
|
47 |
+
],
|
48 |
+
},
|
49 |
+
|
50 |
+
{
|
51 |
+
'name' : 'Histogram',
|
52 |
+
'snippet' : [
|
53 |
+
'x = np.random.randn(10000) # example data, random normal distribution',
|
54 |
+
'num_bins = 50',
|
55 |
+
'n, bins, patches = plt.hist(x, num_bins, normed=1, facecolor="green", alpha=0.5)',
|
56 |
+
'plt.xlabel(r"Description of $x$ coordinate (units)")',
|
57 |
+
'plt.ylabel(r"Description of $y$ coordinate (units)")',
|
58 |
+
'plt.title(r"Histogram title here (remove for papers)")',
|
59 |
+
'plt.show();',
|
60 |
+
],
|
61 |
+
},
|
62 |
+
|
63 |
+
{
|
64 |
+
'name' : 'Contour plot',
|
65 |
+
'snippet' : [
|
66 |
+
'# Silly example data',
|
67 |
+
'x_min, x_max, y_min, y_max = 0.0, 2*np.pi, 0.0, 2*np.pi',
|
68 |
+
'f = [[np.sin(x**2 + y**2) for x in np.linspace(x_min, x_max, num=200)]',
|
69 |
+
' for y in np.linspace(y_min, y_max, num=200)]',
|
70 |
+
'',
|
71 |
+
'# Make the plot',
|
72 |
+
'plt.figure()',
|
73 |
+
'plt.imshow(f, interpolation="bicubic", origin="lower",',
|
74 |
+
' extent=[x_min, x_max, y_min, y_max])',
|
75 |
+
'plt.colorbar()',
|
76 |
+
'plt.title(r"Title here (remove for papers)")',
|
77 |
+
'plt.xlabel(r"Description of $x$ coordinate (units)")',
|
78 |
+
'plt.ylabel(r"Description of $y$ coordinate (units)")',
|
79 |
+
'plt.show()',
|
80 |
+
],
|
81 |
+
},
|
82 |
+
|
83 |
+
{
|
84 |
+
'name' : '3-d plot',
|
85 |
+
'snippet' : [
|
86 |
+
'from mpl_toolkits.mplot3d import Axes3D',
|
87 |
+
'from matplotlib import cm',
|
88 |
+
'',
|
89 |
+
'# Silly example data',
|
90 |
+
'X = np.arange(-5, 5, 0.25)',
|
91 |
+
'Y = np.arange(-5, 5, 0.25)',
|
92 |
+
'X, Y = np.meshgrid(X, Y)',
|
93 |
+
'R = np.sqrt(X**2 + Y**2)',
|
94 |
+
'Z = np.sin(R)',
|
95 |
+
'',
|
96 |
+
'# Make the plot',
|
97 |
+
'fig = plt.figure()',
|
98 |
+
'ax = fig.gca(projection="3d")',
|
99 |
+
'surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.coolwarm,',
|
100 |
+
' linewidth=0, antialiased=False)',
|
101 |
+
'ax.set_zlim(-1.01, 1.01)',
|
102 |
+
'fig.colorbar(surf, shrink=0.5, aspect=5)',
|
103 |
+
'plt.show()',
|
104 |
+
],
|
105 |
+
},
|
106 |
+
|
107 |
+
{
|
108 |
+
'name' : 'Error bars',
|
109 |
+
'snippet' : [
|
110 |
+
'# Silly example data',
|
111 |
+
'x = np.linspace(0.1, 4, num=10)',
|
112 |
+
'y = np.exp(-x)',
|
113 |
+
'dx = 0.1 - x/25.0',
|
114 |
+
'dy = 0.2 + x/15.0',
|
115 |
+
'',
|
116 |
+
'# Make the plot',
|
117 |
+
'plt.figure()',
|
118 |
+
'plt.errorbar(x, y, xerr=dx, yerr=dy)',
|
119 |
+
'plt.title(r"Title here (remove for papers)")',
|
120 |
+
'plt.xlabel(r"Description of $x$ coordinate (units)")',
|
121 |
+
'plt.ylabel(r"Description of $y$ coordinate (units)")',
|
122 |
+
'plt.show()',
|
123 |
+
],
|
124 |
+
},
|
125 |
+
|
126 |
+
{
|
127 |
+
'name' : 'Grouped plots',
|
128 |
+
'snippet' : [
|
129 |
+
'# Silly example data',
|
130 |
+
'bp_x1 = np.linspace(0, 2*np.pi, num=40, endpoint=True)',
|
131 |
+
'bp_y1 = np.sin(bp_x1)',
|
132 |
+
'bp_x2 = np.linspace(0, np.pi, num=40, endpoint=True)',
|
133 |
+
'bp_y2 = np.cos(bp_x2)',
|
134 |
+
'',
|
135 |
+
'# Make the plot',
|
136 |
+
'fig, (ax1, ax2) = plt.subplots(ncols=2)',
|
137 |
+
'ax1.plot(bp_x1, bp_y1, linewidth=3, linestyle="--",',
|
138 |
+
' color="blue", label=r"Legend label $\\sin(x)$")',
|
139 |
+
'ax1.set_xlabel(r"Description of $x_{1}$ coordinate (units)")',
|
140 |
+
'ax1.set_ylabel(r"Description of $y_{1}$ coordinate (units)")',
|
141 |
+
'ax1.set_title(r"Title 1 here (remove for papers)")',
|
142 |
+
'ax1.set_xlim(0, 2*np.pi)',
|
143 |
+
'ax1.set_ylim(-1.1, 1.1)',
|
144 |
+
'ax1.legend(loc="lower left")',
|
145 |
+
'ax2.plot(bp_x2, bp_y2, linewidth=3, linestyle="--",',
|
146 |
+
' color="blue", label=r"Legend label $\\cos(x)$")',
|
147 |
+
'ax2.set_xlabel(r"Description of $x_{2}$ coordinate (units)")',
|
148 |
+
'ax2.set_ylabel(r"Description of $y_{2}$ coordinate (units)")',
|
149 |
+
'ax2.set_title(r"Title 2 here (remove for papers)")',
|
150 |
+
'ax2.set_xlim(0, np.pi)',
|
151 |
+
'ax2.set_ylim(-1.1, 1.1)',
|
152 |
+
'ax2.legend(loc="lower left")',
|
153 |
+
'plt.show()',
|
154 |
+
],
|
155 |
+
},
|
156 |
+
],
|
157 |
+
},
|
158 |
+
{
|
159 |
+
'name' : 'Save the current figure',
|
160 |
+
'snippet' : ['plt.savefig("figure_file_name.pdf")'],
|
161 |
+
'sub-menu' : [
|
162 |
+
{
|
163 |
+
'name' : 'Save as PDF',
|
164 |
+
'snippet' : ['plt.savefig("figure_file_name.pdf")'],
|
165 |
+
},
|
166 |
+
{
|
167 |
+
'name' : 'Save as PNG',
|
168 |
+
'snippet' : ['plt.savefig("figure_file_name.png", transparent=True, dpi=300)'],
|
169 |
+
},
|
170 |
+
{
|
171 |
+
'name' : 'Save as SVG',
|
172 |
+
'snippet' : ['plt.savefig("figure_file_name.svg")'],
|
173 |
+
},
|
174 |
+
{
|
175 |
+
'name' : 'Save as EPS',
|
176 |
+
'snippet' : ['plt.savefig("figure_file_name.eps")'],
|
177 |
+
},
|
178 |
+
{
|
179 |
+
'name' : 'Save as PS',
|
180 |
+
'snippet' : ['plt.savefig("figure_file_name.ps")'],
|
181 |
+
},
|
182 |
+
|
183 |
+
],
|
184 |
+
},
|
185 |
+
],
|
186 |
+
});
|
.local/share/jupyter/nbextensions/snippets_menu/snippets_submenus_python/pandas.js
ADDED
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
define({
|
2 |
+
'name' :'pandas',
|
3 |
+
'sub-menu' : [
|
4 |
+
{
|
5 |
+
'name' : 'Setup',
|
6 |
+
'snippet' : [
|
7 |
+
'from __future__ import print_function, division',
|
8 |
+
'import pandas as pd',
|
9 |
+
],
|
10 |
+
},
|
11 |
+
{
|
12 |
+
'name' : 'Documentation',
|
13 |
+
'external-link' : 'http://pandas.pydata.org/pandas-docs/stable/',
|
14 |
+
},
|
15 |
+
'---',
|
16 |
+
{
|
17 |
+
'name' : 'Set options',
|
18 |
+
'snippet' : [
|
19 |
+
'pd.set_option(""display.height"", 10)',
|
20 |
+
'pd.set_option(""display.max_rows"", 20)',
|
21 |
+
'pd.set_option(""display.max_columns"", 500)',
|
22 |
+
'pd.set_option(""display.width"", 1000)',
|
23 |
+
],
|
24 |
+
},
|
25 |
+
|
26 |
+
{
|
27 |
+
'name' : 'To/from file',
|
28 |
+
'sub-menu' : [
|
29 |
+
{
|
30 |
+
'name' : 'Read from CSV',
|
31 |
+
'snippet' : [
|
32 |
+
'bp_data = pd.read_csv("path/to/file.csv", header=1, delim_whitespace=True)',
|
33 |
+
],
|
34 |
+
},
|
35 |
+
|
36 |
+
{
|
37 |
+
'name' : 'Write to CSV',
|
38 |
+
'snippet' : ['bp_data.to_csv("path/to/new_file.csv", sep=" ", header=False, index=False)',],
|
39 |
+
},
|
40 |
+
],
|
41 |
+
},
|
42 |
+
|
43 |
+
{
|
44 |
+
'name' : 'Deal with NaNs',
|
45 |
+
'sub-menu' : [
|
46 |
+
{
|
47 |
+
'name' : 'Filter out NaNs',
|
48 |
+
'snippet' : ['bp_data = bp_data.dropna()',],
|
49 |
+
},
|
50 |
+
|
51 |
+
{
|
52 |
+
'name' : 'Replace NaNs with number',
|
53 |
+
'snippet' : ['bp_data = bp_data.fillna(0.0)',],
|
54 |
+
},
|
55 |
+
],
|
56 |
+
},
|
57 |
+
|
58 |
+
{
|
59 |
+
'name' : 'Select rows',
|
60 |
+
'snippet' : ['bp_data[:5]',],
|
61 |
+
},
|
62 |
+
|
63 |
+
{
|
64 |
+
'name' : 'Select by column',
|
65 |
+
'snippet' : ['bp_column = bp_data[["Column name"]]',],
|
66 |
+
'sub-menu' : [
|
67 |
+
{
|
68 |
+
'name' : 'Select single column',
|
69 |
+
'snippet' : ['bp_column = bp_data[["Column name"]]',],
|
70 |
+
},
|
71 |
+
|
72 |
+
{
|
73 |
+
'name' : 'Select multiple columns',
|
74 |
+
'snippet' : [
|
75 |
+
'bp_columns = bp_data[["Column name 1", "Column name 2", "Column name 3"]]',],
|
76 |
+
},
|
77 |
+
],
|
78 |
+
},
|
79 |
+
|
80 |
+
{
|
81 |
+
'name' : 'Get numerical values from selection',
|
82 |
+
'sub-menu' : [
|
83 |
+
{
|
84 |
+
'name' : 'Select single column',
|
85 |
+
'snippet' : ['bp_num_value = bp_data[["Numerical column"]].values',],
|
86 |
+
},
|
87 |
+
{
|
88 |
+
'name' : 'Select multiple columns',
|
89 |
+
'snippet' : [
|
90 |
+
'bp_num_values = bp_data[["Numerical column 1", "Numerical column 2"]].values',],
|
91 |
+
},
|
92 |
+
{
|
93 |
+
'name' : 'Select rows',
|
94 |
+
'snippet' : ['bp_num_value = bp_data[:5].values',],
|
95 |
+
},
|
96 |
+
],
|
97 |
+
},
|
98 |
+
|
99 |
+
{
|
100 |
+
'name' : 'Iteration',
|
101 |
+
'snippet' : ['',],
|
102 |
+
},
|
103 |
+
|
104 |
+
{
|
105 |
+
'name' : 'Grouping',
|
106 |
+
'snippet' : ['',],
|
107 |
+
},
|
108 |
+
|
109 |
+
{
|
110 |
+
'name' : 'Sorting',
|
111 |
+
'snippet' : ['',],
|
112 |
+
},
|
113 |
+
|
114 |
+
{
|
115 |
+
'name' : 'Combining',
|
116 |
+
'sub-menu' : [
|
117 |
+
{
|
118 |
+
'name' : 'Split-apply-combine (sum)',
|
119 |
+
'snippet' : ['df['label_count'] = df.groupby('label', as_index=False)['label'].transform(lambda x: x.count())',],
|
120 |
+
},
|
121 |
+
{
|
122 |
+
'name' : 'Split-apply-combine (mean)',
|
123 |
+
'snippet' : ['df['label_mean'] = df.groupby('label', as_index=False)['label'].transform(lambda x: x.mean())',],
|
124 |
+
},
|
125 |
+
],
|
126 |
+
},
|
127 |
+
|
128 |
+
{
|
129 |
+
'name' : 'Basic stats',
|
130 |
+
'sub-menu' : [
|
131 |
+
{
|
132 |
+
'name' : 'Mean',
|
133 |
+
'snippet' : ['bp_mean = bp_data[["Numerical column 1"]].mean()',],
|
134 |
+
},
|
135 |
+
{
|
136 |
+
'name' : 'Mode',
|
137 |
+
'snippet' : ['bp_mode = bp_data[["Numerical column 1"]].mode()',],
|
138 |
+
},
|
139 |
+
{
|
140 |
+
'name' : 'Median',
|
141 |
+
'snippet' : ['bp_median = bp_data[["Numerical column 1"]].median()',],
|
142 |
+
},
|
143 |
+
{
|
144 |
+
'name' : 'Standard deviation (unbiased)',
|
145 |
+
'snippet' : ['bp_std = bp_data[["Numerical column 1"]].std()',],
|
146 |
+
},
|
147 |
+
{
|
148 |
+
'name' : 'Variance (unbiased)',
|
149 |
+
'snippet' : ['bp_var = bp_data[["Numerical column 1"]].var()',],
|
150 |
+
},
|
151 |
+
{
|
152 |
+
'name' : 'Skew (unbiased)',
|
153 |
+
'snippet' : ['bp_skew = bp_data[["Numerical column 1"]].skew()',],
|
154 |
+
},
|
155 |
+
{
|
156 |
+
'name' : 'Kurtosis (unbiased)',
|
157 |
+
'snippet' : ['bp_kurtosis = bp_data[["Numerical column 1"]].kurt()',],
|
158 |
+
},
|
159 |
+
{
|
160 |
+
'name' : 'Min',
|
161 |
+
'snippet' : ['bp_min = bp_data[["Numerical column 1"]].min()',],
|
162 |
+
},
|
163 |
+
{
|
164 |
+
'name' : 'Max',
|
165 |
+
'snippet' : ['bp_max = bp_data[["Numerical column 1"]].max()',],
|
166 |
+
},
|
167 |
+
{
|
168 |
+
'name' : 'Sum',
|
169 |
+
'snippet' : ['bp_sum = bp_data[["Numerical column 1"]].sum()',],
|
170 |
+
},
|
171 |
+
{
|
172 |
+
'name' : 'Product',
|
173 |
+
'snippet' : ['bp_product = bp_data[["Numerical column 1"]].product()',],
|
174 |
+
},
|
175 |
+
{
|
176 |
+
'name' : 'Number of elements',
|
177 |
+
'snippet' : ['bp_count = bp_data[["Numerical column 1"]].count()',],
|
178 |
+
},
|
179 |
+
],
|
180 |
+
},
|
181 |
+
],
|
182 |
+
});
|
.local/share/jupyter/nbextensions/snippets_menu/snippets_submenus_python/python.js
ADDED
@@ -0,0 +1,209 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
define([
|
2 |
+
"require",
|
3 |
+
"./python_regex",
|
4 |
+
], function (requirejs, python_regex) {
|
5 |
+
return {
|
6 |
+
'name' : 'Python',
|
7 |
+
'sub-menu' : [
|
8 |
+
{
|
9 |
+
'name' : 'Setup',
|
10 |
+
'snippet' : ['from __future__ import print_function, division',],
|
11 |
+
},
|
12 |
+
{
|
13 |
+
'name' : 'Documentation',
|
14 |
+
'external-link' : 'https://docs.python.org/',
|
15 |
+
},
|
16 |
+
'---',
|
17 |
+
|
18 |
+
{
|
19 |
+
'name' : 'Lists',
|
20 |
+
'sub-menu' : [
|
21 |
+
{
|
22 |
+
'name' : 'List comprehension',
|
23 |
+
'snippet' : ['[x**2 for x in range(-10, 11)]',],
|
24 |
+
},
|
25 |
+
{
|
26 |
+
'name' : 'Conditional list comprehension',
|
27 |
+
'snippet' : ['[x**2 for x in range(-10, 11) if (x%3)==0]',],
|
28 |
+
},
|
29 |
+
{
|
30 |
+
'name' : 'Conditional alternative list comprehension',
|
31 |
+
'snippet' : ['[x**2 if (x%3)==0 else x**3 for x in range(-10, 11)]',],
|
32 |
+
},
|
33 |
+
{
|
34 |
+
'name' : 'Reversed list',
|
35 |
+
'snippet' : ['reversed(l)'],
|
36 |
+
},
|
37 |
+
{
|
38 |
+
'name' : 'Sorted list',
|
39 |
+
'snippet' : ['sorted(l)'],
|
40 |
+
},
|
41 |
+
{
|
42 |
+
'name' : 'Sort two lists at the same time',
|
43 |
+
'snippet' : ['x, y = [list(tmp) for tmp in zip(*sorted(zip(x,y), key=lambda pair: pair[0]))]'],
|
44 |
+
},
|
45 |
+
],
|
46 |
+
},
|
47 |
+
|
48 |
+
{
|
49 |
+
'name' : 'Basic file input/output',
|
50 |
+
'sub-menu' : [
|
51 |
+
{
|
52 |
+
'name' : 'Read file into string',
|
53 |
+
'snippet' : [
|
54 |
+
'with open("some/file.txt", "r") as file_handle:',
|
55 |
+
' file_contents = file_handle.read()',
|
56 |
+
],
|
57 |
+
},
|
58 |
+
{
|
59 |
+
'name' : 'Read file into string, operating on each line',
|
60 |
+
'snippet' : [
|
61 |
+
'file_contents = ""',
|
62 |
+
'with open("some/file.txt", "r") as file_handle:',
|
63 |
+
' for line in file_handle.readlines():',
|
64 |
+
' file_contents += line.replace("-", "_")',
|
65 |
+
],
|
66 |
+
}
|
67 |
+
],
|
68 |
+
},
|
69 |
+
|
70 |
+
{
|
71 |
+
'name' : 'Defining functions',
|
72 |
+
'sub-menu' : [
|
73 |
+
{
|
74 |
+
'name' : 'Simple function',
|
75 |
+
'snippet' : [
|
76 |
+
'def bp_some_func(x):',
|
77 |
+
' r"""Brief description of the function"""',
|
78 |
+
' return x**2',
|
79 |
+
],
|
80 |
+
},
|
81 |
+
{
|
82 |
+
'name' : 'Complicated function',
|
83 |
+
'snippet' : [
|
84 |
+
'def bp_some_func(x, y, z=3.14, **kwargs):',
|
85 |
+
' r"""Some function',
|
86 |
+
' ',
|
87 |
+
' Does some stuff.',
|
88 |
+
' ',
|
89 |
+
' Parameters',
|
90 |
+
' ----------',
|
91 |
+
' x : int',
|
92 |
+
' Description of x',
|
93 |
+
' y : str',
|
94 |
+
' Description of y',
|
95 |
+
' z : float, optional',
|
96 |
+
' Description of z. Defaults to 3.14',
|
97 |
+
' **kwargs',
|
98 |
+
' Arbitrary optional keyword arguments.',
|
99 |
+
' w : float',
|
100 |
+
' Defaults to 6.28',
|
101 |
+
' ',
|
102 |
+
' Returns',
|
103 |
+
' -------',
|
104 |
+
' double',
|
105 |
+
' Some nonsensical number computed from some ugly formula',
|
106 |
+
' ',
|
107 |
+
' """',
|
108 |
+
' w = kwargs.pop("w", 6.28)',
|
109 |
+
' if kwargs:',
|
110 |
+
' print("Got {0} unused kwargs".format(len(kwargs)))',
|
111 |
+
' return (x**2 + len(y)) * (w + z)',
|
112 |
+
],
|
113 |
+
},
|
114 |
+
],
|
115 |
+
},
|
116 |
+
|
117 |
+
{
|
118 |
+
'name' : 'Defining classes',
|
119 |
+
'sub-menu' : [
|
120 |
+
{
|
121 |
+
'name' : 'Simple class',
|
122 |
+
'snippet' : [
|
123 |
+
'class BPSomeClass(object):',
|
124 |
+
' r"""Describe the class"""',
|
125 |
+
' def __init__(self, arg1, arg2):',
|
126 |
+
' self.attr1 = arg1',
|
127 |
+
' self.attr2 = arg2',
|
128 |
+
' ',
|
129 |
+
' def attribute1(self):',
|
130 |
+
' return self.attr1',
|
131 |
+
'bp_obj = BPSomeClass("a", 2.7182)',
|
132 |
+
'bp_obj.attribute1()',
|
133 |
+
],
|
134 |
+
},
|
135 |
+
{
|
136 |
+
'name' : 'Complicated class',
|
137 |
+
'snippet' : [
|
138 |
+
'class BPSomeClass(object):',
|
139 |
+
' """Brief class description',
|
140 |
+
' ',
|
141 |
+
' Some more extensive description',
|
142 |
+
' ',
|
143 |
+
' Attributes',
|
144 |
+
' ----------',
|
145 |
+
' attr1 : string',
|
146 |
+
' Purpose of attr1.',
|
147 |
+
' attr2 : float',
|
148 |
+
' Purpose of attr2.',
|
149 |
+
' ',
|
150 |
+
' """',
|
151 |
+
' ',
|
152 |
+
' def __init__(self, param1, param2, param3=0):',
|
153 |
+
' """Example of docstring on the __init__ method.',
|
154 |
+
' ',
|
155 |
+
' Parameters',
|
156 |
+
' ----------',
|
157 |
+
' param1 : str',
|
158 |
+
' Description of `param1`.',
|
159 |
+
' param2 : float',
|
160 |
+
' Description of `param2`.',
|
161 |
+
' param3 : int, optional',
|
162 |
+
' Description of `param3`, defaults to 0.',
|
163 |
+
' ',
|
164 |
+
' """',
|
165 |
+
' self.attr1 = param1',
|
166 |
+
' self.attr2 = param2',
|
167 |
+
' print(param3 // 4)',
|
168 |
+
' ',
|
169 |
+
' @property',
|
170 |
+
' def attribute2(self):',
|
171 |
+
' return self.attr2',
|
172 |
+
' ',
|
173 |
+
' @attribute2.setter',
|
174 |
+
' def attribute2(self, new_attr2):',
|
175 |
+
' if not isinstance(float, new_attr2):',
|
176 |
+
' raise ValueError("attribute2 must be a float, not {0}".format(new_attr2))',
|
177 |
+
' self.attr2 = new_attr2',
|
178 |
+
'',
|
179 |
+
'',
|
180 |
+
'bp_obj = BPSomeClass("a", 1.618)',
|
181 |
+
'print(bp_obj.attribute2)',
|
182 |
+
'bp_obj.attribute2 = 3.236',
|
183 |
+
'',
|
184 |
+
],
|
185 |
+
},
|
186 |
+
{
|
187 |
+
'name' : 'Subclass',
|
188 |
+
'snippet' : [
|
189 |
+
'class BP_A(object):',
|
190 |
+
' def __init__(self, param1):',
|
191 |
+
' self.attr1 = param1',
|
192 |
+
'',
|
193 |
+
'class BP_B(BP_A):',
|
194 |
+
' def __init__(self, param1, param2):',
|
195 |
+
' super(BP_B, self).__init__(param1)',
|
196 |
+
' self.attr2 = param2',
|
197 |
+
'',
|
198 |
+
'',
|
199 |
+
'bp_b = BP_B("a", "b")',
|
200 |
+
'print(bp_b.attr1, bp_b.attr2)',
|
201 |
+
],
|
202 |
+
},
|
203 |
+
],
|
204 |
+
},
|
205 |
+
|
206 |
+
python_regex,
|
207 |
+
],
|
208 |
+
};
|
209 |
+
});
|
.local/share/jupyter/nbextensions/snippets_menu/snippets_submenus_python/python_regex.js
ADDED
@@ -0,0 +1,309 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
define({
|
2 |
+
'name' : 'Regular expressions',
|
3 |
+
'sub-menu' : [
|
4 |
+
{
|
5 |
+
'name' : 'Setup',
|
6 |
+
'snippet' : [
|
7 |
+
'import re',
|
8 |
+
],
|
9 |
+
},
|
10 |
+
'---',
|
11 |
+
{
|
12 |
+
'name' : 'Basic search for pattern anywhere in string',
|
13 |
+
'snippet' : [
|
14 |
+
'string = " abc def "',
|
15 |
+
'pattern = re.compile(r"[a-z]+")',
|
16 |
+
'result = re.search(pattern, string)',
|
17 |
+
'if result is not None:',
|
18 |
+
' print("Substring \'{0}\' was found in the range {1}".format(result.group(), result.span()))',
|
19 |
+
],
|
20 |
+
},
|
21 |
+
{
|
22 |
+
'name' : 'Basic search (match) for exact pattern at beginning of string',
|
23 |
+
'snippet' : [
|
24 |
+
'string = " abc def "',
|
25 |
+
'pattern = re.compile(r".*[a-z]+")',
|
26 |
+
'result = re.match(pattern, string)',
|
27 |
+
'if result is not None:',
|
28 |
+
' print("Substring \'{0}\' was found in the range {1}".format(result.group(), result.span()))',
|
29 |
+
],
|
30 |
+
},
|
31 |
+
{
|
32 |
+
'name' : 'Basic substitution',
|
33 |
+
'snippet' : [
|
34 |
+
'string = " abc def "',
|
35 |
+
'pattern = re.compile(r"[a-z]+")',
|
36 |
+
'new_string = re.sub(pattern, "something", string)',
|
37 |
+
'print("New string is \'{0}\'".format(new_string))',
|
38 |
+
],
|
39 |
+
},
|
40 |
+
{
|
41 |
+
'name' : 'Substitution with backreferences',
|
42 |
+
'snippet' : [
|
43 |
+
'string = "John Doe lives at 221B Baker Street."',
|
44 |
+
'pattern = re.compile(r"""',
|
45 |
+
' ([a-zA-Z ]+) # Save as many letters and spaces as possible to group 1',
|
46 |
+
' \\ lives\\ at\\ # Match " lives at "',
|
47 |
+
' (?P<address>.*) # Save everything in between as a group named `address`',
|
48 |
+
' \\. # Match the period at the end',
|
49 |
+
'""", re.VERBOSE)',
|
50 |
+
'new_string = re.sub(pattern, r"\\g<address> is occupied by \\1.", string)',
|
51 |
+
'print("New string is \'{0}\'".format(new_string))',
|
52 |
+
],
|
53 |
+
},
|
54 |
+
'---',
|
55 |
+
{
|
56 |
+
'name' : 'Escaped special characters',
|
57 |
+
'sub-menu' : [
|
58 |
+
{
|
59 |
+
'name' : '.',
|
60 |
+
'snippet' : ['\\.',],
|
61 |
+
},
|
62 |
+
{
|
63 |
+
'name' : '^',
|
64 |
+
'snippet' : ['\\^',],
|
65 |
+
},
|
66 |
+
{
|
67 |
+
'name' : '$',
|
68 |
+
'snippet' : ['\\$',],
|
69 |
+
},
|
70 |
+
{
|
71 |
+
'name' : '*',
|
72 |
+
'snippet' : ['\\*',],
|
73 |
+
},
|
74 |
+
{
|
75 |
+
'name' : '+',
|
76 |
+
'snippet' : ['\\+',],
|
77 |
+
},
|
78 |
+
{
|
79 |
+
'name' : '?',
|
80 |
+
'snippet' : ['\\?',],
|
81 |
+
},
|
82 |
+
{
|
83 |
+
'name' : '{',
|
84 |
+
'snippet' : ['\\{',],
|
85 |
+
},
|
86 |
+
{
|
87 |
+
'name' : '}',
|
88 |
+
'snippet' : ['\\}',],
|
89 |
+
},
|
90 |
+
{
|
91 |
+
'name' : '[',
|
92 |
+
'snippet' : ['\\[',],
|
93 |
+
},
|
94 |
+
{
|
95 |
+
'name' : ']',
|
96 |
+
'snippet' : ['\\]',],
|
97 |
+
},
|
98 |
+
{
|
99 |
+
'name' : '\\',
|
100 |
+
'snippet' : ['\\\\',],
|
101 |
+
},
|
102 |
+
{
|
103 |
+
'name' : '|',
|
104 |
+
'snippet' : ['\\|',],
|
105 |
+
},
|
106 |
+
{
|
107 |
+
'name' : '(',
|
108 |
+
'snippet' : ['\\(',],
|
109 |
+
},
|
110 |
+
{
|
111 |
+
'name' : ')',
|
112 |
+
'snippet' : ['\\)',],
|
113 |
+
},
|
114 |
+
],
|
115 |
+
},
|
116 |
+
|
117 |
+
{
|
118 |
+
'name' : 'Character classes and alternatives',
|
119 |
+
'sub-menu' : [
|
120 |
+
{
|
121 |
+
'name' : 'Standard character-class abbreviations',
|
122 |
+
'sub-menu' : [
|
123 |
+
{
|
124 |
+
'name' : 'Any decimal digit',
|
125 |
+
'snippet' : ['\\d',],
|
126 |
+
},
|
127 |
+
{
|
128 |
+
'name' : 'Any non-digit character',
|
129 |
+
'snippet' : ['\\D',],
|
130 |
+
},
|
131 |
+
{
|
132 |
+
'name' : 'Any whitespace character',
|
133 |
+
'snippet' : ['\\s',],
|
134 |
+
},
|
135 |
+
{
|
136 |
+
'name' : 'Any non-whitespace character',
|
137 |
+
'snippet' : ['\\S',],
|
138 |
+
},
|
139 |
+
{
|
140 |
+
'name' : 'Any alphanumeric character',
|
141 |
+
'snippet' : ['\\w',],
|
142 |
+
},
|
143 |
+
{
|
144 |
+
'name' : 'Any non-alphanumeric character',
|
145 |
+
'snippet' : ['\\W',],
|
146 |
+
},
|
147 |
+
],
|
148 |
+
},
|
149 |
+
{
|
150 |
+
'name' : 'Inclusive character classes',
|
151 |
+
'snippet' : [
|
152 |
+
'[a-zA-Z0-9 \\t\\n\\r\\f\\v]',
|
153 |
+
],
|
154 |
+
},
|
155 |
+
{
|
156 |
+
'name' : 'Exclusive character classes',
|
157 |
+
'snippet' : [
|
158 |
+
'[^a-zA-Z0-9]',
|
159 |
+
],
|
160 |
+
},
|
161 |
+
{
|
162 |
+
'name' : 'Alternatives',
|
163 |
+
'snippet' : [
|
164 |
+
'(?:abc|def)',
|
165 |
+
],
|
166 |
+
},
|
167 |
+
|
168 |
+
],
|
169 |
+
},
|
170 |
+
|
171 |
+
{
|
172 |
+
'name' : 'Repetition',
|
173 |
+
'sub-menu' : [
|
174 |
+
{
|
175 |
+
'name' : 'Match 0 or more repetitions of the preceding, greedily',
|
176 |
+
'snippet' : ['*',],
|
177 |
+
},
|
178 |
+
{
|
179 |
+
'name' : 'Match 1 or more repetitions of the preceding, greedily',
|
180 |
+
'snippet' : ['+',],
|
181 |
+
},
|
182 |
+
{
|
183 |
+
'name' : 'Match 0 or 1 repetitions of the preceding, greedily',
|
184 |
+
'snippet' : ['?',],
|
185 |
+
},
|
186 |
+
'---',
|
187 |
+
{
|
188 |
+
'name' : 'Match 0 or more repetitions of the preceding, non-greedily',
|
189 |
+
'snippet' : ['*?',],
|
190 |
+
},
|
191 |
+
{
|
192 |
+
'name' : 'Match 1 or more repetitions of the preceding, non-greedily',
|
193 |
+
'snippet' : ['+?',],
|
194 |
+
},
|
195 |
+
{
|
196 |
+
'name' : 'Match 0 or 1 repetitions of the preceding, non-greedily',
|
197 |
+
'snippet' : ['??',],
|
198 |
+
},
|
199 |
+
'---',
|
200 |
+
{
|
201 |
+
'name' : 'Match exactly n repeititions of the preceding',
|
202 |
+
'snippet' : ['{3}',],
|
203 |
+
},
|
204 |
+
{
|
205 |
+
'name' : 'Match between m and n repetions of the preceding, greedily',
|
206 |
+
'snippet' : ['{3,5}',],
|
207 |
+
},
|
208 |
+
{
|
209 |
+
'name' : 'Match between m and n repetions of the preceding, non-greedily',
|
210 |
+
'snippet' : ['{3,5}?',],
|
211 |
+
},
|
212 |
+
],
|
213 |
+
},
|
214 |
+
|
215 |
+
// {
|
216 |
+
// 'name' : '',
|
217 |
+
// 'sub-menu' : [
|
218 |
+
|
219 |
+
// ],
|
220 |
+
// },
|
221 |
+
|
222 |
+
// {
|
223 |
+
// 'name' : '',
|
224 |
+
// 'sub-menu' : [
|
225 |
+
|
226 |
+
// ],
|
227 |
+
// },
|
228 |
+
|
229 |
+
{
|
230 |
+
'name' : 'Lookahead/behind',
|
231 |
+
'sub-menu' : [
|
232 |
+
{
|
233 |
+
'name' : 'Positive lookahead',
|
234 |
+
'snippet' : [
|
235 |
+
'string = "Isaac Asimov"',
|
236 |
+
'pattern = re.compile(r"Isaac(?= Asimov)") # Only match "Isaac Asimov", but drop the " Asimov"',
|
237 |
+
'result = re.match(pattern, string)',
|
238 |
+
'if result is not None:',
|
239 |
+
' print("Substring \'{0}\' was found in the range {1}".format(result.group(), result.span()))',
|
240 |
+
],
|
241 |
+
},
|
242 |
+
{
|
243 |
+
'name' : 'Negative lookahead',
|
244 |
+
'snippet' : [
|
245 |
+
'string = "Isaac Newton"',
|
246 |
+
'pattern = re.compile(r"Isaac(?! Asimov)") # Match any Isaac except Asimov, and only keep the "Isaac"',
|
247 |
+
'result = re.match(pattern, string)',
|
248 |
+
'if result is not None:',
|
249 |
+
' print("Substring \'{0}\' was found in the range {1}".format(result.group(), result.span()))',
|
250 |
+
],
|
251 |
+
},
|
252 |
+
{
|
253 |
+
'name' : 'Positive lookbehind',
|
254 |
+
'snippet' : [
|
255 |
+
'string = "Janet Asimov"',
|
256 |
+
'pattern = re.compile(r"(?<=Janet )Asimov") # Only match "Janet Asimov", but drop the "Janet "',
|
257 |
+
'result = re.search(pattern, string)',
|
258 |
+
'if result is not None:',
|
259 |
+
' print("Substring \'{0}\' was found in the range {1}".format(result.group(), result.span()))',
|
260 |
+
],
|
261 |
+
},
|
262 |
+
{
|
263 |
+
'name' : 'Negative lookbehind',
|
264 |
+
'snippet' : [
|
265 |
+
'string = "Janet Asimov"',
|
266 |
+
'pattern = re.compile(r"(?<!Isaac )Asimov") # Will match any Asimov except Isaac, and only keep "Asimov"',
|
267 |
+
'result = re.search(pattern, string)',
|
268 |
+
'if result is not None:',
|
269 |
+
' print("Substring \'{0}\' was found in the range {1}".format(result.group(), result.span()))',
|
270 |
+
],
|
271 |
+
},
|
272 |
+
],
|
273 |
+
},
|
274 |
+
|
275 |
+
{
|
276 |
+
'name' : 'Compilation flags',
|
277 |
+
'sub-menu' : [
|
278 |
+
{
|
279 |
+
'name' : 'Enable verbose REs, for cleaner and more organized code',
|
280 |
+
'snippet' : ['re.VERBOSE',],
|
281 |
+
},
|
282 |
+
{
|
283 |
+
'name' : 'Do case-insensitive matches',
|
284 |
+
'snippet' : ['re.IGNORECASE',],
|
285 |
+
},
|
286 |
+
{
|
287 |
+
'name' : 'Make "." match any character, including newlines',
|
288 |
+
'snippet' : ['re.DOTALL',],
|
289 |
+
},
|
290 |
+
{
|
291 |
+
'name' : 'Multi-line matching, affecting "^" and "$"',
|
292 |
+
'snippet' : ['re.MULTILINE',],
|
293 |
+
},
|
294 |
+
{
|
295 |
+
'name' : 'Make \\w, \\W, \\b, \\B, \\s, and \\S Unicode aware',
|
296 |
+
'snippet' : ['re.UNICODE',],
|
297 |
+
},
|
298 |
+
{
|
299 |
+
'name' : 'Make \\w, \\W, \\b, \\B, \\s, and \\S dependent on the current locale',
|
300 |
+
'snippet' : ['re.LOCALE',],
|
301 |
+
},
|
302 |
+
{
|
303 |
+
'name' : 'Display debug info about compiled regex',
|
304 |
+
'snippet' : ['re.DEBUG',],
|
305 |
+
},
|
306 |
+
],
|
307 |
+
},
|
308 |
+
],
|
309 |
+
});
|
.local/share/jupyter/nbextensions/snippets_menu/snippets_submenus_python/scipy.js
ADDED
@@ -0,0 +1,620 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
define([
|
2 |
+
"require",
|
3 |
+
"./scipy_constants",
|
4 |
+
"./scipy_special",
|
5 |
+
], function (requirejs, scipy_constants, scipy_special) {
|
6 |
+
return {
|
7 |
+
'name' : 'SciPy',
|
8 |
+
'sub-menu' : [
|
9 |
+
{
|
10 |
+
'name' : 'Setup',
|
11 |
+
'snippet' : [
|
12 |
+
'from __future__ import print_function, division',
|
13 |
+
'import numpy as np',
|
14 |
+
'import scipy as sp',
|
15 |
+
],
|
16 |
+
},
|
17 |
+
|
18 |
+
{
|
19 |
+
'name' : 'Documentation',
|
20 |
+
'external-link' : 'http://docs.scipy.org/doc/scipy/reference/',
|
21 |
+
},
|
22 |
+
|
23 |
+
'---',
|
24 |
+
|
25 |
+
// {
|
26 |
+
// 'name' : 'Clustering algorithms',
|
27 |
+
// 'sub-menu' : [
|
28 |
+
// {
|
29 |
+
// 'name' : 'Setup',
|
30 |
+
// 'snippet' : ['from scipy import cluster',],
|
31 |
+
// },
|
32 |
+
// ],
|
33 |
+
// },
|
34 |
+
|
35 |
+
scipy_constants,
|
36 |
+
|
37 |
+
{
|
38 |
+
'name' : 'Fast Fourier Transform routines',
|
39 |
+
'sub-menu' : [
|
40 |
+
{
|
41 |
+
'name' : 'Setup',
|
42 |
+
'snippet' : ['from scipy import fftpack',],
|
43 |
+
},
|
44 |
+
'---',
|
45 |
+
{
|
46 |
+
'name' : 'Docs',
|
47 |
+
'external-link' : 'http://docs.scipy.org/doc/scipy-0.15.1/reference/fftpack.html'
|
48 |
+
},
|
49 |
+
],
|
50 |
+
},
|
51 |
+
|
52 |
+
{
|
53 |
+
'name' : 'Integration and ODE solvers',
|
54 |
+
'sub-menu' : [
|
55 |
+
{
|
56 |
+
'name' : 'Setup',
|
57 |
+
'snippet' : ['from scipy import integrate',],
|
58 |
+
},
|
59 |
+
'---',
|
60 |
+
{
|
61 |
+
'name' : 'Integrate given function object',
|
62 |
+
'sub-menu' : [
|
63 |
+
{
|
64 |
+
'name' : 'General-purpose integration',
|
65 |
+
'snippet' : [
|
66 |
+
'from scipy import integrate',
|
67 |
+
'def f(x, a, b):',
|
68 |
+
' return a * x + b',
|
69 |
+
'integral,error = integrate.quad(f, 0, 4.5, args=(2,1)) # integrates 2*x+1',
|
70 |
+
'print(integral, error)',
|
71 |
+
],
|
72 |
+
},
|
73 |
+
{
|
74 |
+
'name' : 'General purpose double integration',
|
75 |
+
'snippet' : [
|
76 |
+
'from scipy import integrate',
|
77 |
+
'def integrand(y, x):',
|
78 |
+
' return x * y**2',
|
79 |
+
'x_lower_lim, x_upper_lim = 0.0, 0.5',
|
80 |
+
'y_lower_lim, y_upper_lim = lambda x:0.0, lambda x:1.0-2.0*x',
|
81 |
+
'# int_{x=0}^{0.5} int_{y=0}^{1-2x} x y dx dy',
|
82 |
+
'integral,error = integrate.dblquad(integrand,',
|
83 |
+
' x_lower_lim, x_upper_lim,',
|
84 |
+
' y_lower_lim, y_upper_lim)',
|
85 |
+
'print(integral, error)',
|
86 |
+
],
|
87 |
+
},
|
88 |
+
{
|
89 |
+
'name' : 'General purpose triple integration',
|
90 |
+
'snippet' : [
|
91 |
+
'from scipy import integrate',
|
92 |
+
'def integrand(z, y, x):',
|
93 |
+
' return x * y**2 + z',
|
94 |
+
'x_lower_lim, x_upper_lim = 0.0, 0.5',
|
95 |
+
'y_lower_lim, y_upper_lim = lambda x:0.0, lambda x:1.0-2.0*x',
|
96 |
+
'z_lower_lim, z_upper_lim = lambda x,y:-1.0, lambda x,y:1.0+2.0*x-y',
|
97 |
+
'# int_{x=0}^{0.5} int_{y=0}^{1-2x} int_{z=-1}^{1+2x-y} (x y**2 + z) dz dy dx',
|
98 |
+
'integral,error = integrate.tplquad(integrand,',
|
99 |
+
' x_lower_lim, x_upper_lim,',
|
100 |
+
' y_lower_lim, y_upper_lim,',
|
101 |
+
' z_lower_lim, z_upper_lim)',
|
102 |
+
'print(integral, error)',
|
103 |
+
],
|
104 |
+
},
|
105 |
+
{
|
106 |
+
'name' : 'General purpose n-fold integration',
|
107 |
+
'snippet' : [
|
108 |
+
'from scipy import integrate',
|
109 |
+
'def integrand(x0, x1, x2):',
|
110 |
+
' return x2 * x1**2 + x0',
|
111 |
+
'x2_lim = (0.0, 0.5)',
|
112 |
+
'x1_lim = lambda x2:(0.0, 1.0-2.0*x2)',
|
113 |
+
'x0_lim = lambda x1,x2:(-1.0, 1.0+2.0*x2-x1)',
|
114 |
+
'# int_{x2=0}^{0.5} int_{x1=0}^{1-2x2} int_{x0=-1}^{1+2x2-x1} (x2 x1**2 + x0) dx0 dx1 dx2',
|
115 |
+
'integral,error = integrate.nquad(integrand, [x0_lim, x1_lim, x2_lim])',
|
116 |
+
'print(integral, error)',
|
117 |
+
],
|
118 |
+
},
|
119 |
+
{
|
120 |
+
'name' : 'Integrate func(x) using Gaussian quadrature of order $n$',
|
121 |
+
'snippet' : [
|
122 |
+
'gaussian = lambda x: 1/np.sqrt(np.pi) * np.exp(-x**2)',
|
123 |
+
'a,b = 0,1 # limits of integration',
|
124 |
+
'result,err = integrate.fixed_quad(gaussian, a, b, n=5)',
|
125 |
+
],
|
126 |
+
},
|
127 |
+
{
|
128 |
+
'name' : 'Integrate with given tolerance using Gaussian quadrature',
|
129 |
+
'snippet' : [
|
130 |
+
'gaussian = lambda x: 1/np.sqrt(np.pi) * np.exp(-x**2)',
|
131 |
+
'a,b = 0,1 # limits of integration',
|
132 |
+
'result,err = integrate.quadrature(gaussian, a, b, tol=1e-8, rtol=1e-8)',
|
133 |
+
],
|
134 |
+
},
|
135 |
+
{
|
136 |
+
'name' : 'Integrate using Romberg integration',
|
137 |
+
'snippet' : [
|
138 |
+
'gaussian = lambda x: 1/np.sqrt(np.pi) * np.exp(-x**2)',
|
139 |
+
'a,b = 0,1 # limits of integration',
|
140 |
+
'result = integrate.romberg(gaussian, a, b, tol=1e-8, rtol=1e-8)',
|
141 |
+
],
|
142 |
+
},
|
143 |
+
],
|
144 |
+
},
|
145 |
+
{
|
146 |
+
'name' : 'Integrate given fixed samples',
|
147 |
+
'sub-menu' : [
|
148 |
+
{
|
149 |
+
'name' : 'Trapezoidal rule to compute integral from samples',
|
150 |
+
'snippet' : [
|
151 |
+
'x = np.linspace(1, 5, num=100)',
|
152 |
+
'y = 3*x**2 + 1',
|
153 |
+
'integrate.trapz(y, x) # Exact value is 128',
|
154 |
+
],
|
155 |
+
},
|
156 |
+
{
|
157 |
+
'name' : 'Trapezoidal rule to cumulatively compute integral from samples',
|
158 |
+
'snippet' : [
|
159 |
+
'x = np.linspace(1, 5, num=100)',
|
160 |
+
'y = 3*x**2 + 1',
|
161 |
+
'integrate.cumtrapz(y, x) # Should range from ~0 to ~128',
|
162 |
+
],
|
163 |
+
},
|
164 |
+
{
|
165 |
+
'name' : "Simpson's rule to compute integral from samples",
|
166 |
+
'snippet' : [
|
167 |
+
'x = np.linspace(1, 5, num=100)',
|
168 |
+
'y = 3*x**2 + 1',
|
169 |
+
'integrate.simps(y, x) # Exact value is 128',
|
170 |
+
],
|
171 |
+
},
|
172 |
+
{
|
173 |
+
'name' : 'Romberg Integration to compute integral from $2^k + 1$ evenly spaced samples',
|
174 |
+
'snippet' : [
|
175 |
+
'x = np.linspace(1, 5, num=2**7+1)',
|
176 |
+
'y = 3*x**2 + 1',
|
177 |
+
'integrate.romb(y, x) # Exact value is 128',
|
178 |
+
],
|
179 |
+
},
|
180 |
+
],
|
181 |
+
},
|
182 |
+
{
|
183 |
+
'name' : 'Numerically integrate ODE systems',
|
184 |
+
'sub-menu' : [
|
185 |
+
{
|
186 |
+
'name' : 'General integration of ordinary differential equations',
|
187 |
+
'snippet' : [
|
188 |
+
'from scipy.special import gamma, airy',
|
189 |
+
'def func(y, t):',
|
190 |
+
' return [t*y[1], y[0]]',
|
191 |
+
'x = np.arange(0, 4.0, 0.01)',
|
192 |
+
'y_0 = [-1.0 / 3**(1.0/3.0) / gamma(1.0/3.0), 1.0 / 3**(2.0/3.0) / gamma(2.0/3.0)]',
|
193 |
+
'Ai, Aip, Bi, Bip = airy(x)',
|
194 |
+
'y = odeint(func, y_0, x, rtol=1e-12, atol=1e-12) # Exact answer: (Aip, Ai)',
|
195 |
+
],
|
196 |
+
},
|
197 |
+
{
|
198 |
+
'name' : 'General integration of ordinary differential equations with known gradient',
|
199 |
+
'snippet' : [
|
200 |
+
'from scipy.special import gamma, airy',
|
201 |
+
'def func(y, t):',
|
202 |
+
' return [t*y[1], y[0]]',
|
203 |
+
'def gradient(y, t):',
|
204 |
+
' return [[0,t], [1,0]]',
|
205 |
+
'x = np.arange(0, 4.0, 0.01)',
|
206 |
+
'y_0 = [-1.0 / 3**(1.0/3.0) / gamma(1.0/3.0), 1.0 / 3**(2.0/3.0) / gamma(2.0/3.0)]',
|
207 |
+
'Ai, Aip, Bi, Bip = airy(x)',
|
208 |
+
'y = odeint(func, y_0, x, rtol=1e-12, atol=1e-12, Dfun=gradient) # Exact answer: (Aip, Ai)',
|
209 |
+
],
|
210 |
+
},
|
211 |
+
{
|
212 |
+
'name' : 'Integrate ODE using VODE and ZVODE routines',
|
213 |
+
'snippet' : [
|
214 |
+
"def f(t, y, arg1):",
|
215 |
+
" return [1j*arg1*y[0] + y[1], -arg1*y[1]**2]",
|
216 |
+
"def jac(t, y, arg1):",
|
217 |
+
" return [[1j*arg1, 1], [0, -arg1*2*y[1]]]",
|
218 |
+
"y0 = [1.0j, 2.0]",
|
219 |
+
"t0, t1, dt = 0.0, 10.0, 1.0",
|
220 |
+
"r = integrate.ode(f, jac).set_integrator('zvode', method='bdf')",
|
221 |
+
"r.set_initial_value(y0, t0)",
|
222 |
+
"r.set_f_params(2.0)",
|
223 |
+
"r.set_jac_params(2.0)",
|
224 |
+
"while r.successful() and r.t < t1:",
|
225 |
+
" r.integrate(r.t+dt)",
|
226 |
+
" print('{0}: {1}'.format(r.t, r.y))",
|
227 |
+
],
|
228 |
+
},
|
229 |
+
// {
|
230 |
+
// 'name' : 'Integrate complex ODE using VODE and ZVODE routines',
|
231 |
+
// 'snippet' : [
|
232 |
+
// 'integrate.complex_ode',
|
233 |
+
// ],
|
234 |
+
// },
|
235 |
+
],
|
236 |
+
},
|
237 |
+
],
|
238 |
+
},
|
239 |
+
|
240 |
+
{
|
241 |
+
'name' : 'Interpolation and smoothing splines',
|
242 |
+
'sub-menu' : [
|
243 |
+
{
|
244 |
+
'name' : 'Setup',
|
245 |
+
'snippet' : ['from scipy import interpolate',],
|
246 |
+
},
|
247 |
+
'---',
|
248 |
+
{
|
249 |
+
'name' : 'interp1d',
|
250 |
+
'snippet' : [
|
251 |
+
'# NOTE: `interp1d` is very slow; prefer `InterpolatedUnivariateSpline`',
|
252 |
+
'x = np.linspace(0, 10, 10)',
|
253 |
+
'y = np.cos(-x**2/8.0)',
|
254 |
+
"f = interpolate.interp1d(x, y, kind='cubic')",
|
255 |
+
'X = np.linspace(0, 10, 100)',
|
256 |
+
'Y = f(X)',
|
257 |
+
],
|
258 |
+
},
|
259 |
+
{
|
260 |
+
'name' : 'splrep / splrev',
|
261 |
+
'snippet' : [
|
262 |
+
'x = np.arange(0, 2*np.pi+np.pi/4, 2*np.pi/8)',
|
263 |
+
'y = np.sin(x)',
|
264 |
+
'tck = interpolate.splrep(x, y, s=0)',
|
265 |
+
'xnew = np.arange(0,2*np.pi,np.pi/50)',
|
266 |
+
'ynew = interpolate.splev(xnew, tck, der=0)',
|
267 |
+
],
|
268 |
+
},
|
269 |
+
{
|
270 |
+
'name' : 'InterpolatedUnivariateSpline',
|
271 |
+
'snippet' : [
|
272 |
+
'x = np.arange(0, 2*np.pi+np.pi/4, 2*np.pi/8)',
|
273 |
+
'y = np.sin(x)',
|
274 |
+
's = interpolate.InterpolatedUnivariateSpline(x, y)',
|
275 |
+
'xnew = np.arange(0, 2*np.pi, np.pi/50)',
|
276 |
+
'ynew = s(xnew)',
|
277 |
+
],
|
278 |
+
},
|
279 |
+
{
|
280 |
+
'name' : 'Multivariate interpolation',
|
281 |
+
'sub-menu' : [
|
282 |
+
|
283 |
+
],
|
284 |
+
},
|
285 |
+
{
|
286 |
+
'name' : '2-D Splines',
|
287 |
+
'sub-menu' : [
|
288 |
+
|
289 |
+
],
|
290 |
+
},
|
291 |
+
{
|
292 |
+
'name' : 'Radial basis functions',
|
293 |
+
'sub-menu' : [
|
294 |
+
|
295 |
+
],
|
296 |
+
},
|
297 |
+
],
|
298 |
+
},
|
299 |
+
|
300 |
+
// {
|
301 |
+
// 'name' : 'Input and Output',
|
302 |
+
// 'sub-menu' : [
|
303 |
+
// {
|
304 |
+
// 'name' : 'Setup',
|
305 |
+
// 'snippet' : ['from scipy import io',],
|
306 |
+
// },
|
307 |
+
// '---',
|
308 |
+
// ],
|
309 |
+
// },
|
310 |
+
|
311 |
+
{
|
312 |
+
'name' : 'Linear algebra',
|
313 |
+
'sub-menu' : [
|
314 |
+
{
|
315 |
+
'name' : 'Setup',
|
316 |
+
'snippet' : ['from scipy import linalg',],
|
317 |
+
},
|
318 |
+
'---',
|
319 |
+
{
|
320 |
+
'name' : 'Docs',
|
321 |
+
'external-link' : 'http://docs.scipy.org/doc/scipy-0.15.1/reference/linalg.html'
|
322 |
+
},
|
323 |
+
],
|
324 |
+
},
|
325 |
+
|
326 |
+
// {
|
327 |
+
// 'name' : 'Maximum entropy methods',
|
328 |
+
// 'sub-menu' : [
|
329 |
+
// {
|
330 |
+
// 'name' : 'Setup',
|
331 |
+
// 'snippet' : ['from scipy import maxentropy',],
|
332 |
+
// },
|
333 |
+
// '---',
|
334 |
+
// ],
|
335 |
+
// },
|
336 |
+
|
337 |
+
// {
|
338 |
+
// 'name' : 'N-dimensional image processing',
|
339 |
+
// 'sub-menu' : [
|
340 |
+
// {
|
341 |
+
// 'name' : 'Setup',
|
342 |
+
// 'snippet' : ['from scipy import ndimage',],
|
343 |
+
// },
|
344 |
+
// '---',
|
345 |
+
// ],
|
346 |
+
// },
|
347 |
+
|
348 |
+
// {
|
349 |
+
// 'name' : 'Orthogonal distance regression',
|
350 |
+
// 'sub-menu' : [
|
351 |
+
// {
|
352 |
+
// 'name' : 'Setup',
|
353 |
+
// 'snippet' : ['from scipy import odr',],
|
354 |
+
// },
|
355 |
+
// '---',
|
356 |
+
// ],
|
357 |
+
// },
|
358 |
+
|
359 |
+
{
|
360 |
+
'name' : 'Optimization and root-finding routines',
|
361 |
+
'sub-menu' : [
|
362 |
+
{
|
363 |
+
'name' : 'Setup',
|
364 |
+
'snippet' : [
|
365 |
+
'from scipy import optimize',
|
366 |
+
],
|
367 |
+
},
|
368 |
+
'---',
|
369 |
+
{
|
370 |
+
'name' : 'Scalar function minimization',
|
371 |
+
'sub-menu' : [
|
372 |
+
{
|
373 |
+
'name' : 'Unconstrained minimization',
|
374 |
+
'snippet' : [
|
375 |
+
'f = lambda x: (x - 2) * (x + 1)**2',
|
376 |
+
"res = optimize.minimize_scalar(f, method='brent')",
|
377 |
+
'print(res.x)',
|
378 |
+
],
|
379 |
+
},
|
380 |
+
{
|
381 |
+
'name' : 'Bounded minimization',
|
382 |
+
'snippet' : [
|
383 |
+
'from scipy.special import j1 # Test function',
|
384 |
+
"res = optimize.minimize_scalar(j1, bounds=(4, 7), method='bounded')",
|
385 |
+
'print(res.x)',
|
386 |
+
],
|
387 |
+
},
|
388 |
+
],
|
389 |
+
},
|
390 |
+
{
|
391 |
+
'name' : 'General-purpose optimization',
|
392 |
+
'sub-menu' : [
|
393 |
+
{
|
394 |
+
'name' : 'Nelder-Mead Simplex algorithm',
|
395 |
+
'snippet' : [
|
396 |
+
'def rosen(x):',
|
397 |
+
' """The Rosenbrock function"""',
|
398 |
+
' return sum(100.0*(x[1:]-x[:-1]**2.0)**2.0 + (1-x[:-1])**2.0)',
|
399 |
+
'x0 = np.array([1.3, 0.7, 0.8, 1.9, 1.2])',
|
400 |
+
"res = optimize.minimize(rosen, x0, method='nelder-mead',",
|
401 |
+
" options={'xtol': 1e-8, 'disp': True})",
|
402 |
+
'print(res.x)',],
|
403 |
+
},
|
404 |
+
{
|
405 |
+
'name' : 'Broyden-Fletcher-Goldfarb-Shanno (BFGS), analytical derivative',
|
406 |
+
'snippet' : [
|
407 |
+
'def rosen(x):',
|
408 |
+
' """The Rosenbrock function"""',
|
409 |
+
' return sum(100.0*(x[1:]-x[:-1]**2.0)**2.0 + (1-x[:-1])**2.0)',
|
410 |
+
'def rosen_der(x):',
|
411 |
+
' """Derivative of the Rosenbrock function"""',
|
412 |
+
' xm = x[1:-1]',
|
413 |
+
' xm_m1 = x[:-2]',
|
414 |
+
' xm_p1 = x[2:]',
|
415 |
+
' der = np.zeros_like(x)',
|
416 |
+
' der[1:-1] = 200*(xm-xm_m1**2) - 400*(xm_p1 - xm**2)*xm - 2*(1-xm)',
|
417 |
+
' der[0] = -400*x[0]*(x[1]-x[0]**2) - 2*(1-x[0])',
|
418 |
+
' der[-1] = 200*(x[-1]-x[-2]**2)',
|
419 |
+
' return der',
|
420 |
+
'x0 = np.array([1.3, 0.7, 0.8, 1.9, 1.2])',
|
421 |
+
"res = optimize.minimize(rosen, x0, method='BFGS', jac=rosen_der, options={'disp': True})",
|
422 |
+
'print(res.x)',],
|
423 |
+
},
|
424 |
+
{
|
425 |
+
'name' : 'Broyden-Fletcher-Goldfarb-Shanno (BFGS), finite-difference derivative',
|
426 |
+
'snippet' : [
|
427 |
+
'def rosen(x):',
|
428 |
+
' """The Rosenbrock function"""',
|
429 |
+
' return sum(100.0*(x[1:]-x[:-1]**2.0)**2.0 + (1-x[:-1])**2.0)',
|
430 |
+
'x0 = np.array([1.3, 0.7, 0.8, 1.9, 1.2])',
|
431 |
+
"res = optimize.minimize(rosen, x0, method='BFGS', options={'disp': True})",
|
432 |
+
'print(res.x)',],
|
433 |
+
},
|
434 |
+
{
|
435 |
+
'name' : 'Newton-Conjugate-Gradient, full Hessian',
|
436 |
+
'snippet' : [
|
437 |
+
'def rosen(x):',
|
438 |
+
' """The Rosenbrock function"""',
|
439 |
+
' return sum(100.0*(x[1:]-x[:-1]**2.0)**2.0 + (1-x[:-1])**2.0)',
|
440 |
+
'def rosen_der(x):',
|
441 |
+
' """Derivative of the Rosenbrock function"""',
|
442 |
+
' xm = x[1:-1]',
|
443 |
+
' xm_m1 = x[:-2]',
|
444 |
+
' xm_p1 = x[2:]',
|
445 |
+
' der = np.zeros_like(x)',
|
446 |
+
' der[1:-1] = 200*(xm-xm_m1**2) - 400*(xm_p1 - xm**2)*xm - 2*(1-xm)',
|
447 |
+
' der[0] = -400*x[0]*(x[1]-x[0]**2) - 2*(1-x[0])',
|
448 |
+
' der[-1] = 200*(x[-1]-x[-2]**2)',
|
449 |
+
' return der',
|
450 |
+
'def rosen_hess(x):',
|
451 |
+
' x = np.asarray(x)',
|
452 |
+
' H = np.diag(-400*x[:-1],1) - np.diag(400*x[:-1],-1)',
|
453 |
+
' diagonal = np.zeros_like(x)',
|
454 |
+
' diagonal[0] = 1200*x[0]-400*x[1]+2',
|
455 |
+
' diagonal[-1] = 200',
|
456 |
+
' diagonal[1:-1] = 202 + 1200*x[1:-1]**2 - 400*x[2:]',
|
457 |
+
' H = H + np.diag(diagonal)',
|
458 |
+
' return H',
|
459 |
+
'x0 = np.array([1.3, 0.7, 0.8, 1.9, 1.2])',
|
460 |
+
"res = optimize.minimize(rosen, x0, method='Newton-CG', jac=rosen_der, hess=rosen_hess,",
|
461 |
+
" options={'xtol': 1e-8, 'disp': True})",
|
462 |
+
'print(res.x)'],
|
463 |
+
},
|
464 |
+
{
|
465 |
+
'name' : 'Newton-Conjugate-Gradient, Hessian product',
|
466 |
+
'snippet' : [
|
467 |
+
'def rosen(x):',
|
468 |
+
' """The Rosenbrock function"""',
|
469 |
+
' return sum(100.0*(x[1:]-x[:-1]**2.0)**2.0 + (1-x[:-1])**2.0)',
|
470 |
+
'def rosen_der(x):',
|
471 |
+
' """Derivative of the Rosenbrock function"""',
|
472 |
+
' xm = x[1:-1]',
|
473 |
+
' xm_m1 = x[:-2]',
|
474 |
+
' xm_p1 = x[2:]',
|
475 |
+
' der = np.zeros_like(x)',
|
476 |
+
' der[1:-1] = 200*(xm-xm_m1**2) - 400*(xm_p1 - xm**2)*xm - 2*(1-xm)',
|
477 |
+
' der[0] = -400*x[0]*(x[1]-x[0]**2) - 2*(1-x[0])',
|
478 |
+
' der[-1] = 200*(x[-1]-x[-2]**2)',
|
479 |
+
' return der',
|
480 |
+
'def rosen_hess_p(x,p):',
|
481 |
+
' x = np.asarray(x)',
|
482 |
+
' Hp = np.zeros_like(x)',
|
483 |
+
' Hp[0] = (1200*x[0]**2 - 400*x[1] + 2)*p[0] - 400*x[0]*p[1]',
|
484 |
+
' Hp[1:-1] = (-400*x[:-2]*p[:-2]+(202+1200*x[1:-1]**2-400*x[2:])*p[1:-1] ',
|
485 |
+
' -400*x[1:-1]*p[2:])',
|
486 |
+
' Hp[-1] = -400*x[-2]*p[-2] + 200*p[-1]',
|
487 |
+
' return Hp',
|
488 |
+
'x0 = np.array([1.3, 0.7, 0.8, 1.9, 1.2])',
|
489 |
+
"res = optimize.minimize(rosen, x0, method='Newton-CG', jac=rosen_der, hessp=rosen_hess_p,",
|
490 |
+
" options={'xtol': 1e-8, 'disp': True})",
|
491 |
+
'print(res.x)'],
|
492 |
+
},
|
493 |
+
],
|
494 |
+
},
|
495 |
+
{
|
496 |
+
'name' : 'Constrained multivariate minimization',
|
497 |
+
'sub-menu' : [
|
498 |
+
{
|
499 |
+
'name' : 'Unconstrained Sequential Least SQuares Programming (SLSQP)',
|
500 |
+
'snippet' : [
|
501 |
+
'def func(x, sign=1.0):',
|
502 |
+
' """ Objective function """',
|
503 |
+
' return sign*(2*x[0]*x[1] + 2*x[0] - x[0]**2 - 2*x[1]**2)',
|
504 |
+
'def func_deriv(x, sign=1.0):',
|
505 |
+
' """ Derivative of objective function """',
|
506 |
+
' dfdx0 = sign*(-2*x[0] + 2*x[1] + 2)',
|
507 |
+
' dfdx1 = sign*(2*x[0] - 4*x[1])',
|
508 |
+
' return np.array([ dfdx0, dfdx1 ])',
|
509 |
+
"res = optimize.minimize(func, [-1.0,1.0], args=(-1.0,), jac=func_deriv,",
|
510 |
+
" method='SLSQP', options={'disp': True})",
|
511 |
+
'print(res.x)',
|
512 |
+
],
|
513 |
+
},
|
514 |
+
{
|
515 |
+
'name' : 'Constrained Sequential Least SQuares Programming (SLSQP)',
|
516 |
+
'snippet' : [
|
517 |
+
'def func(x, sign=1.0):',
|
518 |
+
' """ Objective function """',
|
519 |
+
' return sign*(2*x[0]*x[1] + 2*x[0] - x[0]**2 - 2*x[1]**2)',
|
520 |
+
'def func_deriv(x, sign=1.0):',
|
521 |
+
' """ Derivative of objective function """',
|
522 |
+
' dfdx0 = sign*(-2*x[0] + 2*x[1] + 2)',
|
523 |
+
' dfdx1 = sign*(2*x[0] - 4*x[1])',
|
524 |
+
' return np.array([ dfdx0, dfdx1 ])',
|
525 |
+
'# Constraints correspond to x**3-y=0 and y-1>=0, respectively',
|
526 |
+
"cons = ({'type': 'eq',",
|
527 |
+
" 'fun' : lambda x: np.array([x[0]**3 - x[1]]),",
|
528 |
+
" 'jac' : lambda x: np.array([3.0*(x[0]**2.0), -1.0])},",
|
529 |
+
" {'type': 'ineq',",
|
530 |
+
" 'fun' : lambda x: np.array([x[1] - 1]),",
|
531 |
+
" 'jac' : lambda x: np.array([0.0, 1.0])})",
|
532 |
+
"res = optimize.minimize(func, [-1.0,1.0], args=(-1.0,), jac=func_deriv,",
|
533 |
+
" constraints=cons, method='SLSQP', options={'disp': True})",
|
534 |
+
'print(res.x)',
|
535 |
+
],
|
536 |
+
},
|
537 |
+
],
|
538 |
+
},
|
539 |
+
{
|
540 |
+
'name' : 'Fitting (see also numpy.polynomial)',
|
541 |
+
'sub-menu' : [
|
542 |
+
{
|
543 |
+
'name' : 'Basic function fitting',
|
544 |
+
'snippet' : [
|
545 |
+
'def fitting_function(x, a, b, c):',
|
546 |
+
' return a * np.exp(-b * x) + c',
|
547 |
+
'xdata = np.linspace(0, 4, 50)',
|
548 |
+
'ydata = fitting_function(xdata, 2.5, 1.3, 0.5) + 0.2 * np.random.normal(size=len(xdata))',
|
549 |
+
'optimal_parameters, estimated_covariance = optimize.curve_fit(fitting_function, xdata, ydata)',
|
550 |
+
'estimated_std_dev = np.sqrt(np.diag(estimated_covariance))',
|
551 |
+
],
|
552 |
+
},
|
553 |
+
],
|
554 |
+
},
|
555 |
+
],
|
556 |
+
},
|
557 |
+
|
558 |
+
// {
|
559 |
+
// 'name' : 'Signal processing',
|
560 |
+
// 'sub-menu' : [
|
561 |
+
// {
|
562 |
+
// 'name' : 'Setup',
|
563 |
+
// 'snippet' : ['from scipy import signal',],
|
564 |
+
// },
|
565 |
+
// '---',
|
566 |
+
// ],
|
567 |
+
// },
|
568 |
+
|
569 |
+
// {
|
570 |
+
// 'name' : 'Sparse matrices and associated routines',
|
571 |
+
// 'sub-menu' : [
|
572 |
+
// {
|
573 |
+
// 'name' : 'Setup',
|
574 |
+
// 'snippet' : ['from scipy import sparse',],
|
575 |
+
// },
|
576 |
+
// '---',
|
577 |
+
// ],
|
578 |
+
// },
|
579 |
+
|
580 |
+
// {
|
581 |
+
// 'name' : 'Spatial data structures and algorithms',
|
582 |
+
// 'sub-menu' : [
|
583 |
+
// {
|
584 |
+
// 'name' : 'Setup',
|
585 |
+
// 'snippet' : ['from scipy import spatial',],
|
586 |
+
// },
|
587 |
+
// '---',
|
588 |
+
// ],
|
589 |
+
// },
|
590 |
+
|
591 |
+
scipy_special,
|
592 |
+
|
593 |
+
{
|
594 |
+
'name' : 'Statistical distributions and functions',
|
595 |
+
'sub-menu' : [
|
596 |
+
{
|
597 |
+
'name' : 'Setup',
|
598 |
+
'snippet' : ['from scipy import stats',],
|
599 |
+
},
|
600 |
+
'---',
|
601 |
+
{
|
602 |
+
'name' : 'Docs',
|
603 |
+
'external-link' : 'http://docs.scipy.org/doc/scipy-0.15.1/reference/stats.html'
|
604 |
+
},
|
605 |
+
],
|
606 |
+
},
|
607 |
+
|
608 |
+
// {
|
609 |
+
// 'name' : 'C/C++ integration',
|
610 |
+
// 'sub-menu' : [
|
611 |
+
// {
|
612 |
+
// 'name' : 'Setup',
|
613 |
+
// 'snippet' : ['from scipy import weave',],
|
614 |
+
// },
|
615 |
+
// '---',
|
616 |
+
// ],
|
617 |
+
// },
|
618 |
+
],
|
619 |
+
};
|
620 |
+
});
|
.local/share/jupyter/nbextensions/snippets_menu/snippets_submenus_python/scipy_constants.js
ADDED
The diff for this file is too large to render.
See raw diff
|
|
.local/share/jupyter/nbextensions/snippets_menu/snippets_submenus_python/scipy_special.js
ADDED
@@ -0,0 +1,2198 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
define({
|
2 |
+
'name' : 'Special functions',
|
3 |
+
'sub-menu' : [
|
4 |
+
{
|
5 |
+
'name' : 'Setup',
|
6 |
+
'snippet' : ['from scipy import special',],
|
7 |
+
},
|
8 |
+
'---',
|
9 |
+
|
10 |
+
{
|
11 |
+
'name' : 'Airy functions',
|
12 |
+
'sub-menu' : [
|
13 |
+
|
14 |
+
{
|
15 |
+
'name' : 'airy: Airy functions and their derivatives',
|
16 |
+
'snippet' : [
|
17 |
+
'special.airy(z)',
|
18 |
+
],
|
19 |
+
},
|
20 |
+
|
21 |
+
{
|
22 |
+
'name' : 'airye: Exponentially scaled Airy functions and their derivatives',
|
23 |
+
'snippet' : [
|
24 |
+
'special.airye(z)',
|
25 |
+
],
|
26 |
+
},
|
27 |
+
|
28 |
+
{
|
29 |
+
'name' : 'ai_zeros: Compute $n$ zeros $a$ and $a\'$ of $\\mathrm{Ai}(x)$ and $\\mathrm{Ai}\'(x)$, and $\\mathrm{Ai}(a\')$ and $\\mathrm{Ai}\'(a)$',
|
30 |
+
'snippet' : [
|
31 |
+
'special.ai_zeros(n)',
|
32 |
+
],
|
33 |
+
},
|
34 |
+
|
35 |
+
{
|
36 |
+
'name' : 'bi_zeros: Compute $n$ zeros $b$ and $b\'$ of $\\mathrm{Bi}(x)$ and $\\mathrm{Bi}\'(x)$, and $\\mathrm{Bi}(b\')$ and $\\mathrm{Bi}\'(b)$',
|
37 |
+
'snippet' : [
|
38 |
+
'special.bi_zeros(n)',
|
39 |
+
],
|
40 |
+
},
|
41 |
+
|
42 |
+
],
|
43 |
+
},
|
44 |
+
|
45 |
+
{
|
46 |
+
'name' : 'Elliptic Functions',
|
47 |
+
'sub-menu' : [
|
48 |
+
|
49 |
+
{
|
50 |
+
'name' : 'ellipj: Jacobian elliptic functions',
|
51 |
+
'snippet' : [
|
52 |
+
'special.ellipj(u, m)',
|
53 |
+
],
|
54 |
+
},
|
55 |
+
|
56 |
+
{
|
57 |
+
'name' : 'ellipk: Computes the complete elliptic integral of the first kind',
|
58 |
+
'snippet' : [
|
59 |
+
'special.ellipk(m)',
|
60 |
+
],
|
61 |
+
},
|
62 |
+
|
63 |
+
{
|
64 |
+
'name' : 'ellipkm1: The complete elliptic integral of the first kind around m=1',
|
65 |
+
'snippet' : [
|
66 |
+
'special.ellipkm1(p)',
|
67 |
+
],
|
68 |
+
},
|
69 |
+
|
70 |
+
{
|
71 |
+
'name' : 'ellipkinc: Incomplete elliptic integral of the first kind',
|
72 |
+
'snippet' : [
|
73 |
+
'special.ellipkinc(phi, m)',
|
74 |
+
],
|
75 |
+
},
|
76 |
+
|
77 |
+
{
|
78 |
+
'name' : 'ellipe: Complete elliptic integral of the second kind',
|
79 |
+
'snippet' : [
|
80 |
+
'special.ellipe(m)',
|
81 |
+
],
|
82 |
+
},
|
83 |
+
|
84 |
+
{
|
85 |
+
'name' : 'ellipeinc: Incomplete elliptic integral of the second kind',
|
86 |
+
'snippet' : [
|
87 |
+
'special.ellipeinc(phi,m)',
|
88 |
+
],
|
89 |
+
},
|
90 |
+
|
91 |
+
],
|
92 |
+
},
|
93 |
+
|
94 |
+
{
|
95 |
+
'name' : 'Bessel Functions',
|
96 |
+
'sub-menu' : [
|
97 |
+
|
98 |
+
{
|
99 |
+
'name' : 'Bessel Functions',
|
100 |
+
'sub-menu' : [
|
101 |
+
|
102 |
+
{
|
103 |
+
'name' : 'jv: Bessel function of the first kind of real order $v$, $J_v(z)$',
|
104 |
+
'snippet' : [
|
105 |
+
'special.jv(v, z)',
|
106 |
+
],
|
107 |
+
},
|
108 |
+
|
109 |
+
{
|
110 |
+
'name' : 'jve: Exponentially scaled Bessel function of the first kind of order $v$, $J_v(z)\\, e^{-|\\Im{z}|}$',
|
111 |
+
'snippet' : [
|
112 |
+
'special.jve(v, z)',
|
113 |
+
],
|
114 |
+
},
|
115 |
+
|
116 |
+
{
|
117 |
+
'name' : 'yn: Bessel function of the second kind of integer order $n$, $Y_n(x)$',
|
118 |
+
'snippet' : [
|
119 |
+
'special.yn(n,x)',
|
120 |
+
],
|
121 |
+
},
|
122 |
+
|
123 |
+
{
|
124 |
+
'name' : 'yv: Bessel function of the second kind of real order $v$, $Y_v(z)$',
|
125 |
+
'snippet' : [
|
126 |
+
'special.yv(v,z)',
|
127 |
+
],
|
128 |
+
},
|
129 |
+
|
130 |
+
{
|
131 |
+
'name' : 'yve: Exponentially scaled Bessel function of the second kind of real order, $Y_v(z)\\, e^{-|\\Im{z}|}$',
|
132 |
+
'snippet' : [
|
133 |
+
'special.yve(v,z)',
|
134 |
+
],
|
135 |
+
},
|
136 |
+
|
137 |
+
{
|
138 |
+
'name' : 'kn: Modified Bessel function of the second kind of integer order $n$, $K_n(x)$',
|
139 |
+
'snippet' : [
|
140 |
+
'special.kn(n, x)',
|
141 |
+
],
|
142 |
+
},
|
143 |
+
|
144 |
+
{
|
145 |
+
'name' : 'kv: Modified Bessel function of the second kind of real order $v$, $K_v(z)$',
|
146 |
+
'snippet' : [
|
147 |
+
'special.kv(v,z)',
|
148 |
+
],
|
149 |
+
},
|
150 |
+
|
151 |
+
{
|
152 |
+
'name' : 'kve: Exponentially scaled modified Bessel function of the second kind, $K_v(z)\\, e^{z}$',
|
153 |
+
'snippet' : [
|
154 |
+
'special.kve(v,z)',
|
155 |
+
],
|
156 |
+
},
|
157 |
+
|
158 |
+
{
|
159 |
+
'name' : 'iv: Modified Bessel function of the first kind of real order $v$, $I_v(z)$',
|
160 |
+
'snippet' : [
|
161 |
+
'special.iv(v,z)',
|
162 |
+
],
|
163 |
+
},
|
164 |
+
|
165 |
+
{
|
166 |
+
'name' : 'ive: Exponentially scaled modified Bessel function of the first kind of real order $v$, $I_v(z)\\, e^{-|\\Re{z}|}$',
|
167 |
+
'snippet' : [
|
168 |
+
'special.ive(v,z)',
|
169 |
+
],
|
170 |
+
},
|
171 |
+
|
172 |
+
{
|
173 |
+
'name' : 'hankel1: Hankel function of the first kind, $H^{(1)}_v(z)$',
|
174 |
+
'snippet' : [
|
175 |
+
'special.hankel1(v, z)',
|
176 |
+
],
|
177 |
+
},
|
178 |
+
|
179 |
+
{
|
180 |
+
'name' : 'hankel1e: Exponentially scaled Hankel function of the first kind, $H^{(1)}_v(z)\\, e^{-i\\, z}$',
|
181 |
+
'snippet' : [
|
182 |
+
'special.hankel1e(v, z)',
|
183 |
+
],
|
184 |
+
},
|
185 |
+
|
186 |
+
{
|
187 |
+
'name' : 'hankel2: Hankel function of the second kind, $H^{(2)}_v(z)$',
|
188 |
+
'snippet' : [
|
189 |
+
'special.hankel2(v, z)',
|
190 |
+
],
|
191 |
+
},
|
192 |
+
|
193 |
+
{
|
194 |
+
'name' : 'hankel2e: Exponentially scaled Hankel function of the second kind, $H^{(2)}_v(z)\\, e^{i\\, z}$',
|
195 |
+
'snippet' : [
|
196 |
+
'special.hankel2e(v, z)',
|
197 |
+
],
|
198 |
+
},
|
199 |
+
|
200 |
+
// The following is not an universal function:
|
201 |
+
|
202 |
+
{
|
203 |
+
'name' : 'lmbda: Compute sequence of lambda functions with arbitrary order $v$ and their derivatives',
|
204 |
+
'snippet' : [
|
205 |
+
'special.lmbda(v, x)',
|
206 |
+
],
|
207 |
+
},
|
208 |
+
|
209 |
+
],
|
210 |
+
},
|
211 |
+
|
212 |
+
{
|
213 |
+
'name' : 'Zeros of Bessel Functions',
|
214 |
+
'sub-menu' : [
|
215 |
+
|
216 |
+
// These are not universal functions:
|
217 |
+
|
218 |
+
{
|
219 |
+
'name' : 'jnjnp_zeros: Compute nt (<=1200) zeros of the Bessel functions $J_n$ and $J_n\'$ and arange them in order of their magnitudes',
|
220 |
+
'snippet' : [
|
221 |
+
'special.jnjnp_zeros(nt)',
|
222 |
+
],
|
223 |
+
},
|
224 |
+
|
225 |
+
{
|
226 |
+
'name' : 'jnyn_zeros: Compute nt zeros of the Bessel functions $J_n(x)$, $J_n\'(x)$, $Y_n(x)$, and $Y_n\'(x)$, respectively',
|
227 |
+
'snippet' : [
|
228 |
+
'special.jnyn_zeros(n, nt)',
|
229 |
+
],
|
230 |
+
},
|
231 |
+
|
232 |
+
{
|
233 |
+
'name' : 'jn_zeros: Compute nt zeros of the Bessel function $J_n(x)$',
|
234 |
+
'snippet' : [
|
235 |
+
'special.jn_zeros(n, nt)',
|
236 |
+
],
|
237 |
+
},
|
238 |
+
|
239 |
+
{
|
240 |
+
'name' : 'jnp_zeros: Compute nt zeros of the Bessel function $J_n\'(x)$',
|
241 |
+
'snippet' : [
|
242 |
+
'special.jnp_zeros(n, nt)',
|
243 |
+
],
|
244 |
+
},
|
245 |
+
|
246 |
+
{
|
247 |
+
'name' : 'yn_zeros: Compute nt zeros of the Bessel function $Y_n(x)$',
|
248 |
+
'snippet' : [
|
249 |
+
'special.yn_zeros(n, nt)',
|
250 |
+
],
|
251 |
+
},
|
252 |
+
|
253 |
+
{
|
254 |
+
'name' : 'ynp_zeros: Compute nt zeros of the Bessel function $Y_n\'(x)$',
|
255 |
+
'snippet' : [
|
256 |
+
'special.ynp_zeros(n, nt)',
|
257 |
+
],
|
258 |
+
},
|
259 |
+
|
260 |
+
{
|
261 |
+
'name' : 'y0_zeros: Returns nt (complex or real) zeros of $Y_0(z)$, $z_0$, and the value of $Y_0\'(z_0) = -Y_1(z_0)$ at each zero',
|
262 |
+
'snippet' : [
|
263 |
+
'special.y0_zeros(nt, complex=0)',
|
264 |
+
],
|
265 |
+
},
|
266 |
+
|
267 |
+
{
|
268 |
+
'name' : 'y1_zeros: Returns nt (complex or real) zeros of $Y_1(z)$, $z_1$, and the value of $Y_1\'(z_1) = Y_0(z_1)$ at each zero',
|
269 |
+
'snippet' : [
|
270 |
+
'special.y1_zeros(nt, complex=0)',
|
271 |
+
],
|
272 |
+
},
|
273 |
+
|
274 |
+
{
|
275 |
+
'name' : 'y1p_zeros: Returns nt (complex or real) zeros of $Y_1\'(z)$, $z_1\'$, and the value of $Y_1(z_1\')$ at each zero',
|
276 |
+
'snippet' : [
|
277 |
+
'special.y1p_zeros(nt, complex=0)',
|
278 |
+
],
|
279 |
+
},
|
280 |
+
|
281 |
+
],
|
282 |
+
},
|
283 |
+
|
284 |
+
{
|
285 |
+
'name' : 'Faster versions of common Bessel Functions',
|
286 |
+
'sub-menu' : [
|
287 |
+
|
288 |
+
{
|
289 |
+
'name' : 'j0: Bessel function the first kind of order 0, $J_0(x)$',
|
290 |
+
'snippet' : [
|
291 |
+
'special.j0(x)',
|
292 |
+
],
|
293 |
+
},
|
294 |
+
|
295 |
+
{
|
296 |
+
'name' : 'j1: Bessel function of the first kind of order 1, $J_1(x)$',
|
297 |
+
'snippet' : [
|
298 |
+
'special.j1(x)',
|
299 |
+
],
|
300 |
+
},
|
301 |
+
|
302 |
+
{
|
303 |
+
'name' : 'y0: Bessel function of the second kind of order 0, $Y_0(x)$',
|
304 |
+
'snippet' : [
|
305 |
+
'special.y0(x)',
|
306 |
+
],
|
307 |
+
},
|
308 |
+
|
309 |
+
{
|
310 |
+
'name' : 'y1: Bessel function of the second kind of order 1, $Y_1(x)$',
|
311 |
+
'snippet' : [
|
312 |
+
'special.y1(x)',
|
313 |
+
],
|
314 |
+
},
|
315 |
+
|
316 |
+
{
|
317 |
+
'name' : 'i0: Modified Bessel function of order 0, $I_0(x)$',
|
318 |
+
'snippet' : [
|
319 |
+
'special.i0(x)',
|
320 |
+
],
|
321 |
+
},
|
322 |
+
|
323 |
+
{
|
324 |
+
'name' : 'i0e: Exponentially scaled modified Bessel function of order 0, $I_0(x)\\, e^{-|x|}$',
|
325 |
+
'snippet' : [
|
326 |
+
'special.i0e(x)',
|
327 |
+
],
|
328 |
+
},
|
329 |
+
|
330 |
+
{
|
331 |
+
'name' : 'i1: Modified Bessel function of order 1, $I_1(x)$',
|
332 |
+
'snippet' : [
|
333 |
+
'special.i1(x)',
|
334 |
+
],
|
335 |
+
},
|
336 |
+
|
337 |
+
{
|
338 |
+
'name' : 'i1e: Exponentially scaled modified Bessel function of order 1, $I_1(x)\\, e^{-|x|}$',
|
339 |
+
'snippet' : [
|
340 |
+
'special.i1e(x)',
|
341 |
+
],
|
342 |
+
},
|
343 |
+
|
344 |
+
{
|
345 |
+
'name' : 'k0: Modified Bessel function K of order 0, $K_0(x)$',
|
346 |
+
'snippet' : [
|
347 |
+
'special.k0(x)',
|
348 |
+
],
|
349 |
+
},
|
350 |
+
|
351 |
+
{
|
352 |
+
'name' : 'k0e: Exponentially scaled modified Bessel function K of order 0, $K_0(x)\\, e^{x}$',
|
353 |
+
'snippet' : [
|
354 |
+
'special.k0e(x)',
|
355 |
+
],
|
356 |
+
},
|
357 |
+
|
358 |
+
{
|
359 |
+
'name' : 'k1: Modified Bessel function of the first kind of order 1, $K_1(x)$',
|
360 |
+
'snippet' : [
|
361 |
+
'special.k1(x)',
|
362 |
+
],
|
363 |
+
},
|
364 |
+
|
365 |
+
{
|
366 |
+
'name' : 'k1e: Exponentially scaled modified Bessel function K of order 1, $K_1(x)\\, e^{x}$',
|
367 |
+
'snippet' : [
|
368 |
+
'special.k1e(x)',
|
369 |
+
],
|
370 |
+
},
|
371 |
+
|
372 |
+
],
|
373 |
+
},
|
374 |
+
|
375 |
+
{
|
376 |
+
'name' : 'Integrals of Bessel Functions',
|
377 |
+
'sub-menu' : [
|
378 |
+
|
379 |
+
{
|
380 |
+
'name' : 'itj0y0: Integrals of Bessel functions of order 0: $\\int_0^x J_0(t)\\, dt$, $\\int_0^x Y_0(t)\\, dt$',
|
381 |
+
'snippet' : [
|
382 |
+
'special.itj0y0(x)',
|
383 |
+
],
|
384 |
+
},
|
385 |
+
|
386 |
+
{
|
387 |
+
'name' : 'it2j0y0: Integrals related to Bessel functions of order 0: $\\int_0^x \\frac{1-J_0(t)}{t}\\, dt$, $\\int_x^\\infty \\frac{Y_0(t)}{t}\\, dt$',
|
388 |
+
'snippet' : [
|
389 |
+
'special.it2j0y0(x)',
|
390 |
+
],
|
391 |
+
},
|
392 |
+
|
393 |
+
{
|
394 |
+
'name' : 'iti0k0: Integrals of modified Bessel functions of order 0: $\\int_0^x I_0(t)\\, dt$, $\\int_0^x K_0(t)\\, dt$',
|
395 |
+
'snippet' : [
|
396 |
+
'special.iti0k0(x)',
|
397 |
+
],
|
398 |
+
},
|
399 |
+
|
400 |
+
{
|
401 |
+
'name' : 'it2i0k0: Integrals related to modified Bessel functions of order 0: $\\int_0^x \\frac{I_0(t)-1}{t}\\, dt$, $\\int_x^\\infty \\frac{K_0(t)}{t}\\, dt$',
|
402 |
+
'snippet' : [
|
403 |
+
'special.it2i0k0(x)',
|
404 |
+
],
|
405 |
+
},
|
406 |
+
|
407 |
+
{
|
408 |
+
'name' : 'besselpoly: Weighted integral of a Bessel function, $\\int_0^1 x^\\lambda J_\\nu(2 a x) \\, dx$',
|
409 |
+
'snippet' : [
|
410 |
+
'special.besselpoly(a, lmb, nu)',
|
411 |
+
],
|
412 |
+
},
|
413 |
+
|
414 |
+
],
|
415 |
+
},
|
416 |
+
|
417 |
+
{
|
418 |
+
'name' : 'Derivatives of Bessel Functions',
|
419 |
+
'sub-menu' : [
|
420 |
+
|
421 |
+
{
|
422 |
+
'name' : 'jvp: Return the $n$th derivative of $J_v(z)$ with respect to $z$',
|
423 |
+
'snippet' : [
|
424 |
+
'special.jvp(v, z, n=1)',
|
425 |
+
],
|
426 |
+
},
|
427 |
+
|
428 |
+
{
|
429 |
+
'name' : 'yvp: Return the $n$th derivative of $Y_v(z)$ with respect to $z$',
|
430 |
+
'snippet' : [
|
431 |
+
'special.yvp(v, z, n=1)',
|
432 |
+
],
|
433 |
+
},
|
434 |
+
|
435 |
+
{
|
436 |
+
'name' : 'kvp: Return the $n$th derivative of $K_v(z)$ with respect to $z$',
|
437 |
+
'snippet' : [
|
438 |
+
'special.kvp(v, z, n=1)',
|
439 |
+
],
|
440 |
+
},
|
441 |
+
|
442 |
+
{
|
443 |
+
'name' : 'ivp: Return the $n$th derivative of $I_v(z)$ with respect to $z$',
|
444 |
+
'snippet' : [
|
445 |
+
'special.ivp(v, z, n=1)',
|
446 |
+
],
|
447 |
+
},
|
448 |
+
|
449 |
+
{
|
450 |
+
'name' : 'h1vp: Return the $n$th derivative of $H^{(1)}_v(z)$ with respect to $z$',
|
451 |
+
'snippet' : [
|
452 |
+
'special.h1vp(v, z, n=1)',
|
453 |
+
],
|
454 |
+
},
|
455 |
+
|
456 |
+
{
|
457 |
+
'name' : 'h2vp: Return the $n$th derivative of $H^{(2)}_v(z)$ with respect to z',
|
458 |
+
'snippet' : [
|
459 |
+
'special.h2vp(v, z, n=1)',
|
460 |
+
],
|
461 |
+
},
|
462 |
+
|
463 |
+
],
|
464 |
+
},
|
465 |
+
|
466 |
+
{
|
467 |
+
'name' : 'Spherical Bessel Functions',
|
468 |
+
'sub-menu' : [
|
469 |
+
|
470 |
+
// These are not universal functions:
|
471 |
+
|
472 |
+
{
|
473 |
+
'name' : 'sph_jn: Compute the spherical Bessel function $j_n(z)$ and its derivative for all orders up to and including $n$',
|
474 |
+
'snippet' : [
|
475 |
+
'special.sph_jn(n, z)',
|
476 |
+
],
|
477 |
+
},
|
478 |
+
|
479 |
+
{
|
480 |
+
'name' : 'sph_yn: Compute the spherical Bessel function $y_n(z)$ and its derivative for all orders up to and including $n$',
|
481 |
+
'snippet' : [
|
482 |
+
'special.sph_yn(n, z)',
|
483 |
+
],
|
484 |
+
},
|
485 |
+
|
486 |
+
{
|
487 |
+
'name' : 'sph_jnyn: Compute the spherical Bessel functions, $j_n(z)$ and $y_n(z)$ and their derivatives for all orders up to and including $n$',
|
488 |
+
'snippet' : [
|
489 |
+
'special.sph_jnyn(n, z)',
|
490 |
+
],
|
491 |
+
},
|
492 |
+
|
493 |
+
{
|
494 |
+
'name' : 'sph_in: Compute the spherical Bessel function $i_n(z)$ and its derivative for all orders up to and including $n$',
|
495 |
+
'snippet' : [
|
496 |
+
'special.sph_in(n, z)',
|
497 |
+
],
|
498 |
+
},
|
499 |
+
|
500 |
+
{
|
501 |
+
'name' : 'sph_kn: Compute the spherical Bessel function $k_n(z)$ and its derivative for all orders up to and including $n$',
|
502 |
+
'snippet' : [
|
503 |
+
'special.sph_kn(n, z)',
|
504 |
+
],
|
505 |
+
},
|
506 |
+
|
507 |
+
{
|
508 |
+
'name' : 'sph_inkn: Compute the spherical Bessel functions, $i_n(z)$ and $k_n(z)$ and their derivatives for all orders up to and including $n$',
|
509 |
+
'snippet' : [
|
510 |
+
'special.sph_inkn(n, z)',
|
511 |
+
],
|
512 |
+
},
|
513 |
+
|
514 |
+
],
|
515 |
+
},
|
516 |
+
|
517 |
+
{
|
518 |
+
'name' : 'Riccati-Bessel Functions',
|
519 |
+
'sub-menu' : [
|
520 |
+
|
521 |
+
// These are not universal functions:
|
522 |
+
|
523 |
+
{
|
524 |
+
'name' : 'riccati_jn: Compute the Ricatti-Bessel function of the first kind and its derivative for all orders up to and including n',
|
525 |
+
'snippet' : [
|
526 |
+
'special.riccati_jn(n, x)',
|
527 |
+
],
|
528 |
+
},
|
529 |
+
|
530 |
+
{
|
531 |
+
'name' : 'riccati_yn: Compute the Ricatti-Bessel function of the second kind and its derivative for all orders up to and including n',
|
532 |
+
'snippet' : [
|
533 |
+
'special.riccati_yn(n, x)',
|
534 |
+
],
|
535 |
+
},
|
536 |
+
|
537 |
+
],
|
538 |
+
},
|
539 |
+
],
|
540 |
+
},
|
541 |
+
|
542 |
+
{
|
543 |
+
'name' : 'Struve Functions',
|
544 |
+
'sub-menu' : [
|
545 |
+
|
546 |
+
{
|
547 |
+
'name' : 'struve: Struve function',
|
548 |
+
'snippet' : [
|
549 |
+
'special.struve(v,x)',
|
550 |
+
],
|
551 |
+
},
|
552 |
+
|
553 |
+
{
|
554 |
+
'name' : 'modstruve: Modified Struve function',
|
555 |
+
'snippet' : [
|
556 |
+
'special.modstruve(v, x)',
|
557 |
+
],
|
558 |
+
},
|
559 |
+
|
560 |
+
{
|
561 |
+
'name' : 'itstruve0: Integral of the Struve function of order 0',
|
562 |
+
'snippet' : [
|
563 |
+
'special.itstruve0(x)',
|
564 |
+
],
|
565 |
+
},
|
566 |
+
|
567 |
+
{
|
568 |
+
'name' : 'it2struve0: Integral related to Struve function of order 0',
|
569 |
+
'snippet' : [
|
570 |
+
'special.it2struve0(x)',
|
571 |
+
],
|
572 |
+
},
|
573 |
+
|
574 |
+
{
|
575 |
+
'name' : 'itmodstruve0: Integral of the modified Struve function of order 0',
|
576 |
+
'snippet' : [
|
577 |
+
'special.itmodstruve0(x)',
|
578 |
+
],
|
579 |
+
},
|
580 |
+
|
581 |
+
],
|
582 |
+
},
|
583 |
+
|
584 |
+
{
|
585 |
+
'name' : 'Statistical Functions (see also scipy.stats)',
|
586 |
+
'sub-menu' : [
|
587 |
+
|
588 |
+
// See also
|
589 |
+
// scipy.stats: Friendly versions of these functions.
|
590 |
+
|
591 |
+
{
|
592 |
+
'name' : 'bdtr: Binomial distribution cumulative distribution function',
|
593 |
+
'snippet' : [
|
594 |
+
'special.bdtr(k, n, p)',
|
595 |
+
],
|
596 |
+
},
|
597 |
+
|
598 |
+
{
|
599 |
+
'name' : 'bdtrc: Binomial distribution survival function',
|
600 |
+
'snippet' : [
|
601 |
+
'special.bdtrc(k, n, p)',
|
602 |
+
],
|
603 |
+
},
|
604 |
+
|
605 |
+
{
|
606 |
+
'name' : 'bdtri: Inverse function to bdtr vs',
|
607 |
+
'snippet' : [
|
608 |
+
'special.bdtri(k, n, y)',
|
609 |
+
],
|
610 |
+
},
|
611 |
+
|
612 |
+
{
|
613 |
+
'name' : 'btdtr: Cumulative beta distribution',
|
614 |
+
'snippet' : [
|
615 |
+
'special.btdtr(a,b,x)',
|
616 |
+
],
|
617 |
+
},
|
618 |
+
|
619 |
+
{
|
620 |
+
'name' : 'btdtri: p-th quantile of the beta distribution',
|
621 |
+
'snippet' : [
|
622 |
+
'special.btdtri(a,b,p)',
|
623 |
+
],
|
624 |
+
},
|
625 |
+
|
626 |
+
{
|
627 |
+
'name' : 'fdtr: F cumulative distribution function',
|
628 |
+
'snippet' : [
|
629 |
+
'special.fdtr(dfn, dfd, x)',
|
630 |
+
],
|
631 |
+
},
|
632 |
+
|
633 |
+
{
|
634 |
+
'name' : 'fdtrc: F survival function',
|
635 |
+
'snippet' : [
|
636 |
+
'special.fdtrc(dfn, dfd, x)',
|
637 |
+
],
|
638 |
+
},
|
639 |
+
|
640 |
+
{
|
641 |
+
'name' : 'fdtri: Inverse to fdtr vs x',
|
642 |
+
'snippet' : [
|
643 |
+
'special.fdtri(dfn, dfd, p)',
|
644 |
+
],
|
645 |
+
},
|
646 |
+
|
647 |
+
{
|
648 |
+
'name' : 'gdtr: Gamma distribution cumulative density function',
|
649 |
+
'snippet' : [
|
650 |
+
'special.gdtr(a,b,x)',
|
651 |
+
],
|
652 |
+
},
|
653 |
+
|
654 |
+
{
|
655 |
+
'name' : 'gdtrc: Gamma distribution survival function',
|
656 |
+
'snippet' : [
|
657 |
+
'special.gdtrc(a,b,x)',
|
658 |
+
],
|
659 |
+
},
|
660 |
+
|
661 |
+
{
|
662 |
+
'name' : 'gdtria: Inverse of gdtr vs a',
|
663 |
+
'snippet' : [
|
664 |
+
'special.gdtria(p, b, x)',
|
665 |
+
],
|
666 |
+
},
|
667 |
+
|
668 |
+
{
|
669 |
+
'name' : 'gdtrib: Inverse of gdtr vs b',
|
670 |
+
'snippet' : [
|
671 |
+
'special.gdtrib(a, p, x)',
|
672 |
+
],
|
673 |
+
},
|
674 |
+
|
675 |
+
{
|
676 |
+
'name' : 'gdtrix: Inverse of gdtr vs x',
|
677 |
+
'snippet' : [
|
678 |
+
'special.gdtrix(a, b, p)',
|
679 |
+
],
|
680 |
+
},
|
681 |
+
|
682 |
+
{
|
683 |
+
'name' : 'nbdtr: Negative binomial cumulative distribution function',
|
684 |
+
'snippet' : [
|
685 |
+
'special.nbdtr(k, n, p)',
|
686 |
+
],
|
687 |
+
},
|
688 |
+
|
689 |
+
{
|
690 |
+
'name' : 'nbdtrc: Negative binomial survival function',
|
691 |
+
'snippet' : [
|
692 |
+
'special.nbdtrc(k,n,p)',
|
693 |
+
],
|
694 |
+
},
|
695 |
+
|
696 |
+
{
|
697 |
+
'name' : 'nbdtri: Inverse of nbdtr vs p',
|
698 |
+
'snippet' : [
|
699 |
+
'special.nbdtri(k, n, y)',
|
700 |
+
],
|
701 |
+
},
|
702 |
+
|
703 |
+
{
|
704 |
+
'name' : 'ncfdtr: Cumulative distribution function of the non-central $F$ distribution.',
|
705 |
+
'snippet' : [
|
706 |
+
'special.ncfdtr(dfn, dfd, nc, f)',
|
707 |
+
],
|
708 |
+
},
|
709 |
+
|
710 |
+
{
|
711 |
+
'name' : 'ncfdtridfd: Calculate degrees of freedom (denominator) for the noncentral $F$ distribution.',
|
712 |
+
'snippet' : [
|
713 |
+
'special.ncfdtridfd(p, f, dfn, nc)',
|
714 |
+
],
|
715 |
+
},
|
716 |
+
|
717 |
+
{
|
718 |
+
'name' : 'ncfdtridfn: Calculate degrees of freedom (numerator) for the noncentral $F$ distribution.',
|
719 |
+
'snippet' : [
|
720 |
+
'special.ncfdtridfn(p, f, dfd, nc)',
|
721 |
+
],
|
722 |
+
},
|
723 |
+
|
724 |
+
{
|
725 |
+
'name' : 'ncfdtri: Inverse cumulative distribution function of the non-central $F$ distribution.',
|
726 |
+
'snippet' : [
|
727 |
+
'special.ncfdtri(p, dfn, dfd, nc)',
|
728 |
+
],
|
729 |
+
},
|
730 |
+
|
731 |
+
{
|
732 |
+
'name' : 'ncfdtrinc: Calculate non-centrality parameter for non-central $F$ distribution.',
|
733 |
+
'snippet' : [
|
734 |
+
'special.ncfdtrinc(p, f, dfn, dfd)',
|
735 |
+
],
|
736 |
+
},
|
737 |
+
|
738 |
+
{
|
739 |
+
'name' : 'nctdtr: Cumulative distribution function of the non-central $t$ distribution.',
|
740 |
+
'snippet' : [
|
741 |
+
'special.nctdtr(df, nc, t)',
|
742 |
+
],
|
743 |
+
},
|
744 |
+
|
745 |
+
{
|
746 |
+
'name' : 'nctdtridf: Calculate degrees of freedom for non-central $t$ distribution.',
|
747 |
+
'snippet' : [
|
748 |
+
'special.nctdtridf(p, nc, t)',
|
749 |
+
],
|
750 |
+
},
|
751 |
+
|
752 |
+
{
|
753 |
+
'name' : 'nctdtrit: Inverse cumulative distribution function of the non-central $t$ distribution.',
|
754 |
+
'snippet' : [
|
755 |
+
'special.nctdtrit(df, nc, p)',
|
756 |
+
],
|
757 |
+
},
|
758 |
+
|
759 |
+
{
|
760 |
+
'name' : 'nctdtrinc: Calculate non-centrality parameter for non-central $t$ distribution.',
|
761 |
+
'snippet' : [
|
762 |
+
'special.nctdtrinc(df, p, t)',
|
763 |
+
],
|
764 |
+
},
|
765 |
+
|
766 |
+
{
|
767 |
+
'name' : 'nrdtrimn: Calculate mean of normal distribution given other params.',
|
768 |
+
'snippet' : [
|
769 |
+
'special.nrdtrimn(p, x, std)',
|
770 |
+
],
|
771 |
+
},
|
772 |
+
|
773 |
+
{
|
774 |
+
'name' : 'nrdtrisd: Calculate standard deviation of normal distribution given other params.',
|
775 |
+
'snippet' : [
|
776 |
+
'special.nrdtrisd(p, x, mn)',
|
777 |
+
],
|
778 |
+
},
|
779 |
+
|
780 |
+
{
|
781 |
+
'name' : 'pdtr: Poisson cumulative distribution function',
|
782 |
+
'snippet' : [
|
783 |
+
'special.pdtr(k, m)',
|
784 |
+
],
|
785 |
+
},
|
786 |
+
|
787 |
+
{
|
788 |
+
'name' : 'pdtrc: Poisson survival function',
|
789 |
+
'snippet' : [
|
790 |
+
'special.pdtrc(k, m)',
|
791 |
+
],
|
792 |
+
},
|
793 |
+
|
794 |
+
{
|
795 |
+
'name' : 'pdtri: Inverse to pdtr vs m',
|
796 |
+
'snippet' : [
|
797 |
+
'special.pdtri(k,y)',
|
798 |
+
],
|
799 |
+
},
|
800 |
+
|
801 |
+
{
|
802 |
+
'name' : 'stdtr: Student $t$ distribution cumulative density function',
|
803 |
+
'snippet' : [
|
804 |
+
'special.stdtr(df,t)',
|
805 |
+
],
|
806 |
+
},
|
807 |
+
|
808 |
+
{
|
809 |
+
'name' : 'stdtridf: Inverse of stdtr vs df',
|
810 |
+
'snippet' : [
|
811 |
+
'special.stdtridf(p,t)',
|
812 |
+
],
|
813 |
+
},
|
814 |
+
|
815 |
+
{
|
816 |
+
'name' : 'stdtrit: Inverse of stdtr vs t',
|
817 |
+
'snippet' : [
|
818 |
+
'special.stdtrit(df,p)',
|
819 |
+
],
|
820 |
+
},
|
821 |
+
|
822 |
+
{
|
823 |
+
'name' : 'chdtr: Chi square cumulative distribution function',
|
824 |
+
'snippet' : [
|
825 |
+
'special.chdtr(v, x)',
|
826 |
+
],
|
827 |
+
},
|
828 |
+
|
829 |
+
{
|
830 |
+
'name' : 'chdtrc: Chi square survival function',
|
831 |
+
'snippet' : [
|
832 |
+
'special.chdtrc(v,x)',
|
833 |
+
],
|
834 |
+
},
|
835 |
+
|
836 |
+
{
|
837 |
+
'name' : 'chdtri: Inverse to chdtrc',
|
838 |
+
'snippet' : [
|
839 |
+
'special.chdtri(v,p)',
|
840 |
+
],
|
841 |
+
},
|
842 |
+
|
843 |
+
{
|
844 |
+
'name' : 'ndtr: Gaussian cumulative distribution function',
|
845 |
+
'snippet' : [
|
846 |
+
'special.ndtr(x)',
|
847 |
+
],
|
848 |
+
},
|
849 |
+
|
850 |
+
{
|
851 |
+
'name' : 'ndtri: Inverse of ndtr vs x',
|
852 |
+
'snippet' : [
|
853 |
+
'special.ndtri(y)',
|
854 |
+
],
|
855 |
+
},
|
856 |
+
|
857 |
+
{
|
858 |
+
'name' : 'smirnov: Kolmogorov-Smirnov complementary cumulative distribution function',
|
859 |
+
'snippet' : [
|
860 |
+
'special.smirnov(n,e)',
|
861 |
+
],
|
862 |
+
},
|
863 |
+
|
864 |
+
{
|
865 |
+
'name' : 'smirnovi: Inverse to smirnov',
|
866 |
+
'snippet' : [
|
867 |
+
'special.smirnovi(n,y)',
|
868 |
+
],
|
869 |
+
},
|
870 |
+
|
871 |
+
{
|
872 |
+
'name' : 'kolmogorov: Complementary cumulative distribution function of Kolmogorov distribution',
|
873 |
+
'snippet' : [
|
874 |
+
'special.kolmogorov(y)',
|
875 |
+
],
|
876 |
+
},
|
877 |
+
|
878 |
+
{
|
879 |
+
'name' : 'kolmogi: Inverse function to kolmogorov',
|
880 |
+
'snippet' : [
|
881 |
+
'special.kolmogi(p)',
|
882 |
+
],
|
883 |
+
},
|
884 |
+
|
885 |
+
{
|
886 |
+
'name' : 'tklmbda: Tukey-Lambda cumulative distribution function',
|
887 |
+
'snippet' : [
|
888 |
+
'special.tklmbda(x, lmbda)',
|
889 |
+
],
|
890 |
+
},
|
891 |
+
|
892 |
+
{
|
893 |
+
'name' : 'logit: Logit ufunc for ndarrays',
|
894 |
+
'snippet' : [
|
895 |
+
'special.logit(x)',
|
896 |
+
],
|
897 |
+
},
|
898 |
+
|
899 |
+
{
|
900 |
+
'name' : 'expit: Expit ufunc for ndarrays',
|
901 |
+
'snippet' : [
|
902 |
+
'special.expit(x)',
|
903 |
+
],
|
904 |
+
},
|
905 |
+
|
906 |
+
{
|
907 |
+
'name' : 'boxcox: Compute the Box-Cox transformation',
|
908 |
+
'snippet' : [
|
909 |
+
'special.boxcox(x, lmbda)',
|
910 |
+
],
|
911 |
+
},
|
912 |
+
|
913 |
+
{
|
914 |
+
'name' : 'boxcox1p: Compute the Box-Cox transformation of 1 + x',
|
915 |
+
'snippet' : [
|
916 |
+
'special.boxcox1p(x, lmbda)',
|
917 |
+
],
|
918 |
+
},
|
919 |
+
|
920 |
+
],
|
921 |
+
},
|
922 |
+
|
923 |
+
{
|
924 |
+
'name' : 'Information Theory Functions',
|
925 |
+
'sub-menu' : [
|
926 |
+
{
|
927 |
+
'name' : 'entr: Elementwise function for computing entropy.',
|
928 |
+
'snippet' : [
|
929 |
+
'special.entr(x)',
|
930 |
+
],
|
931 |
+
},
|
932 |
+
|
933 |
+
{
|
934 |
+
'name' : 'rel_entr: Elementwise function for computing relative entropy.',
|
935 |
+
'snippet' : [
|
936 |
+
'special.rel_entr(x, y)',
|
937 |
+
],
|
938 |
+
},
|
939 |
+
|
940 |
+
{
|
941 |
+
'name' : 'kl_div: Elementwise function for computing Kullback-Leibler divergence.',
|
942 |
+
'snippet' : [
|
943 |
+
'special.kl_div(x, y)',
|
944 |
+
],
|
945 |
+
},
|
946 |
+
|
947 |
+
{
|
948 |
+
'name' : 'huber: Huber loss function.',
|
949 |
+
'snippet' : [
|
950 |
+
'special.huber(delta, r)',
|
951 |
+
],
|
952 |
+
},
|
953 |
+
|
954 |
+
{
|
955 |
+
'name' : 'pseudo_huber: Pseudo-Huber loss function.',
|
956 |
+
'snippet' : [
|
957 |
+
'special.pseudo_huber(delta, r)',
|
958 |
+
],
|
959 |
+
},
|
960 |
+
],
|
961 |
+
},
|
962 |
+
|
963 |
+
{
|
964 |
+
'name' : 'Gamma and Related Functions',
|
965 |
+
'sub-menu' : [
|
966 |
+
|
967 |
+
{
|
968 |
+
'name' : 'gamma: Gamma function',
|
969 |
+
'snippet' : [
|
970 |
+
'special.gamma(z)',
|
971 |
+
],
|
972 |
+
},
|
973 |
+
|
974 |
+
{
|
975 |
+
'name' : 'gammaln: Logarithm of absolute value of gamma function',
|
976 |
+
'snippet' : [
|
977 |
+
'special.gammaln(z)',
|
978 |
+
],
|
979 |
+
},
|
980 |
+
|
981 |
+
{
|
982 |
+
'name' : 'gammasgn: Sign of the gamma function',
|
983 |
+
'snippet' : [
|
984 |
+
'special.gammasgn(x)',
|
985 |
+
],
|
986 |
+
},
|
987 |
+
|
988 |
+
{
|
989 |
+
'name' : 'gammainc: Incomplete gamma function',
|
990 |
+
'snippet' : [
|
991 |
+
'special.gammainc(a, x)',
|
992 |
+
],
|
993 |
+
},
|
994 |
+
|
995 |
+
{
|
996 |
+
'name' : 'gammaincinv: Inverse to gammainc',
|
997 |
+
'snippet' : [
|
998 |
+
'special.gammaincinv(a, y)',
|
999 |
+
],
|
1000 |
+
},
|
1001 |
+
|
1002 |
+
{
|
1003 |
+
'name' : 'gammaincc: Complemented incomplete gamma integral',
|
1004 |
+
'snippet' : [
|
1005 |
+
'special.gammaincc(a,x)',
|
1006 |
+
],
|
1007 |
+
},
|
1008 |
+
|
1009 |
+
{
|
1010 |
+
'name' : 'gammainccinv: Inverse to gammaincc',
|
1011 |
+
'snippet' : [
|
1012 |
+
'special.gammainccinv(a,y)',
|
1013 |
+
],
|
1014 |
+
},
|
1015 |
+
|
1016 |
+
{
|
1017 |
+
'name' : 'beta: Beta function',
|
1018 |
+
'snippet' : [
|
1019 |
+
'special.beta(a, b)',
|
1020 |
+
],
|
1021 |
+
},
|
1022 |
+
|
1023 |
+
{
|
1024 |
+
'name' : 'betaln: Natural logarithm of absolute value of beta function',
|
1025 |
+
'snippet' : [
|
1026 |
+
'special.betaln(a, b)',
|
1027 |
+
],
|
1028 |
+
},
|
1029 |
+
|
1030 |
+
{
|
1031 |
+
'name' : 'betainc: Incomplete beta integral',
|
1032 |
+
'snippet' : [
|
1033 |
+
'special.betainc(a, b, x)',
|
1034 |
+
],
|
1035 |
+
},
|
1036 |
+
|
1037 |
+
{
|
1038 |
+
'name' : 'betaincinv: Inverse function to beta integral',
|
1039 |
+
'snippet' : [
|
1040 |
+
'special.betaincinv(a, b, y)',
|
1041 |
+
],
|
1042 |
+
},
|
1043 |
+
|
1044 |
+
{
|
1045 |
+
'name' : 'psi: Digamma function',
|
1046 |
+
'snippet' : [
|
1047 |
+
'special.psi(z)',
|
1048 |
+
],
|
1049 |
+
},
|
1050 |
+
|
1051 |
+
{
|
1052 |
+
'name' : 'rgamma: Gamma function inverted',
|
1053 |
+
'snippet' : [
|
1054 |
+
'special.rgamma(z)',
|
1055 |
+
],
|
1056 |
+
},
|
1057 |
+
|
1058 |
+
{
|
1059 |
+
'name' : 'polygamma: Polygamma function which is the $n$th derivative of the digamma (psi) function',
|
1060 |
+
'snippet' : [
|
1061 |
+
'special.polygamma(n, x)',
|
1062 |
+
],
|
1063 |
+
},
|
1064 |
+
|
1065 |
+
{
|
1066 |
+
'name' : 'multigammaln: Returns the log of multivariate gamma, also sometimes called the generalized gamma',
|
1067 |
+
'snippet' : [
|
1068 |
+
'special.multigammaln(a, d)',
|
1069 |
+
],
|
1070 |
+
},
|
1071 |
+
|
1072 |
+
{
|
1073 |
+
'name' : 'digamma: Digamma function',
|
1074 |
+
'snippet' : [
|
1075 |
+
'special.digamma(z)',
|
1076 |
+
],
|
1077 |
+
},
|
1078 |
+
],
|
1079 |
+
},
|
1080 |
+
|
1081 |
+
{
|
1082 |
+
'name' : 'Error Function and Fresnel Integrals',
|
1083 |
+
'sub-menu' : [
|
1084 |
+
|
1085 |
+
{
|
1086 |
+
'name' : 'erf: Returns the error function of complex argument',
|
1087 |
+
'snippet' : [
|
1088 |
+
'special.erf(z)',
|
1089 |
+
],
|
1090 |
+
},
|
1091 |
+
|
1092 |
+
{
|
1093 |
+
'name' : 'erfc: Complementary error function, $1 - \\mathrm{erf}(x)$',
|
1094 |
+
'snippet' : [
|
1095 |
+
'special.erfc(x)',
|
1096 |
+
],
|
1097 |
+
},
|
1098 |
+
|
1099 |
+
{
|
1100 |
+
'name' : 'erfcx: Scaled complementary error function, $\\exp(x^2)\\, \\mathrm{erfc}(x)$',
|
1101 |
+
'snippet' : [
|
1102 |
+
'special.erfcx(x)',
|
1103 |
+
],
|
1104 |
+
},
|
1105 |
+
|
1106 |
+
{
|
1107 |
+
'name' : 'erfi: Imaginary error function, $-i\\, \\mathrm{erf}(i\\, z)$',
|
1108 |
+
'snippet' : [
|
1109 |
+
'special.erfi(z)',
|
1110 |
+
],
|
1111 |
+
},
|
1112 |
+
|
1113 |
+
{
|
1114 |
+
'name' : 'erfinv: Inverse function for erf',
|
1115 |
+
'snippet' : [
|
1116 |
+
'special.erfinv(y)',
|
1117 |
+
],
|
1118 |
+
},
|
1119 |
+
|
1120 |
+
{
|
1121 |
+
'name' : 'erfcinv: Inverse function for erfc',
|
1122 |
+
'snippet' : [
|
1123 |
+
'special.erfcinv(y)',
|
1124 |
+
],
|
1125 |
+
},
|
1126 |
+
|
1127 |
+
{
|
1128 |
+
'name' : 'wofz: Faddeeva function',
|
1129 |
+
'snippet' : [
|
1130 |
+
'special.wofz(z)',
|
1131 |
+
],
|
1132 |
+
},
|
1133 |
+
|
1134 |
+
{
|
1135 |
+
'name' : 'dawsn: Dawson’s integral',
|
1136 |
+
'snippet' : [
|
1137 |
+
'special.dawsn(x)',
|
1138 |
+
],
|
1139 |
+
},
|
1140 |
+
|
1141 |
+
{
|
1142 |
+
'name' : 'fresnel: Fresnel sin and cos integrals',
|
1143 |
+
'snippet' : [
|
1144 |
+
'special.fresnel(z)',
|
1145 |
+
],
|
1146 |
+
},
|
1147 |
+
|
1148 |
+
{
|
1149 |
+
'name' : 'fresnel_zeros: Compute nt complex zeros of the sine and cosine Fresnel integrals S(z) and C(z)',
|
1150 |
+
'snippet' : [
|
1151 |
+
'special.fresnel_zeros(nt)',
|
1152 |
+
],
|
1153 |
+
},
|
1154 |
+
|
1155 |
+
{
|
1156 |
+
'name' : 'modfresnelp: Modified Fresnel positive integrals',
|
1157 |
+
'snippet' : [
|
1158 |
+
'special.modfresnelp(x)',
|
1159 |
+
],
|
1160 |
+
},
|
1161 |
+
|
1162 |
+
{
|
1163 |
+
'name' : 'modfresnelm: Modified Fresnel negative integrals',
|
1164 |
+
'snippet' : [
|
1165 |
+
'special.modfresnelm(x)',
|
1166 |
+
],
|
1167 |
+
},
|
1168 |
+
|
1169 |
+
// These are not universal functions:
|
1170 |
+
|
1171 |
+
{
|
1172 |
+
'name' : 'erf_zeros: Compute nt complex zeros of the error function erf(z)',
|
1173 |
+
'snippet' : [
|
1174 |
+
'special.erf_zeros(nt)',
|
1175 |
+
],
|
1176 |
+
},
|
1177 |
+
|
1178 |
+
{
|
1179 |
+
'name' : 'fresnelc_zeros: Compute nt complex zeros of the cosine Fresnel integral C(z)',
|
1180 |
+
'snippet' : [
|
1181 |
+
'special.fresnelc_zeros(nt)',
|
1182 |
+
],
|
1183 |
+
},
|
1184 |
+
|
1185 |
+
{
|
1186 |
+
'name' : 'fresnels_zeros: Compute nt complex zeros of the sine Fresnel integral S(z)',
|
1187 |
+
'snippet' : [
|
1188 |
+
'special.fresnels_zeros(nt)',
|
1189 |
+
],
|
1190 |
+
},
|
1191 |
+
|
1192 |
+
],
|
1193 |
+
},
|
1194 |
+
|
1195 |
+
{
|
1196 |
+
'name' : 'Legendre Functions',
|
1197 |
+
'sub-menu' : [
|
1198 |
+
|
1199 |
+
{
|
1200 |
+
'name' : 'lpmv: Associated legendre function of integer order',
|
1201 |
+
'snippet' : [
|
1202 |
+
'special.lpmv(m, v, x)',
|
1203 |
+
],
|
1204 |
+
},
|
1205 |
+
|
1206 |
+
{
|
1207 |
+
'name' : 'sph_harm: Spherical harmonic of degree $n \\geq 0$ and order $|m| \\leq n$',
|
1208 |
+
'snippet' : [
|
1209 |
+
'# Note: n >= 0 and |m| <= n; azimuthal angle in [0, 2pi) and polar in [0, pi]',
|
1210 |
+
'special.sph_harm(order_m, degree_n, azimuthal_angle, polar_angle)',
|
1211 |
+
],
|
1212 |
+
},
|
1213 |
+
|
1214 |
+
// These are not universal functions:
|
1215 |
+
|
1216 |
+
{
|
1217 |
+
'name' : 'clpmn: Associated Legendre function of the first kind, $P_{m,n}(z)$',
|
1218 |
+
'snippet' : [
|
1219 |
+
'special.clpmn(m, n, z[, type])',
|
1220 |
+
],
|
1221 |
+
},
|
1222 |
+
|
1223 |
+
{
|
1224 |
+
'name' : 'lpn: Compute sequence of Legendre functions of the first kind (polynomials), $P_n(z)$ and derivatives for all degrees from 0 to $n$ (inclusive)',
|
1225 |
+
'snippet' : [
|
1226 |
+
'special.lpn(n, z)',
|
1227 |
+
],
|
1228 |
+
},
|
1229 |
+
|
1230 |
+
{
|
1231 |
+
'name' : 'lqn: Compute sequence of Legendre functions of the second kind, $Q_n(z)$ and derivatives for all degrees from 0 to $n$ (inclusive)',
|
1232 |
+
'snippet' : [
|
1233 |
+
'special.lqn(n, z)',
|
1234 |
+
],
|
1235 |
+
},
|
1236 |
+
|
1237 |
+
{
|
1238 |
+
'name' : 'lpmn: Associated Legendre function of the first kind, $P_{m,n}(z)$',
|
1239 |
+
'snippet' : [
|
1240 |
+
'special.lpmn(m, n, z)',
|
1241 |
+
],
|
1242 |
+
},
|
1243 |
+
|
1244 |
+
{
|
1245 |
+
'name' : 'lqmn: Associated Legendre functions of the second kind, $Q_{m,n}(z)$ and its derivative, $Q_{m,n}\'(z)$ of order $m$ and degree $n$',
|
1246 |
+
'snippet' : [
|
1247 |
+
'special.lqmn(m, n, z)',
|
1248 |
+
],
|
1249 |
+
},
|
1250 |
+
|
1251 |
+
],
|
1252 |
+
},
|
1253 |
+
|
1254 |
+
{
|
1255 |
+
'name' : 'Ellipsoidal Harmonics',
|
1256 |
+
'sub-menu' : [
|
1257 |
+
{
|
1258 |
+
'name' : 'ellip_harm: Ellipsoidal harmonic functions $E^p_n(l)$',
|
1259 |
+
'snippet' : [
|
1260 |
+
'special.ellip_harm(h2, k2, n, p, s[, signm, signn])',
|
1261 |
+
],
|
1262 |
+
},
|
1263 |
+
|
1264 |
+
{
|
1265 |
+
'name' : 'ellip_harm_2: Ellipsoidal harmonic functions $F^p_n(l)$',
|
1266 |
+
'snippet' : [
|
1267 |
+
'special.ellip_harm_2(h2, k2, n, p, s)',
|
1268 |
+
],
|
1269 |
+
},
|
1270 |
+
|
1271 |
+
{
|
1272 |
+
'name' : 'ellip_normal: Ellipsoidal harmonic normalization constants $\\gamma^p_n$',
|
1273 |
+
'snippet' : [
|
1274 |
+
'special.ellip_normal(h2, k2, n, p)',
|
1275 |
+
],
|
1276 |
+
},
|
1277 |
+
],
|
1278 |
+
},
|
1279 |
+
|
1280 |
+
{
|
1281 |
+
'name' : 'Orthogonal polynomials',
|
1282 |
+
'sub-menu' : [
|
1283 |
+
|
1284 |
+
// The following functions evaluate values of orthogonal polynomials:
|
1285 |
+
{
|
1286 |
+
'name' : 'assoc_laguerre: Returns the $n$th order generalized (associated) Laguerre polynomial.',
|
1287 |
+
'snippet' : [
|
1288 |
+
'special.assoc_laguerre(x, n)',
|
1289 |
+
],
|
1290 |
+
},
|
1291 |
+
|
1292 |
+
{
|
1293 |
+
'name' : 'eval_legendre: Evaluate Legendre polynomial at a point',
|
1294 |
+
'snippet' : [
|
1295 |
+
'special.eval_legendre(n, x)',
|
1296 |
+
],
|
1297 |
+
},
|
1298 |
+
|
1299 |
+
{
|
1300 |
+
'name' : 'eval_chebyt: Evaluate Chebyshev $T$ polynomial at a point',
|
1301 |
+
'snippet' : [
|
1302 |
+
'special.eval_chebyt(n, x)',
|
1303 |
+
],
|
1304 |
+
},
|
1305 |
+
|
1306 |
+
{
|
1307 |
+
'name' : 'eval_chebyu: Evaluate Chebyshev $U$ polynomial at a point',
|
1308 |
+
'snippet' : [
|
1309 |
+
'special.eval_chebyu(n, x)',
|
1310 |
+
],
|
1311 |
+
},
|
1312 |
+
|
1313 |
+
{
|
1314 |
+
'name' : 'eval_chebyc: Evaluate Chebyshev $C$ polynomial at a point',
|
1315 |
+
'snippet' : [
|
1316 |
+
'special.eval_chebyc(n, x)',
|
1317 |
+
],
|
1318 |
+
},
|
1319 |
+
|
1320 |
+
{
|
1321 |
+
'name' : 'eval_chebys: Evaluate Chebyshev $S$ polynomial at a point',
|
1322 |
+
'snippet' : [
|
1323 |
+
'special.eval_chebys(n, x)',
|
1324 |
+
],
|
1325 |
+
},
|
1326 |
+
|
1327 |
+
{
|
1328 |
+
'name' : 'eval_jacobi: Evaluate Jacobi polynomial at a point',
|
1329 |
+
'snippet' : [
|
1330 |
+
'special.eval_jacobi(n, alpha, beta, x)',
|
1331 |
+
],
|
1332 |
+
},
|
1333 |
+
|
1334 |
+
{
|
1335 |
+
'name' : 'eval_laguerre: Evaluate Laguerre polynomial at a point',
|
1336 |
+
'snippet' : [
|
1337 |
+
'special.eval_laguerre(n, x)',
|
1338 |
+
],
|
1339 |
+
},
|
1340 |
+
|
1341 |
+
{
|
1342 |
+
'name' : 'eval_genlaguerre: Evaluate generalized Laguerre polynomial at a point',
|
1343 |
+
'snippet' : [
|
1344 |
+
'special.eval_genlaguerre(n, alpha, x)',
|
1345 |
+
],
|
1346 |
+
},
|
1347 |
+
|
1348 |
+
{
|
1349 |
+
'name' : 'eval_hermite: Evaluate Hermite polynomial at a point',
|
1350 |
+
'snippet' : [
|
1351 |
+
'special.eval_hermite(n, x)',
|
1352 |
+
],
|
1353 |
+
},
|
1354 |
+
|
1355 |
+
{
|
1356 |
+
'name' : 'eval_hermitenorm: Evaluate normalized Hermite polynomial at a point',
|
1357 |
+
'snippet' : [
|
1358 |
+
'special.eval_hermitenorm(n, x)',
|
1359 |
+
],
|
1360 |
+
},
|
1361 |
+
|
1362 |
+
{
|
1363 |
+
'name' : 'eval_gegenbauer: Evaluate Gegenbauer polynomial at a point',
|
1364 |
+
'snippet' : [
|
1365 |
+
'special.eval_gegenbauer(n, alpha, x)',
|
1366 |
+
],
|
1367 |
+
},
|
1368 |
+
|
1369 |
+
{
|
1370 |
+
'name' : 'eval_sh_legendre: Evaluate shifted Legendre polynomial at a point',
|
1371 |
+
'snippet' : [
|
1372 |
+
'special.eval_sh_legendre(n, x)',
|
1373 |
+
],
|
1374 |
+
},
|
1375 |
+
|
1376 |
+
{
|
1377 |
+
'name' : 'eval_sh_chebyt: Evaluate shifted Chebyshev $T$ polynomial at a point',
|
1378 |
+
'snippet' : [
|
1379 |
+
'special.eval_sh_chebyt(n, x)',
|
1380 |
+
],
|
1381 |
+
},
|
1382 |
+
|
1383 |
+
{
|
1384 |
+
'name' : 'eval_sh_chebyu: Evaluate shifted Chebyshev $U$ polynomial at a point',
|
1385 |
+
'snippet' : [
|
1386 |
+
'special.eval_sh_chebyu(n, x)',
|
1387 |
+
],
|
1388 |
+
},
|
1389 |
+
|
1390 |
+
{
|
1391 |
+
'name' : 'eval_sh_jacobi: Evaluate shifted Jacobi polynomial at a point',
|
1392 |
+
'snippet' : [
|
1393 |
+
'special.eval_sh_jacobi(n, p, q, x)',
|
1394 |
+
],
|
1395 |
+
},
|
1396 |
+
|
1397 |
+
{
|
1398 |
+
'name' : 'legendre: Coefficients of the $n$th order Legendre polynomial, $P_n(x)$',
|
1399 |
+
'snippet' : [
|
1400 |
+
'special.legendre(n[, monic])',
|
1401 |
+
],
|
1402 |
+
},
|
1403 |
+
|
1404 |
+
{
|
1405 |
+
'name' : 'chebyt: Coefficients of the $n$th order Chebyshev polynomial of first kind, $T_n(x)$',
|
1406 |
+
'snippet' : [
|
1407 |
+
'special.chebyt(n[, monic])',
|
1408 |
+
],
|
1409 |
+
},
|
1410 |
+
|
1411 |
+
{
|
1412 |
+
'name' : 'chebyu: Coefficients of the $n$th order Chebyshev polynomial of second kind, $U_n(x)$',
|
1413 |
+
'snippet' : [
|
1414 |
+
'special.chebyu(n[, monic])',
|
1415 |
+
],
|
1416 |
+
},
|
1417 |
+
|
1418 |
+
{
|
1419 |
+
'name' : 'chebyc: Coefficients of the $n$th order Chebyshev polynomial of first kind, $C_n(x)$',
|
1420 |
+
'snippet' : [
|
1421 |
+
'special.chebyc(n[, monic])',
|
1422 |
+
],
|
1423 |
+
},
|
1424 |
+
|
1425 |
+
{
|
1426 |
+
'name' : 'chebys: Coefficients of the $n$th order Chebyshev polynomial of second kind, $S_n$(x)',
|
1427 |
+
'snippet' : [
|
1428 |
+
'special.chebys(n[, monic])',
|
1429 |
+
],
|
1430 |
+
},
|
1431 |
+
|
1432 |
+
{
|
1433 |
+
'name' : 'jacobi: Coefficients of the $n$th order Jacobi polynomial, $P^(\\alpha,\\beta)_n(x)$ orthogonal over [-1,1] with weighting function $(1-x)^\\alpha (1+x)^\\beta$ with $\\alpha,\\beta > -1$',
|
1434 |
+
'snippet' : [
|
1435 |
+
'special.jacobi(n, alpha, beta[, monic])',
|
1436 |
+
],
|
1437 |
+
},
|
1438 |
+
|
1439 |
+
{
|
1440 |
+
'name' : 'laguerre: Coefficients of the $n$th order Laguerre polynoimal, $L_n(x)$',
|
1441 |
+
'snippet' : [
|
1442 |
+
'special.laguerre(n[, monic])',
|
1443 |
+
],
|
1444 |
+
},
|
1445 |
+
|
1446 |
+
{
|
1447 |
+
'name' : 'genlaguerre: Coefficients of the $n$th order generalized (associated) Laguerre polynomial,',
|
1448 |
+
'snippet' : [
|
1449 |
+
'special.genlaguerre(n, alpha[, monic])',
|
1450 |
+
],
|
1451 |
+
},
|
1452 |
+
|
1453 |
+
{
|
1454 |
+
'name' : 'hermite: Coefficients of the $n$th order Hermite polynomial, $H_n(x)$, orthogonal over',
|
1455 |
+
'snippet' : [
|
1456 |
+
'special.hermite(n[, monic])',
|
1457 |
+
],
|
1458 |
+
},
|
1459 |
+
|
1460 |
+
{
|
1461 |
+
'name' : 'hermitenorm: Coefficients of the $n$th order normalized Hermite polynomial, $He_n(x)$, orthogonal',
|
1462 |
+
'snippet' : [
|
1463 |
+
'special.hermitenorm(n[, monic])',
|
1464 |
+
],
|
1465 |
+
},
|
1466 |
+
|
1467 |
+
{
|
1468 |
+
'name' : 'gegenbauer: Coefficients of the $n$th order Gegenbauer (ultraspherical) polynomial,',
|
1469 |
+
'snippet' : [
|
1470 |
+
'special.gegenbauer(n, alpha[, monic])',
|
1471 |
+
],
|
1472 |
+
},
|
1473 |
+
|
1474 |
+
{
|
1475 |
+
'name' : 'sh_legendre: Coefficients of the $n$th order shifted Legendre polynomial, $P^\\ast_n(x)$',
|
1476 |
+
'snippet' : [
|
1477 |
+
'special.sh_legendre(n[, monic])',
|
1478 |
+
],
|
1479 |
+
},
|
1480 |
+
|
1481 |
+
{
|
1482 |
+
'name' : 'sh_chebyt: Coefficients of $n$th order shifted Chebyshev polynomial of first kind, $T_n(x)$',
|
1483 |
+
'snippet' : [
|
1484 |
+
'special.sh_chebyt(n[, monic])',
|
1485 |
+
],
|
1486 |
+
},
|
1487 |
+
|
1488 |
+
{
|
1489 |
+
'name' : 'sh_chebyu: Coefficients of the $n$th order shifted Chebyshev polynomial of second kind, $U_n(x)$',
|
1490 |
+
'snippet' : [
|
1491 |
+
'special.sh_chebyu(n[, monic])',
|
1492 |
+
],
|
1493 |
+
},
|
1494 |
+
|
1495 |
+
{
|
1496 |
+
'name' : 'sh_jacobi: Coefficients of the $n$th order Jacobi polynomial, $G_n(p,q,x)$ orthogonal over [0,1] with weighting function $(1-x)^{p-q} x^{q-1}$ with $p>q-1$ and $q > 0$',
|
1497 |
+
'snippet' : [
|
1498 |
+
'special.sh_jacobi(n, p, q[, monic])',
|
1499 |
+
],
|
1500 |
+
},
|
1501 |
+
|
1502 |
+
],
|
1503 |
+
},
|
1504 |
+
|
1505 |
+
{
|
1506 |
+
'name' : 'Hypergeometric Functions',
|
1507 |
+
'sub-menu' : [
|
1508 |
+
|
1509 |
+
{
|
1510 |
+
'name' : 'hyp2f1: Gauss hypergeometric function ${}_2F_1(a, b; c; z)$',
|
1511 |
+
'snippet' : [
|
1512 |
+
'special.hyp2f1(a, b, c, z)',
|
1513 |
+
],
|
1514 |
+
},
|
1515 |
+
|
1516 |
+
{
|
1517 |
+
'name' : 'hyp1f1: Confluent hypergeometric function ${}_1F_1(a, b; x)$',
|
1518 |
+
'snippet' : [
|
1519 |
+
'special.hyp1f1(a, b, x)',
|
1520 |
+
],
|
1521 |
+
},
|
1522 |
+
|
1523 |
+
{
|
1524 |
+
'name' : 'hyperu: Confluent hypergeometric function $U(a, b, x)$ of the second kind',
|
1525 |
+
'snippet' : [
|
1526 |
+
'special.hyperu(a, b, x)',
|
1527 |
+
],
|
1528 |
+
},
|
1529 |
+
|
1530 |
+
{
|
1531 |
+
'name' : 'hyp0f1: Confluent hypergeometric limit function ${}_0F_1$',
|
1532 |
+
'snippet' : [
|
1533 |
+
'special.hyp0f1(v, z)',
|
1534 |
+
],
|
1535 |
+
},
|
1536 |
+
|
1537 |
+
{
|
1538 |
+
'name' : 'hyp2f0: Hypergeometric function ${}_2F_0$ in $y$ and an error estimate',
|
1539 |
+
'snippet' : [
|
1540 |
+
'special.hyp2f0(a, b, x, type)',
|
1541 |
+
],
|
1542 |
+
},
|
1543 |
+
|
1544 |
+
{
|
1545 |
+
'name' : 'hyp1f2: Hypergeometric function ${}_1F_2$ and error estimate',
|
1546 |
+
'snippet' : [
|
1547 |
+
'special.hyp1f2(a, b, c, x)',
|
1548 |
+
],
|
1549 |
+
},
|
1550 |
+
|
1551 |
+
{
|
1552 |
+
'name' : 'hyp3f0: Hypergeometric function ${}_3F_0$ in $y$ and an error estimate',
|
1553 |
+
'snippet' : [
|
1554 |
+
'special.hyp3f0(a, b, c, x)',
|
1555 |
+
],
|
1556 |
+
},
|
1557 |
+
|
1558 |
+
],
|
1559 |
+
},
|
1560 |
+
|
1561 |
+
{
|
1562 |
+
'name' : 'Parabolic Cylinder Functions',
|
1563 |
+
'sub-menu' : [
|
1564 |
+
|
1565 |
+
{
|
1566 |
+
'name' : 'pbdv: Parabolic cylinder function $D$',
|
1567 |
+
'snippet' : [
|
1568 |
+
'special.pbdv(v, x)',
|
1569 |
+
],
|
1570 |
+
},
|
1571 |
+
|
1572 |
+
{
|
1573 |
+
'name' : 'pbvv: Parabolic cylinder function $V$',
|
1574 |
+
'snippet' : [
|
1575 |
+
'special.pbvv(v,x)',
|
1576 |
+
],
|
1577 |
+
},
|
1578 |
+
|
1579 |
+
{
|
1580 |
+
'name' : 'pbwa: Parabolic cylinder function $W$',
|
1581 |
+
'snippet' : [
|
1582 |
+
'special.pbwa(a,x)',
|
1583 |
+
],
|
1584 |
+
},
|
1585 |
+
|
1586 |
+
// These are not universal functions:
|
1587 |
+
|
1588 |
+
{
|
1589 |
+
'name' : 'pbdv_seq: $D_{v_0}(x), ..., D_v(x)$ and $D_{v_0}\'(x), ..., D_v\'(x)$ with $v_0=v-\\lfloor v \\rfloor$',
|
1590 |
+
'snippet' : [
|
1591 |
+
'special.pbdv_seq(v, x)',
|
1592 |
+
],
|
1593 |
+
},
|
1594 |
+
|
1595 |
+
{
|
1596 |
+
'name' : 'pbvv_seq: $V_{v_0}(x), ..., V_v(x)$ and $V_{v_0}\'(x), ..., V_v\'(x)$ with $v_0=v-\\lfloor v \\rfloor$',
|
1597 |
+
'snippet' : [
|
1598 |
+
'special.pbvv_seq(v, x)',
|
1599 |
+
],
|
1600 |
+
},
|
1601 |
+
|
1602 |
+
{
|
1603 |
+
'name' : 'pbdn_seq: $D_0(x), ..., D_n(x)$ and $D_0\'(x), ..., D_n\'(x)$',
|
1604 |
+
'snippet' : [
|
1605 |
+
'special.pbdn_seq(n, z)',
|
1606 |
+
],
|
1607 |
+
},
|
1608 |
+
|
1609 |
+
],
|
1610 |
+
},
|
1611 |
+
|
1612 |
+
{
|
1613 |
+
'name' : 'Mathieu and Related Functions',
|
1614 |
+
'sub-menu' : [
|
1615 |
+
|
1616 |
+
{
|
1617 |
+
'name' : 'mathieu_a: Characteristic value of even Mathieu functions',
|
1618 |
+
'snippet' : [
|
1619 |
+
'special.mathieu_a(m,q)',
|
1620 |
+
],
|
1621 |
+
},
|
1622 |
+
|
1623 |
+
{
|
1624 |
+
'name' : 'mathieu_b: Characteristic value of odd Mathieu functions',
|
1625 |
+
'snippet' : [
|
1626 |
+
'special.mathieu_b(m,q)',
|
1627 |
+
],
|
1628 |
+
},
|
1629 |
+
|
1630 |
+
// These are not universal functions:
|
1631 |
+
|
1632 |
+
{
|
1633 |
+
'name' : 'mathieu_even_coef: Compute expansion coefficients for even Mathieu functions and modified Mathieu functions',
|
1634 |
+
'snippet' : [
|
1635 |
+
'special.mathieu_even_coef(m, q)',
|
1636 |
+
],
|
1637 |
+
},
|
1638 |
+
|
1639 |
+
{
|
1640 |
+
'name' : 'mathieu_odd_coef: Compute expansion coefficients for even Mathieu functions and modified Mathieu functions',
|
1641 |
+
'snippet' : [
|
1642 |
+
'special.mathieu_odd_coef(m, q)',
|
1643 |
+
],
|
1644 |
+
},
|
1645 |
+
|
1646 |
+
// The following return both function and first derivative:
|
1647 |
+
|
1648 |
+
{
|
1649 |
+
'name' : 'mathieu_cem: Even Mathieu function and its derivative',
|
1650 |
+
'snippet' : [
|
1651 |
+
'special.mathieu_cem(m,q,x)',
|
1652 |
+
],
|
1653 |
+
},
|
1654 |
+
|
1655 |
+
{
|
1656 |
+
'name' : 'mathieu_sem: Odd Mathieu function and its derivative',
|
1657 |
+
'snippet' : [
|
1658 |
+
'special.mathieu_sem(m, q, x)',
|
1659 |
+
],
|
1660 |
+
},
|
1661 |
+
|
1662 |
+
{
|
1663 |
+
'name' : 'mathieu_modcem1: Even modified Mathieu function of the first kind and its derivative',
|
1664 |
+
'snippet' : [
|
1665 |
+
'special.mathieu_modcem1(m, q, x)',
|
1666 |
+
],
|
1667 |
+
},
|
1668 |
+
|
1669 |
+
{
|
1670 |
+
'name' : 'mathieu_modcem2: Even modified Mathieu function of the second kind and its derivative',
|
1671 |
+
'snippet' : [
|
1672 |
+
'special.mathieu_modcem2(m, q, x)',
|
1673 |
+
],
|
1674 |
+
},
|
1675 |
+
|
1676 |
+
{
|
1677 |
+
'name' : 'mathieu_modsem1: Odd modified Mathieu function of the first kind and its derivative',
|
1678 |
+
'snippet' : [
|
1679 |
+
'special.mathieu_modsem1(m,q,x)',
|
1680 |
+
],
|
1681 |
+
},
|
1682 |
+
|
1683 |
+
{
|
1684 |
+
'name' : 'mathieu_modsem2: Odd modified Mathieu function of the second kind and its derivative',
|
1685 |
+
'snippet' : [
|
1686 |
+
'special.mathieu_modsem2(m, q, x)',
|
1687 |
+
],
|
1688 |
+
},
|
1689 |
+
|
1690 |
+
],
|
1691 |
+
},
|
1692 |
+
|
1693 |
+
{
|
1694 |
+
'name' : 'Spheroidal Wave Functions',
|
1695 |
+
'sub-menu' : [
|
1696 |
+
|
1697 |
+
{
|
1698 |
+
'name' : 'pro_ang1: Prolate spheroidal angular function of the first kind and its derivative',
|
1699 |
+
'snippet' : [
|
1700 |
+
'special.pro_ang1(m,n,c,x)',
|
1701 |
+
],
|
1702 |
+
},
|
1703 |
+
|
1704 |
+
{
|
1705 |
+
'name' : 'pro_rad1: Prolate spheroidal radial function of the first kind and its derivative',
|
1706 |
+
'snippet' : [
|
1707 |
+
'special.pro_rad1(m,n,c,x)',
|
1708 |
+
],
|
1709 |
+
},
|
1710 |
+
|
1711 |
+
{
|
1712 |
+
'name' : 'pro_rad2: Prolate spheroidal radial function of the secon kind and its derivative',
|
1713 |
+
'snippet' : [
|
1714 |
+
'special.pro_rad2(m,n,c,x)',
|
1715 |
+
],
|
1716 |
+
},
|
1717 |
+
|
1718 |
+
{
|
1719 |
+
'name' : 'obl_ang1: Oblate spheroidal angular function of the first kind and its derivative',
|
1720 |
+
'snippet' : [
|
1721 |
+
'special.obl_ang1(m, n, c, x)',
|
1722 |
+
],
|
1723 |
+
},
|
1724 |
+
|
1725 |
+
{
|
1726 |
+
'name' : 'obl_rad1: Oblate spheroidal radial function of the first kind and its derivative',
|
1727 |
+
'snippet' : [
|
1728 |
+
'special.obl_rad1(m,n,c,x)',
|
1729 |
+
],
|
1730 |
+
},
|
1731 |
+
|
1732 |
+
{
|
1733 |
+
'name' : 'obl_rad2: Oblate spheroidal radial function of the second kind and its derivative',
|
1734 |
+
'snippet' : [
|
1735 |
+
'special.obl_rad2(m,n,c,x)',
|
1736 |
+
],
|
1737 |
+
},
|
1738 |
+
|
1739 |
+
{
|
1740 |
+
'name' : 'pro_cv: Characteristic value of prolate spheroidal function',
|
1741 |
+
'snippet' : [
|
1742 |
+
'special.pro_cv(m,n,c)',
|
1743 |
+
],
|
1744 |
+
},
|
1745 |
+
|
1746 |
+
{
|
1747 |
+
'name' : 'obl_cv: Characteristic value of oblate spheroidal function',
|
1748 |
+
'snippet' : [
|
1749 |
+
'special.obl_cv(m, n, c)',
|
1750 |
+
],
|
1751 |
+
},
|
1752 |
+
|
1753 |
+
{
|
1754 |
+
'name' : 'pro_cv_seq: Compute a sequence of characteristic values for the prolate spheroidal wave functions for mode m and n’=m..n and spheroidal parameter c',
|
1755 |
+
'snippet' : [
|
1756 |
+
'special.pro_cv_seq(m, n, c)',
|
1757 |
+
],
|
1758 |
+
},
|
1759 |
+
|
1760 |
+
{
|
1761 |
+
'name' : 'obl_cv_seq: Compute a sequence of characteristic values for the oblate spheroidal wave functions for mode m and n’=m..n and spheroidal parameter c',
|
1762 |
+
'snippet' : [
|
1763 |
+
'special.obl_cv_seq(m, n, c)',
|
1764 |
+
],
|
1765 |
+
},
|
1766 |
+
|
1767 |
+
// The following functions require pre-computed characteristic value:
|
1768 |
+
|
1769 |
+
{
|
1770 |
+
'name' : 'pro_ang1_cv: Prolate spheroidal angular function pro_ang1 for precomputed characteristic value',
|
1771 |
+
'snippet' : [
|
1772 |
+
'special.pro_ang1_cv(m,n,c,cv,x)',
|
1773 |
+
],
|
1774 |
+
},
|
1775 |
+
|
1776 |
+
{
|
1777 |
+
'name' : 'pro_rad1_cv: Prolate spheroidal radial function pro_rad1 for precomputed characteristic value',
|
1778 |
+
'snippet' : [
|
1779 |
+
'special.pro_rad1_cv(m,n,c,cv,x)',
|
1780 |
+
],
|
1781 |
+
},
|
1782 |
+
|
1783 |
+
{
|
1784 |
+
'name' : 'pro_rad2_cv: Prolate spheroidal radial function pro_rad2 for precomputed characteristic value',
|
1785 |
+
'snippet' : [
|
1786 |
+
'special.pro_rad2_cv(m,n,c,cv,x)',
|
1787 |
+
],
|
1788 |
+
},
|
1789 |
+
|
1790 |
+
{
|
1791 |
+
'name' : 'obl_ang1_cv: Oblate spheroidal angular function obl_ang1 for precomputed characteristic value',
|
1792 |
+
'snippet' : [
|
1793 |
+
'special.obl_ang1_cv(m, n, c, cv, x)',
|
1794 |
+
],
|
1795 |
+
},
|
1796 |
+
|
1797 |
+
{
|
1798 |
+
'name' : 'obl_rad1_cv: Oblate spheroidal radial function obl_rad1 for precomputed characteristic value',
|
1799 |
+
'snippet' : [
|
1800 |
+
'special.obl_rad1_cv(m,n,c,cv,x)',
|
1801 |
+
],
|
1802 |
+
},
|
1803 |
+
|
1804 |
+
{
|
1805 |
+
'name' : 'obl_rad2_cv: Oblate spheroidal radial function obl_rad2 for precomputed characteristic value',
|
1806 |
+
'snippet' : [
|
1807 |
+
'special.obl_rad2_cv(m,n,c,cv,x)',
|
1808 |
+
],
|
1809 |
+
},
|
1810 |
+
|
1811 |
+
],
|
1812 |
+
},
|
1813 |
+
|
1814 |
+
{
|
1815 |
+
'name' : 'Kelvin Functions',
|
1816 |
+
'sub-menu' : [
|
1817 |
+
|
1818 |
+
{
|
1819 |
+
'name' : 'kelvin: Kelvin functions as complex numbers',
|
1820 |
+
'snippet' : [
|
1821 |
+
'special.kelvin(x)',
|
1822 |
+
],
|
1823 |
+
},
|
1824 |
+
|
1825 |
+
{
|
1826 |
+
'name' : 'kelvin_zeros: Compute nt zeros of all the Kelvin functions returned in a length 8 tuple of arrays of length nt',
|
1827 |
+
'snippet' : [
|
1828 |
+
'special.kelvin_zeros(nt)',
|
1829 |
+
],
|
1830 |
+
},
|
1831 |
+
|
1832 |
+
{
|
1833 |
+
'name' : 'ber: Kelvin function ber',
|
1834 |
+
'snippet' : [
|
1835 |
+
'special.ber(x)',
|
1836 |
+
],
|
1837 |
+
},
|
1838 |
+
|
1839 |
+
{
|
1840 |
+
'name' : 'bei: Kelvin function bei',
|
1841 |
+
'snippet' : [
|
1842 |
+
'special.bei(x)',
|
1843 |
+
],
|
1844 |
+
},
|
1845 |
+
|
1846 |
+
{
|
1847 |
+
'name' : 'berp: Derivative of the Kelvin function ber',
|
1848 |
+
'snippet' : [
|
1849 |
+
'special.berp(x)',
|
1850 |
+
],
|
1851 |
+
},
|
1852 |
+
|
1853 |
+
{
|
1854 |
+
'name' : 'beip: Derivative of the Kelvin function bei',
|
1855 |
+
'snippet' : [
|
1856 |
+
'special.beip(x)',
|
1857 |
+
],
|
1858 |
+
},
|
1859 |
+
|
1860 |
+
{
|
1861 |
+
'name' : 'ker: Kelvin function ker',
|
1862 |
+
'snippet' : [
|
1863 |
+
'special.ker(x)',
|
1864 |
+
],
|
1865 |
+
},
|
1866 |
+
|
1867 |
+
{
|
1868 |
+
'name' : 'kei: Kelvin function ker',
|
1869 |
+
'snippet' : [
|
1870 |
+
'special.kei(x)',
|
1871 |
+
],
|
1872 |
+
},
|
1873 |
+
|
1874 |
+
{
|
1875 |
+
'name' : 'kerp: Derivative of the Kelvin function ker',
|
1876 |
+
'snippet' : [
|
1877 |
+
'special.kerp(x)',
|
1878 |
+
],
|
1879 |
+
},
|
1880 |
+
|
1881 |
+
{
|
1882 |
+
'name' : 'keip: Derivative of the Kelvin function kei',
|
1883 |
+
'snippet' : [
|
1884 |
+
'special.keip(x)',
|
1885 |
+
],
|
1886 |
+
},
|
1887 |
+
|
1888 |
+
// These are not universal functions:
|
1889 |
+
|
1890 |
+
{
|
1891 |
+
'name' : 'ber_zeros: Compute nt zeros of the Kelvin function ber x',
|
1892 |
+
'snippet' : [
|
1893 |
+
'special.ber_zeros(nt)',
|
1894 |
+
],
|
1895 |
+
},
|
1896 |
+
|
1897 |
+
{
|
1898 |
+
'name' : 'bei_zeros: Compute nt zeros of the Kelvin function bei x',
|
1899 |
+
'snippet' : [
|
1900 |
+
'special.bei_zeros(nt)',
|
1901 |
+
],
|
1902 |
+
},
|
1903 |
+
|
1904 |
+
{
|
1905 |
+
'name' : 'berp_zeros: Compute nt zeros of the Kelvin function ber’ x',
|
1906 |
+
'snippet' : [
|
1907 |
+
'special.berp_zeros(nt)',
|
1908 |
+
],
|
1909 |
+
},
|
1910 |
+
|
1911 |
+
{
|
1912 |
+
'name' : 'beip_zeros: Compute nt zeros of the Kelvin function bei’ x',
|
1913 |
+
'snippet' : [
|
1914 |
+
'special.beip_zeros(nt)',
|
1915 |
+
],
|
1916 |
+
},
|
1917 |
+
|
1918 |
+
{
|
1919 |
+
'name' : 'ker_zeros: Compute nt zeros of the Kelvin function ker x',
|
1920 |
+
'snippet' : [
|
1921 |
+
'special.ker_zeros(nt)',
|
1922 |
+
],
|
1923 |
+
},
|
1924 |
+
|
1925 |
+
{
|
1926 |
+
'name' : 'kei_zeros: Compute nt zeros of the Kelvin function kei x',
|
1927 |
+
'snippet' : [
|
1928 |
+
'special.kei_zeros(nt)',
|
1929 |
+
],
|
1930 |
+
},
|
1931 |
+
|
1932 |
+
{
|
1933 |
+
'name' : 'kerp_zeros: Compute nt zeros of the Kelvin function ker’ x',
|
1934 |
+
'snippet' : [
|
1935 |
+
'special.kerp_zeros(nt)',
|
1936 |
+
],
|
1937 |
+
},
|
1938 |
+
|
1939 |
+
{
|
1940 |
+
'name' : 'keip_zeros: Compute nt zeros of the Kelvin function kei’ x',
|
1941 |
+
'snippet' : [
|
1942 |
+
'special.keip_zeros(nt)',
|
1943 |
+
],
|
1944 |
+
},
|
1945 |
+
|
1946 |
+
],
|
1947 |
+
},
|
1948 |
+
|
1949 |
+
{
|
1950 |
+
'name' : 'Combinatorics',
|
1951 |
+
'sub-menu' : [
|
1952 |
+
{
|
1953 |
+
'name' : 'comb: The number of combinations of N things taken k at a time',
|
1954 |
+
'snippet' : [
|
1955 |
+
'special.comb(N, k, exact=False, repetition=False)',
|
1956 |
+
],
|
1957 |
+
},
|
1958 |
+
|
1959 |
+
{
|
1960 |
+
'name' : 'perm: Permutations of N things taken k at a time, i.e., k-permutations of N',
|
1961 |
+
'snippet' : [
|
1962 |
+
'special.perm(N, k, exact=False)',
|
1963 |
+
],
|
1964 |
+
},
|
1965 |
+
],
|
1966 |
+
},
|
1967 |
+
|
1968 |
+
{
|
1969 |
+
'name' : 'Other Special Functions',
|
1970 |
+
'sub-menu' : [
|
1971 |
+
{
|
1972 |
+
'name' : 'agm: Arithmetic, Geometric Mean',
|
1973 |
+
'snippet' : [
|
1974 |
+
'special.agm(a, b)',
|
1975 |
+
],
|
1976 |
+
},
|
1977 |
+
|
1978 |
+
{
|
1979 |
+
'name' : 'bernoulli: Return an array of the Bernoulli numbers $B_0$, ..., $B_n$ (inclusive)',
|
1980 |
+
'snippet' : [
|
1981 |
+
'special.bernoulli(n)',
|
1982 |
+
],
|
1983 |
+
},
|
1984 |
+
|
1985 |
+
{
|
1986 |
+
'name' : 'binom: Binomial coefficient',
|
1987 |
+
'snippet' : [
|
1988 |
+
'special.binom(n, k)',
|
1989 |
+
],
|
1990 |
+
},
|
1991 |
+
|
1992 |
+
{
|
1993 |
+
'name' : 'diric: Returns the periodic sinc function, also called the Dirichlet function',
|
1994 |
+
'snippet' : [
|
1995 |
+
'special.diric(x, n)',
|
1996 |
+
],
|
1997 |
+
},
|
1998 |
+
|
1999 |
+
{
|
2000 |
+
'name' : 'euler: Return an array of the Euler numbers $E_0$, ..., $E_n$ (inclusive)',
|
2001 |
+
'snippet' : [
|
2002 |
+
'special.euler(n)',
|
2003 |
+
],
|
2004 |
+
},
|
2005 |
+
|
2006 |
+
{
|
2007 |
+
'name' : 'expn: Exponential integral $E_n$',
|
2008 |
+
'snippet' : [
|
2009 |
+
'special.expn(n, x)',
|
2010 |
+
],
|
2011 |
+
},
|
2012 |
+
|
2013 |
+
{
|
2014 |
+
'name' : 'exp1: Exponential integral $E_1$ of complex argument $z$',
|
2015 |
+
'snippet' : [
|
2016 |
+
'special.exp1(z)',
|
2017 |
+
],
|
2018 |
+
},
|
2019 |
+
|
2020 |
+
{
|
2021 |
+
'name' : 'expi: Exponential integral $\\mathrm{Ei}$',
|
2022 |
+
'snippet' : [
|
2023 |
+
'special.expi(x)',
|
2024 |
+
],
|
2025 |
+
},
|
2026 |
+
|
2027 |
+
{
|
2028 |
+
'name' : 'factorial: The factorial function, $n! = \\Gamma(n+1)$',
|
2029 |
+
'snippet' : [
|
2030 |
+
'special.factorial(n, exact=False)',
|
2031 |
+
],
|
2032 |
+
},
|
2033 |
+
|
2034 |
+
{
|
2035 |
+
'name' : 'factorial2: Double factorial $n!!$',
|
2036 |
+
'snippet' : [
|
2037 |
+
'special.factorial2(n, exact=False)',
|
2038 |
+
],
|
2039 |
+
},
|
2040 |
+
|
2041 |
+
{
|
2042 |
+
'name' : 'factorialk: $n(!!...!)$ = multifactorial of order $k$',
|
2043 |
+
'snippet' : [
|
2044 |
+
'special.factorialk(n, k, exact=False)',
|
2045 |
+
],
|
2046 |
+
},
|
2047 |
+
|
2048 |
+
{
|
2049 |
+
'name' : 'shichi: Hyperbolic sine and cosine integrals',
|
2050 |
+
'snippet' : [
|
2051 |
+
'special.shichi(x)',
|
2052 |
+
],
|
2053 |
+
},
|
2054 |
+
|
2055 |
+
{
|
2056 |
+
'name' : 'sici: Sine and cosine integrals',
|
2057 |
+
'snippet' : [
|
2058 |
+
'special.sici(x)',
|
2059 |
+
],
|
2060 |
+
},
|
2061 |
+
|
2062 |
+
{
|
2063 |
+
'name' : 'spence: Dilogarithm integral',
|
2064 |
+
'snippet' : [
|
2065 |
+
'special.spence(x)',
|
2066 |
+
],
|
2067 |
+
},
|
2068 |
+
|
2069 |
+
{
|
2070 |
+
'name' : 'lambertw: Lambert $W$ function [R497]',
|
2071 |
+
'snippet' : [
|
2072 |
+
'special.lambertw(z[, k, tol])',
|
2073 |
+
],
|
2074 |
+
},
|
2075 |
+
|
2076 |
+
{
|
2077 |
+
'name' : 'zeta: Hurwitz $\\zeta$ function',
|
2078 |
+
'snippet' : [
|
2079 |
+
'special.zeta(x, q)',
|
2080 |
+
],
|
2081 |
+
},
|
2082 |
+
|
2083 |
+
{
|
2084 |
+
'name' : 'zetac: Riemann $\\zeta$ function minus 1',
|
2085 |
+
'snippet' : [
|
2086 |
+
'special.zetac(x)',
|
2087 |
+
],
|
2088 |
+
},
|
2089 |
+
|
2090 |
+
],
|
2091 |
+
},
|
2092 |
+
|
2093 |
+
{
|
2094 |
+
'name' : 'Convenience Functions',
|
2095 |
+
'sub-menu' : [
|
2096 |
+
|
2097 |
+
{
|
2098 |
+
'name' : 'cbrt: $\\sqrt[3]{x}$',
|
2099 |
+
'snippet' : [
|
2100 |
+
'special.cbrt(x)',
|
2101 |
+
],
|
2102 |
+
},
|
2103 |
+
|
2104 |
+
{
|
2105 |
+
'name' : 'exp10: $10^x$',
|
2106 |
+
'snippet' : [
|
2107 |
+
'special.exp10(x)',
|
2108 |
+
],
|
2109 |
+
},
|
2110 |
+
|
2111 |
+
{
|
2112 |
+
'name' : 'exp2: $2^x$',
|
2113 |
+
'snippet' : [
|
2114 |
+
'special.exp2(x)',
|
2115 |
+
],
|
2116 |
+
},
|
2117 |
+
|
2118 |
+
{
|
2119 |
+
'name' : 'radian: Convert from degrees to radians',
|
2120 |
+
'snippet' : [
|
2121 |
+
'special.radian(d, m, s)',
|
2122 |
+
],
|
2123 |
+
},
|
2124 |
+
|
2125 |
+
{
|
2126 |
+
'name' : 'cosdg: Cosine of the angle given in degrees',
|
2127 |
+
'snippet' : [
|
2128 |
+
'special.cosdg(x)',
|
2129 |
+
],
|
2130 |
+
},
|
2131 |
+
|
2132 |
+
{
|
2133 |
+
'name' : 'sindg: Sine of angle given in degrees',
|
2134 |
+
'snippet' : [
|
2135 |
+
'special.sindg(x)',
|
2136 |
+
],
|
2137 |
+
},
|
2138 |
+
|
2139 |
+
{
|
2140 |
+
'name' : 'tandg: Tangent of angle given in degrees',
|
2141 |
+
'snippet' : [
|
2142 |
+
'special.tandg(x)',
|
2143 |
+
],
|
2144 |
+
},
|
2145 |
+
|
2146 |
+
{
|
2147 |
+
'name' : 'cotdg: Cotangent of the angle given in degrees',
|
2148 |
+
'snippet' : [
|
2149 |
+
'special.cotdg(x)',
|
2150 |
+
],
|
2151 |
+
},
|
2152 |
+
|
2153 |
+
{
|
2154 |
+
'name' : 'log1p: Calculates $\\log(1+x)$ for use when $x$ is near zero',
|
2155 |
+
'snippet' : [
|
2156 |
+
'special.log1p(x)',
|
2157 |
+
],
|
2158 |
+
},
|
2159 |
+
|
2160 |
+
{
|
2161 |
+
'name' : 'expm1: $\\exp(x) - 1$ for use when $x$ is near zero',
|
2162 |
+
'snippet' : [
|
2163 |
+
'special.expm1(x)',
|
2164 |
+
],
|
2165 |
+
},
|
2166 |
+
|
2167 |
+
{
|
2168 |
+
'name' : 'cosm1: $\\cos(x) - 1$ for use when $x$ is near zero',
|
2169 |
+
'snippet' : [
|
2170 |
+
'special.cosm1(x)',
|
2171 |
+
],
|
2172 |
+
},
|
2173 |
+
|
2174 |
+
{
|
2175 |
+
'name' : 'round: Round to nearest integer',
|
2176 |
+
'snippet' : [
|
2177 |
+
'special.round(x)',
|
2178 |
+
],
|
2179 |
+
},
|
2180 |
+
|
2181 |
+
{
|
2182 |
+
'name' : 'xlogy: Compute $x\\, \\log(y)$ so that the result is 0 if $x$ = 0',
|
2183 |
+
'snippet' : [
|
2184 |
+
'special.xlogy(x, y)',
|
2185 |
+
],
|
2186 |
+
},
|
2187 |
+
|
2188 |
+
{
|
2189 |
+
'name' : 'xlog1py: Compute $x\\, \\log(1+y)$ so that the result is 0 if $x$ = 0',
|
2190 |
+
'snippet' : [
|
2191 |
+
'special.xlog1py(x, y)',
|
2192 |
+
],
|
2193 |
+
},
|
2194 |
+
],
|
2195 |
+
},
|
2196 |
+
|
2197 |
+
],
|
2198 |
+
});
|