diff --git a/.gitignore b/.gitignore index e9e1e9b..da9e8cc 100644 --- a/.gitignore +++ b/.gitignore @@ -42,9 +42,9 @@ coverage.xml build/* dist/* sdist/* -docs/api/* -docs/_rst/* -docs/_build/* +#docs/api/* +#docs/_rst/* +#docs/_build/* cover/* MANIFEST diff --git a/docs/_build/doctrees/api/cristallina.doctree b/docs/_build/doctrees/api/cristallina.doctree new file mode 100644 index 0000000..52fcd96 Binary files /dev/null and b/docs/_build/doctrees/api/cristallina.doctree differ diff --git a/docs/_build/doctrees/api/modules.doctree b/docs/_build/doctrees/api/modules.doctree new file mode 100644 index 0000000..2e55c50 Binary files /dev/null and b/docs/_build/doctrees/api/modules.doctree differ diff --git a/docs/_build/doctrees/authors.doctree b/docs/_build/doctrees/authors.doctree new file mode 100644 index 0000000..fc02f9a Binary files /dev/null and b/docs/_build/doctrees/authors.doctree differ diff --git a/docs/_build/doctrees/changelog.doctree b/docs/_build/doctrees/changelog.doctree new file mode 100644 index 0000000..98c5326 Binary files /dev/null and b/docs/_build/doctrees/changelog.doctree differ diff --git a/docs/_build/doctrees/contributing.doctree b/docs/_build/doctrees/contributing.doctree new file mode 100644 index 0000000..5638230 Binary files /dev/null and b/docs/_build/doctrees/contributing.doctree differ diff --git a/docs/_build/doctrees/environment.pickle b/docs/_build/doctrees/environment.pickle new file mode 100644 index 0000000..62e511c Binary files /dev/null and b/docs/_build/doctrees/environment.pickle differ diff --git a/docs/_build/doctrees/index.doctree b/docs/_build/doctrees/index.doctree new file mode 100644 index 0000000..b0d46fb Binary files /dev/null and b/docs/_build/doctrees/index.doctree differ diff --git a/docs/_build/doctrees/license.doctree b/docs/_build/doctrees/license.doctree new file mode 100644 index 0000000..95a4846 Binary files /dev/null and b/docs/_build/doctrees/license.doctree differ diff --git a/docs/_build/doctrees/readme.doctree b/docs/_build/doctrees/readme.doctree new file mode 100644 index 0000000..721669a Binary files /dev/null and b/docs/_build/doctrees/readme.doctree differ diff --git a/docs/_build/html/.buildinfo b/docs/_build/html/.buildinfo new file mode 100644 index 0000000..eccac5f --- /dev/null +++ b/docs/_build/html/.buildinfo @@ -0,0 +1,4 @@ +# Sphinx build info version 1 +# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. +config: 87b1ead7c24148993fc29b0da8b0fcb9 +tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/_build/html/_modules/cristallina/SEA_GraphClient.html b/docs/_build/html/_modules/cristallina/SEA_GraphClient.html new file mode 100644 index 0000000..4e6db04 --- /dev/null +++ b/docs/_build/html/_modules/cristallina/SEA_GraphClient.html @@ -0,0 +1,296 @@ + + + + + + + + cristallina.SEA_GraphClient — cristallina 0.0.post1.dev53+g9be81e9.d20230129 documentation + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +

Source code for cristallina.SEA_GraphClient

+"""client for SEA GraphServer
+
+Usage:
+
+# open a client to host 'samenv', port 8764
+# the port number for the graph server may be retrived by
+# the command 'sea list' on the samenv machine
+
+client = GraphClient('samenv:8764')
+
+# get one curve
+
+tlist, vlist, period = client.get_curves(start, end, name)
+
+or
+
+# get all important curves
+curves = client.get_curves(start, end)
+
+
+# where:
+
+    start, end:  interval (unix time, as retrieved from time.time())
+    name:        the name of a curve (if no name or a list of names
+                 is given, the result is a curves dict)
+    curves:      dict <name> of [tlist, vlist, period]
+    tlist:       time axis (unix time)
+    vlist:       values (y-axis)
+    period:      the expected resolution (a hint for graphic clients,
+                 saying that for a time step t(n) - t(n-1) significantly
+                 bigger than period, an additional point should be added
+                 at t(n) - period)
+"""
+
+import socket
+import time
+
+
+FINISH = b'\nTRANSACTIONFINISHED'
+START = b'TRANSACTIONSTART'
+FMIN = min(FINISH[1:])
+FMAX = max(FINISH[1:])
+
+
+
[docs]def expect_reply(sock, expected): + while expected: + got = sock.recv(8192) + if not expected.startswith(got): + raise ValueError('expected %r but got %r' % (expected, got)) + expected = expected[len(got):]
+ + +
[docs]def raw_sics_client(hostport, login): + if ':' in hostport: + host, port = hostport.split(':') + hostport = (host, int(port)) + sock = socket.create_connection(hostport, timeout=3) + bbuf = b'' + expect_reply(sock, b'OK\n') + sock.sendall(login.encode('latin-1') + b'\n') + expect_reply(sock, b'Login OK\n') + request = yield None + while True: + sock.sendall(b'fulltransact %s\n' % request.encode('latin-1')) + try: + reply = sock.recv(8192) + if not reply: + sock.close() + return + except socket.timeout: + sock.shutdown(socket.SHUT_RDWR) + sock.close() + raise + before, tag, after = reply.partition(FINISH) + if tag: + result = bbuf + before + elif FMIN <= reply[0] <= FMAX: # the FINISH tag may have been cut + bbuf, tag, after = (bbuf + reply).partition(FINISH) + if not tag: + continue + result = bbuf + else: + bbuf += before + continue + bbuf = after[1:] + before, tag, result = result.rpartition(START) + if tag: + before, nl, result = result.partition(b'\n') + try: + request = yield result.decode('latin-1') + except GeneratorExit: + sock.shutdown(socket.SHUT_RDWR) + sock.close() + return
+ + +
[docs]def sics_client(hostport, command=None, login='Spy 007'): + sics = raw_sics_client(hostport, login) + next(sics) + if command is None: + return sics + result = sics.send(command) + sics.close() + return result
+ + +
[docs]class GraphClient: + def __init__(self, hostport): + self.sc = sics_client(hostport) + +
[docs] def close(self): + self.sc.close()
+ +
[docs] def get_raw(self, start, end, *args): + """get raw curves (values as text)""" + arglist = ' '.join(args) + try: + reply = self.sc.send(f'graph {start} {end} {arglist}') + except StopIteration: + raise ConnectionError('connection closed') + lines = reply.split('\n') + curve = None + result = {} + t = 0 + for line in lines[1:]: # skip first line + if line.startswith('*'): + spl = line[1:].split() + key = spl[0] + if key in ('0', '1'): + break + tlist = [] + vlist = [] + curve = [tlist, vlist, 1] + if len(spl) >= 3 and spl[1] == 'period': + curve[2] = float(spl[2]) + result[key] = curve + t = 0 + else: + tdif, _, value = line.partition(' ') + try: + t += float(tdif) + except ValueError: + print(lines) + tlist.append(t) + vlist.append(value) + return result
+ +
[docs] def get_names(self, start, end=None): + """get names and properties of curves configured to be display on SEA GUI graphics""" + end = start if end is None else end + result = self.get_raw(start, end, 'text', 'vars') + curves = {} + for vlist in result['vars'][1]: # text values + for item in vlist.split(): + item = item.split('|') + curves[item[0]] = item[1:] + [''] * (4 - len(item)) + return curves
+ +
[docs] def get_curves(self, start, end, name=None, none_value=None, nmax=None): + """get curves + + start, end: interval (unix time, as retrieved from time.time()) + non positive values are taken relative to the current time + name: a single name or a list of names or None to get all curves (as shown in the SEA GUI) + none_value: replacement when no value is defined + nmax: max. number of points per curve + + when name is a string, returns [tlist, vlist, period] + when name is None or a list of strings (names) returns a dict <name> of [tlist, vlist, period] + + tlist: time axis (unix time) + vlist: values (y-axis) + period: the expected resolution (a hint for graphic clients) + """ + if isinstance(name, str): + names = [name] + elif name is None: + names = self.get_names(start, end) + else: # assume names is a list of strings + names = name + args = ['np', str(nmax)] + names if nmax else names + result = self.get_raw(start, end, *args) + for key, curve in result.items(): + vlist = curve[1] + for i, v in enumerate(vlist): + try: + vlist[i] = float(v) + except ValueError: + vlist[i] = none_value + return result[name] if isinstance(name, str) else result
+ +
+ +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/_build/html/_modules/cristallina/analysis.html b/docs/_build/html/_modules/cristallina/analysis.html new file mode 100644 index 0000000..ef54d81 --- /dev/null +++ b/docs/_build/html/_modules/cristallina/analysis.html @@ -0,0 +1,327 @@ + + + + + + + + cristallina.analysis — cristallina 0.0.post1.dev53+g9be81e9.d20230129 documentation + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +

Source code for cristallina.analysis

+import re
+from collections import defaultdict
+from typing import Optional
+
+import numpy as np
+import lmfit
+
+from sfdata import SFDataFiles, sfdatafile, SFScanInfo
+
+import joblib
+from joblib import Parallel, delayed, Memory
+
+from . import utils
+from .utils import ROI
+
+memory = None
+
+
+
[docs]def setup_cachedirs(pgroup=None, cachedir=None): + """ + Sets the path to a persistent cache directory either from the given p-group (e.g. "p20841") + or an explicitly given directory. + + If heuristics fail we use "/tmp" as a non-persistent alternative. + """ + + global memory + if cachedir is not None: + # explicit directory given, use this choice + memory = Memory(cachedir, verbose=0, compress=2) + return + + try: + if pgroup is None: + pgroup_no = utils.heuristic_extract_pgroup() + else: + parts = re.split(r"(\d.*)", pgroup) # ['p', '2343', ''] + pgroup_no = parts[-2] + cachedir = f"/das/work/units/cristallina/p{pgroup_no}/cachedir" + except KeyError as e: + print(e) + cachedir = "/das/work/units/cristallina/p19739/cachedir" + + try: + memory = Memory(cachedir, verbose=0, compress=2) + except PermissionError as e: + cachedir = "/tmp" + memory = Memory(cachedir, verbose=0, compress=2)
+ + +setup_cachedirs() + + +@memory.cache(ignore=["batch_size"]) # we ignore batch_size for caching purposes +def perform_image_calculations( + fileset, + channel="JF16T03V01", + alignment_channels=None, + batch_size=10, + roi: Optional[ROI] = None, + preview=False, + operations=["sum"], +): + """ + Performs one or more calculations ("sum", "mean" or "std") for a given region of interest (roi) + for an image channel from a fileset (e.g. "run0352/data/acq0001.*.h5" or step.fnames from a SFScanInfo object). + + Allows alignment, i.e. reducing only to a common subset with other channels. + + Calculations are performed in batches to reduce maximum memory requirements. + + Preview only applies calculation to first batch and returns. + + Returns a dictionary ({"JF16T03V01_intensity":[11, 18, 21, 55, ...]}) + with the given channel values for each pulse and corresponding pulse id. + """ + + possible_operations = { + "sum": ["intensity", np.sum], + "mean": ["mean", np.mean], + "std": ["mean", np.std], + } + + with SFDataFiles(*fileset) as data: + if alignment_channels is not None: + channels = [channel] + [ch for ch in alignment_channels] + else: + channels = [channel] + + subset = data[channels] + + subset.drop_missing() + + Images = subset[channel] + + res = defaultdict(list) + res["roi"] = repr(roi) + + for image_slice in Images.in_batches(batch_size): + + index_slice, im = image_slice + + if roi is None: + im_ROI = im[:] + else: + im_ROI = im[:, roi.rows, roi.cols] + + # iterate over all operations + for op in operations: + label, func = possible_operations[op] + res[f"{channel}_{label}"].extend(func(im_ROI, axis=(1, 2))) + + res["pids"].extend(Images.pids[index_slice]) + + # only return first batch + if preview: + break + + return res + + +@memory.cache(ignore=["batch_size"]) # we ignore batch_size for caching purposes +def sum_images( + fileset, + channel="JF16T03V01", + alignment_channels=None, + batch_size=10, + roi: Optional[ROI] = None, + preview=False, +): + """ + Sums a given region of interest (roi) for an image channel from a + given fileset (e.g. "run0352/data/acq0001.*.h5" or step.fnames from a SFScanInfo object). + + Allows alignment, i.e. reducing only to a common subset with other channels. + + Summation is performed in batches to reduce maximum memory requirements. + + Preview only sums and returns the first batch. + + Returns a dictionary ({"JF16T03V01_intensity":[11, 18, 21, 55, ...]}) + with the given channel intensity for each pulse and corresponding pulse id. + """ + + return perform_image_calculations( + fileset, + channel=channel, + alignment_channels=alignment_channels, + batch_size=batch_size, + roi=roi, + preview=preview, + operations=["sum"], + ) + + +
[docs]def get_contrast_images( + fileset, + channel="JF16T03V01", + alignment_channels=None, + batch_size=10, + roi: Optional[ROI] = None, + preview=False, +): + """ + See perform_image_calculations. Here calculates mean and standard deviation for a given set of images. + """ + + return perform_image_calculations( + fileset, + channel=channel, + alignment_channels=alignment_channels, + batch_size=batch_size, + roi=roi, + preview=preview, + operations=["mean", "std"], + )
+ + +
[docs]def fit_2d_gaussian(image, roi: Optional[ROI] = None): + """ + 2D Gaussian fit using LMFit for a given image and an optional region of interest. + + Returns the x, y coordinates of the center and the results object which contains + further fit statistics. + """ + + # given an image and optional ROI + if roi is not None: + im = image[roi.rows, roi.cols] + else: + im = image + + len_y, len_x = im.shape + + y = np.arange(len_y) + x = np.arange(len_x) + + x, y = np.meshgrid(x, y) # here now a 2D mesh + + x, y = x.ravel(), y.ravel() # and all back into sequences of 1D arrays + + z = im.ravel() # and this also as a 1D + + model = lmfit.models.Gaussian2dModel() + params = model.guess(z, x, y) + result = model.fit( + z, + x=x, + y=y, + params=params, + ) + + if roi is not None: + # convert back to original image coordinates + center_x = roi.left + result.params["centerx"] + center_y = roi.bottom + result.params["centery"] + + else: + center_x = result.params["centerx"].value + center_y = result.params["centery"].value + + return center_x, center_y, result
+
+ +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/_build/html/_modules/cristallina/plot.html b/docs/_build/html/_modules/cristallina/plot.html new file mode 100644 index 0000000..e08e5c2 --- /dev/null +++ b/docs/_build/html/_modules/cristallina/plot.html @@ -0,0 +1,323 @@ + + + + + + + + cristallina.plot — cristallina 0.0.post1.dev53+g9be81e9.d20230129 documentation + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +

Source code for cristallina.plot

+import re
+from collections import defaultdict
+
+import matplotlib
+from matplotlib import pyplot as plt
+
+import warnings
+# because of https://github.com/kornia/kornia/issues/1425
+warnings.simplefilter("ignore", DeprecationWarning)
+
+import numpy as np
+from tqdm import tqdm
+from matplotlib import patches
+
+from pathlib import Path
+
+from sfdata import SFDataFiles, sfdatafile, SFScanInfo
+import jungfrau_utils as ju
+
+from . import utils
+from .utils import ROI
+
+
+
[docs]def ju_patch_less_verbose(ju_module): + """Quick monkey patch to suppress verbose messages from gain & pedestal file searcher.""" + ju_module.swissfel_helpers._locate_gain_file = ju_module.swissfel_helpers.locate_gain_file + ju_module.swissfel_helpers._locate_pedestal_file = ju_module.swissfel_helpers.locate_pedestal_file + + def less_verbose_gain(*args, **kwargs): + kwargs["verbose"] = False + return ju_module.swissfel_helpers._locate_gain_file(*args, **kwargs) + + def less_verbose_pedestal(*args, **kwargs): + kwargs["verbose"] = False + return ju_module.swissfel_helpers._locate_pedestal_file(*args, **kwargs) + + # ju_module.swissfel_helpers.locate_gain_file = less_verbose_gain + # ju_module.swissfel_helpers.locate_pedestal_file = less_verbose_pedestal + + ju_module.file_adapter.locate_gain_file = less_verbose_gain + ju_module.file_adapter.locate_pedestal_file = less_verbose_pedestal
+ + +ju_patch_less_verbose(ju) + +
[docs]def plot_correlation(x, y, ax=None, **ax_kwargs): + """ + Plots the correlation of x and y in a normalized scatterplot. + If no axis is given a figure and axis are created. + + Returns: The axis object and the correlation coefficient between + x and y. + """ + + xstd = np.std(x) + ystd = np.std(y) + + xnorm = (x - np.mean(x)) / xstd + ynorm = (y - np.mean(y)) / ystd + + n = len(y) + + r = 1 / (n) * sum(xnorm * ynorm) + + if ax is None: + fig, ax = plt.subplots() + + if ax_kwargs is not None: + ax.set(**ax_kwargs) + + ax.plot(xnorm, ynorm, "o") + ax.text(0.95, 0.05, f"r = {r:.2f}", transform=ax.transAxes, horizontalalignment="right") + + return ax, r
+ +
[docs]def plot_channel(data : SFDataFiles, channel_name, ax=None): + """ + Plots a given channel from an SFDataFiles object. + + Optionally: a matplotlib axis to plot into + """ + + channel_dim = len(data[channel_name].shape) + # dim == 3: a 2D Image + # dim == 2: an array per pulse (probably) + # dim == 1: a single value per pulse (probably) + + plot_f = { + 1: plot_1d_channel, + 2: plot_2d_channel, + 3: plot_image_channel, + } + + plot_f[channel_dim](data, channel_name, ax=ax)
+ + +
[docs]def axis_styling(ax, channel_name, description): + + ax.set_title(channel_name) + # ax.set_xlabel('x') + # ax.set_ylabel('a.u.') + ax.ticklabel_format(useOffset=False) + ax.text( + 0.05, + 0.05, + description, + transform=ax.transAxes, + horizontalalignment="left", + bbox=dict(boxstyle="round", color="lightgrey"), + )
+ + +
[docs]def plot_1d_channel(data : SFDataFiles, channel_name, ax=None): + """ + Plots channel data for a channel that contains a single numeric value per pulse. + """ + try: + mean, std = np.mean(data[channel_name].data), np.std(data[channel_name].data) + n_entries_per_frame = data[channel_name].shape + except TypeError: + print(f"Cannot parse channel {channel_name}. Check dimensionality.") + return + + y_data = data[channel_name].data + + if ax is None: + fig, ax = plt.subplots(constrained_layout=True) + + ax.plot(y_data) + description = f"mean: {mean:.2e},\nstd: {std:.2e}" + axis_styling(ax, channel_name, description)
+ + +
[docs]def plot_2d_channel(data : SFDataFiles, channel_name, ax=None): + """ + Plots channel data for a channel that contains a 1d array of numeric values per pulse. + """ + try: + mean, std = np.mean(data[channel_name].data), np.std(data[channel_name].data) + # data[channel_name].data + mean_over_frames = np.mean(data[channel_name].data, axis=0) + except TypeError: + print(f"Unknown data in channel {channel_name}.") + return + + y_data = mean_over_frames + + if ax is None: + fig, ax = plt.subplots(constrained_layout=True) + + ax.plot(y_data) + description = f"mean: {mean:.2e},\nstd: {std:.2e}" + axis_styling(ax, channel_name, description)
+ + +
[docs]def plot_image_channel(data : SFDataFiles, channel_name, pulse=0, ax=None, rois=None, norms=None): + """ + Plots channel data for a channel that contains an image (2d array) of numeric values per pulse. + """ + + im = data[channel_name][pulse] + + if ax is None: + fig, ax = plt.subplots(constrained_layout=True) + + std = im.std() + mean = im.mean() + + if norms is None: + norm = matplotlib.colors.Normalize(vmin=mean - std, vmax=mean + std) + else: + norm = matplotlib.colors.Normalize(vmin=norms[0], vmax=norms[1]) + + ax.imshow(im, norm=norm) + ax.invert_yaxis() + + if rois is not None: + # Plot rois if given + for i, roi in enumerate(rois): + # Create a rectangle with ([bottom left corner coordinates], width, height) + rect = patches.Rectangle( + [roi.left, roi.bottom], roi.width, roi.height, + linewidth=3, + edgecolor=f"C{i}", + facecolor="none", + label=roi.name, + ) + ax.add_patch(rect) + + description = f"mean: {mean:.2e},\nstd: {std:.2e}" + axis_styling(ax, channel_name, description) + plt.legend(loc=4)
+ +
[docs]def plot_spectrum_channel(data : SFDataFiles, channel_name_x, channel_name_y, average=True, pulse=0, ax=None): + """ + Plots channel data for two channels where the first is taken as the (constant) x-axis + and the second as the y-axis (here we take by default the mean over the individual pulses). + """ + try: + mean, std = np.mean(data[channel_name_y].data), np.std(data[channel_name_y].data) + mean_over_frames = np.mean(data[channel_name_y].data, axis=0) + except TypeError: + print(f"Unknown data in channel {channel_name_y}.") + return + + if average: + y_data = mean_over_frames + else: + y_data = data[channel_name_y].data[pulse] + + + if ax is None: + fig, ax = plt.subplots(constrained_layout=True) + + ax.plot(data[channel_name_x].data[0], y_data) + description = None # f"mean: {mean:.2e},\nstd: {std:.2e}" + ax.set_xlabel(channel_name_x) + axis_styling(ax, channel_name_y, description)
+
+ +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/_build/html/_modules/cristallina/skeleton.html b/docs/_build/html/_modules/cristallina/skeleton.html new file mode 100644 index 0000000..f28948f --- /dev/null +++ b/docs/_build/html/_modules/cristallina/skeleton.html @@ -0,0 +1,254 @@ + + + + + + + + cristallina.skeleton — cristallina 0.0.post1.dev53+g9be81e9.d20230129 documentation + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +

Source code for cristallina.skeleton

+"""
+This is a skeleton file that can serve as a starting point for a Python
+console script. To run this script uncomment the following lines in the
+``[options.entry_points]`` section in ``setup.cfg``::
+
+    console_scripts =
+         fibonacci = cristallina.skeleton:run
+
+Then run ``pip install .`` (or ``pip install -e .`` for editable mode)
+which will install the command ``fibonacci`` inside your current environment.
+
+Besides console scripts, the header (i.e. until ``_logger``...) of this file can
+also be used as template for Python modules.
+
+Note:
+    This file can be renamed depending on your needs or safely removed if not needed.
+
+References:
+    - https://setuptools.pypa.io/en/latest/userguide/entry_point.html
+    - https://pip.pypa.io/en/stable/reference/pip_install
+"""
+
+import argparse
+import logging
+import sys
+
+from cristallina import __version__
+
+__author__ = "Alexander Steppke"
+__copyright__ = "Alexander Steppke"
+__license__ = "MIT"
+
+_logger = logging.getLogger(__name__)
+
+
+# ---- Python API ----
+# The functions defined in this section can be imported by users in their
+# Python scripts/interactive interpreter, e.g. via
+# `from cristallina.skeleton import fib`,
+# when using this Python module as a library.
+
+
+
[docs]def fib(n): + """Fibonacci example function + + Args: + n (int): integer + + Returns: + int: n-th Fibonacci number + """ + assert n > 0 + a, b = 1, 1 + for _i in range(n - 1): + a, b = b, a + b + return a
+ + +# ---- CLI ---- +# The functions defined in this section are wrappers around the main Python +# API allowing them to be called directly from the terminal as a CLI +# executable/script. + + +
[docs]def parse_args(args): + """Parse command line parameters + + Args: + args (List[str]): command line parameters as list of strings + (for example ``["--help"]``). + + Returns: + :obj:`argparse.Namespace`: command line parameters namespace + """ + parser = argparse.ArgumentParser(description="Just a Fibonacci demonstration") + parser.add_argument( + "--version", + action="version", + version="cristallina {ver}".format(ver=__version__), + ) + parser.add_argument(dest="n", help="n-th Fibonacci number", type=int, metavar="INT") + parser.add_argument( + "-v", + "--verbose", + dest="loglevel", + help="set loglevel to INFO", + action="store_const", + const=logging.INFO, + ) + parser.add_argument( + "-vv", + "--very-verbose", + dest="loglevel", + help="set loglevel to DEBUG", + action="store_const", + const=logging.DEBUG, + ) + return parser.parse_args(args)
+ + +
[docs]def setup_logging(loglevel): + """Setup basic logging + + Args: + loglevel (int): minimum loglevel for emitting messages + """ + logformat = "[%(asctime)s] %(levelname)s:%(name)s:%(message)s" + logging.basicConfig( + level=loglevel, stream=sys.stdout, format=logformat, datefmt="%Y-%m-%d %H:%M:%S" + )
+ + +
[docs]def main(args): + """Wrapper allowing :func:`fib` to be called with string arguments in a CLI fashion + + Instead of returning the value from :func:`fib`, it prints the result to the + ``stdout`` in a nicely formatted message. + + Args: + args (List[str]): command line parameters as list of strings + (for example ``["--verbose", "42"]``). + """ + args = parse_args(args) + setup_logging(args.loglevel) + _logger.debug("Starting crazy calculations...") + print("The {}-th Fibonacci number is {}".format(args.n, fib(args.n))) + _logger.info("Script ends here")
+ + +
[docs]def run(): + """Calls :func:`main` passing the CLI arguments extracted from :obj:`sys.argv` + + This function can be used as entry point to create console scripts with setuptools. + """ + main(sys.argv[1:])
+ + +if __name__ == "__main__": + # ^ This is a guard statement that will prevent the following code from + # being executed in the case someone imports this file instead of + # executing it as a script. + # https://docs.python.org/3/library/__main__.html + + # After installing your project with pip, users can also run your Python + # modules as scripts via the ``-m`` flag, as defined in PEP 338:: + # + # python -m cristallina.skeleton 42 + # + run() +
+ +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/_build/html/_modules/cristallina/utils.html b/docs/_build/html/_modules/cristallina/utils.html new file mode 100644 index 0000000..2b419e0 --- /dev/null +++ b/docs/_build/html/_modules/cristallina/utils.html @@ -0,0 +1,451 @@ + + + + + + + + cristallina.utils — cristallina 0.0.post1.dev53+g9be81e9.d20230129 documentation + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +

Source code for cristallina.utils

+import yaml
+import os
+import logging
+logger = logging.getLogger()
+
+import numpy as np
+from sfdata import SFDataFiles, sfdatafile, SFScanInfo, SFProcFile
+from xraydb import material_mu
+from joblib import Parallel, delayed, cpu_count
+
+
[docs]def scan_info(run_number, base_path=None, small_data=True): + """Returns SFScanInfo object for a given run number. + If there is are small data channels, they will be added (small_data=False to suppress their loading). + """ + if base_path == None: + base_path = heuristic_extract_base_path() + + scan = SFScanInfo(f"{base_path}run{run_number:04}/meta/scan.json") + + if small_data: + for i in range(len(scan.readbacks)): + sd_path_for_step=heuristic_extract_smalldata_path()+'run'+str(run_number).zfill(4)+'/acq'+str(i+1).zfill(4)+'.smalldata.h5' + scan.info['scan_files'][i].append(sd_path_for_step) + + return scan
+ +
[docs]def channel_names(run_number,verbose=False): + """Prints channel names for a given run_number or scan object""" + if type(run_number) == SFScanInfo: + scan = run_number + else: + scan = scan_info(run_number) + + channel_list = list(scan[0].keys()) + + if verbose: + print(channel_list) + + return channel_list
+ + + + +
[docs]def process_run(run_number, rois,detector='JF16T03V01', calculate =None, only_shots=slice(None), n_jobs=cpu_count()): + """Process rois for a given detector. Save the results small data in the res/small_data/run... + By default only sum of rois is calculated, [mean,std,img] can be added to the "calculate" optional parameter. + """ + # Load scan object with SFScanInfo + scan = scan_info(run_number,small_data=False) + + # Set the path for later small data saving + path_with_run_folder = heuristic_extract_smalldata_path()+'run'+str(run_number).zfill(4) + + # Make the small data run folder if it doesn't exist + if not os.path.exists( path_with_run_folder ): + os.mkdir( path_with_run_folder ) + + # Add scan info into the small_data_object + #for key in scan.info.keys(): + # d[key]= info.info[key] + + # Check if there is only one roi. If yes, make a list of it so it can be iterated over. + if isinstance(rois, ROI): + rois = [rois] + + def process_step(i): + scan = scan_info(run_number,small_data=False) + + step = scan[i] + with step as data: + with SFProcFile(f"{path_with_run_folder}/acq{str(i+1).zfill(4)}.smalldata.h5", mode="w") as sd: + + # Calculate everything related to JF_rois + for roi in rois: + + bottom, top, left, right = roi.bottom, roi.top, roi.left, roi.right + + # Pulse ids for saving the new channels + det_pids = data[detector].pids + sd[roi.name] = det_pids[only_shots], data[detector][only_shots, bottom:top,left:right].sum(axis=(1, 2)) + if calculate: + if 'mean' in calculate: + sd[roi.name+"_mean"] = (det_pids[only_shots], data[detector][only_shots, bottom:top,left:right].mean(axis=(1, 2))) + if 'std' in calculate: + sd[roi.name+"_std"] = (det_pids[only_shots], data[detector][only_shots, bottom:top,left:right].std(axis=(1, 2))) + if 'img' in calculate: + sd[f'{roi.name}_img'] = (det_pids[only_shots], data[detector][only_shots, bottom:top,left:right].data) + + # Currently meta files can't be read by SFData, this will be modified by Sven and then we can use it. For now saving in roi_info + #sd.meta[roi.name+"_info"] = f"roi {roi.name}: {left},{right}; {bottom},{top} (left, right, bottom, top)" + + # These channels have only one dataset per step of the scan, so we take the first pulseID + sd[roi.name + "_info"] =([det_pids[0]], [f"roi {roi.name}: {left},{right}; {bottom},{top} (left, right, bottom, top)"]) + sd[roi.name + "_mean_img"] = ([det_pids[0]], [data[detector][:, bottom:top,left:right].mean(axis=(0))] ) + + Parallel(n_jobs=n_jobs,verbose=10)(delayed(process_step)(i) for i in range(len(scan)))
+ +
[docs]class ROI: + """Definition of region of interest (ROI) in image coordinates. + + Example: ROI(left=10, right=20, bottom=100, top=200). + + Directions assume that lower left corner of image is at (x=0, y=0). + """ + + def __init__( + self, + left: int = None, + right: int = None, + top: int = None, + bottom: int = None, + center_x: int = None, + center_y: int = None, + width: int = None, + height: int = None, + name: str = None, + ): + + if None not in (left, right, bottom, top): + self.left, self.right, self.bottom, self.top, = ( + left, + right, + bottom, + top, + ) + elif None not in (center_x, center_y, width, height): + self.from_centers_widths(center_x, center_y, width, height) + else: + raise ValueError("No valid ROI definition.") + + # Check that ROI has a name or generate default + if name is None: + logger.warning(f"No ROI name given, generating: {self.__repr__()}") + name = self.__repr__() + + self.name = name + +
[docs] def from_centers_widths(self, center_x, center_y, width, height): + self.left = center_x - width // 2 + self.right = center_x + width // 2 + + self.top = center_y + height // 2 + self.bottom = center_y - height // 2
+ + @property + def rows(self): + return slice(self.bottom, self.top) + + @property + def LeftRightBottomTop(self): + return [self.left, self.right, self.bottom, self.top] + + @property + def cols(self): + return slice(self.left, self.right) + + @property + def width(self): + return self.right - self.left + + @property + def height(self): + return self.top - self.bottom + + def __repr__(self): + return f"ROI(bottom={self.bottom},top={self.top},left={self.left},right={self.right})" + + def __eq__(self, other): + # we disregard the name for comparisons + return (self.left, self.right, self.bottom, self.top) == (other.left, other.right, other.bottom, other.top) + + def __ne__(self, other): + return not self == other
+ + +######################## Setting up paths ######################## + +
[docs]def heuristic_extract_pgroup(path=None): + """ The function tries to guess the current p-group from the + current working directory (default) or the contents of + the given path. + """ + path = path or os.getcwd() + + if "/p" in path: + # Cut the string and look at the next five letters after /p + p_number = path.partition("/p")[2][:5] + + if not p_number.isdigit(): + raise KeyError("Automatic p-group extraction from the current working directory didn't work.") + else: + raise KeyError("Automatic p-group extraction from the current working directory didn't work.") + return p_number
+ +
[docs]def heuristic_extract_base_path(): + """ The function tries to guess the full path where the raw data is saved.""" + p_number = heuristic_extract_pgroup() + base_path = f"/sf/cristallina/data/p{p_number}/raw/" + return base_path
+ +
[docs]def heuristic_extract_smalldata_path(): + """ The function tries to guess the full path where the small data is saved.""" + p_number = heuristic_extract_pgroup() + small_data_path = f"/das/work/units/cristallina/p{p_number}/smalldata/" + return small_data_path
+ +######################## Little useful functions ######################## + +
[docs]def find_nearest(array, value): + '''Finds an index in an array with a value that is nearest to given number''' + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return idx
+ +
[docs]def find_two_nearest(time_array,percentage): + '''Finds indeces of the two values that are the nearest to the given value in an array''' + array = np.asarray(time_array) + value = (np.max(array)-np.min(array))*percentage+np.min(array) + idx = (np.abs(array - value)).argmin() + indices = np.sort([np.argsort(np.abs(array-value))[0], np.argsort(np.abs(array-value))[1]]) + return indices
+ +
[docs]def gauss(x, H, A, x0, sigma): + """Returns gauss function value""" + return H + A * np.exp(-(x - x0) ** 2 / (2 * sigma ** 2))
+ +
[docs]def gauss_fit(x, y, fit_details=None, plot=None): + '''Returns [baseline_offset, Amplitude, center, sigma, FWHM]''' + + # Initial guesses + mean = sum(x * y) / sum(y) + sigma = np.sqrt(sum(y * (x - mean) ** 2) / sum(y)) + FWHM = 2.35482 * sigma + + # Fit + popt, pcov = curve_fit(gauss, x, y, p0=[min(y), max(y), mean, sigma]) + + # Add FWHM to the ouptuts + popt = np.append(popt,2.35482 * popt[3]) + + # Print results + if fit_details : + print('The baseline offset is', popt[0]) + print('The center is', popt[2]) + print('The sigma of the fit is', popt[3]) + print('The maximum intensity is', popt[0] + popt[1]) + print('The Amplitude is', popt[1]) + print('The FWHM is', 2.35482 * popt[3]) + + # Show plot + if plot: + plt.figure() + plt.plot(x, y, '.k', label='data') + plt.plot(x, gauss(x, *gauss_fit(x, y)[0:4]), '--r', label='fit') + + plt.legend() + plt.title('Gaussian fit') + plt.xlabel('X') + plt.ylabel('Y') + plt.show() + + return popt
+ +
[docs]def xray_transmission(energy,thickness,material='Si',density=[]): + '''Calculate x-ray tranmission for given energy, thickness and material. Default material is Si. Add material=element as a string for another material. Density as optional parameter''' + + mu = material_mu(material, energy) + + if density == []: + mu_array = material_mu(material, energy) + else: + mu_array = material_mu(formula, energy, density=density) + + trans = np.exp(-0.1*(thickness*1000)*mu_array) # 0.1 is beccause mu is in 1/cm, thickness converted to mm from m + + return trans
+ +######################## Unit conversions ######################## + +
[docs]def joules_to_eV(joules): + """Just a unit conversion""" + eV = joules * 6.241509e18 + return eV
+ +
[docs]def eV_to_joules(eV): + """Just a unit conversion""" + joules = eV * 1.602176565e-19 + return joules
+ +
[docs]def photon_energy_from_wavelength(wavelength): + '''Returns photon energy in eV from wavelength in meters. Source https://www.kmlabs.com/en/wavelength-to-photon-energy-calculator''' + Eph = 1239.8 / (wavelength*1e9) + return Eph
+ +
[docs]def wavelength_from_photon_energy(Eph): + '''Returns wavelength in meters from photon energy in eV. Source https://www.kmlabs.com/en/wavelength-to-photon-energy-calculator''' + wavelength = 1239.8 / (Eph*1e9) + return wavelength
+ +
[docs]def sigma_to_FWHM(sigma): + """Gaussian sigma to FWHM""" + FWHM = sigma * 2.355 + return FWHM
+ +
[docs]def FWHM_to_sigma(FWHM): + """FWHM to gaussian sigma""" + sigma = FWHM / 2.355 + return sigma
+
+ +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/_build/html/_modules/index.html b/docs/_build/html/_modules/index.html new file mode 100644 index 0000000..3c622ee --- /dev/null +++ b/docs/_build/html/_modules/index.html @@ -0,0 +1,108 @@ + + + + + + + + Overview: module code — cristallina 0.0.post1.dev53+g9be81e9.d20230129 documentation + + + + + + + + + + + + + + + + +
+
+
+ + + + +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/_build/html/_sources/api/cristallina.rst.txt b/docs/_build/html/_sources/api/cristallina.rst.txt new file mode 100644 index 0000000..d7dab71 --- /dev/null +++ b/docs/_build/html/_sources/api/cristallina.rst.txt @@ -0,0 +1,61 @@ +cristallina package +=================== + +Submodules +---------- + +cristallina.SEA\_GraphClient module +----------------------------------- + +.. automodule:: cristallina.SEA_GraphClient + :members: + :undoc-members: + :show-inheritance: + +cristallina.analysis module +--------------------------- + +.. automodule:: cristallina.analysis + :members: + :undoc-members: + :show-inheritance: + +cristallina.config module +------------------------- + +.. automodule:: cristallina.config + :members: + :undoc-members: + :show-inheritance: + +cristallina.plot module +----------------------- + +.. automodule:: cristallina.plot + :members: + :undoc-members: + :show-inheritance: + +cristallina.skeleton module +--------------------------- + +.. automodule:: cristallina.skeleton + :members: + :undoc-members: + :show-inheritance: + +cristallina.utils module +------------------------ + +.. automodule:: cristallina.utils + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: cristallina + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/_build/html/_sources/api/modules.rst.txt b/docs/_build/html/_sources/api/modules.rst.txt new file mode 100644 index 0000000..61c19b0 --- /dev/null +++ b/docs/_build/html/_sources/api/modules.rst.txt @@ -0,0 +1,7 @@ +cristallina +=========== + +.. toctree:: + :maxdepth: 4 + + cristallina diff --git a/docs/_build/html/_sources/authors.rst.txt b/docs/_build/html/_sources/authors.rst.txt new file mode 100644 index 0000000..cd8e091 --- /dev/null +++ b/docs/_build/html/_sources/authors.rst.txt @@ -0,0 +1,2 @@ +.. _authors: +.. include:: ../AUTHORS.rst diff --git a/docs/_build/html/_sources/changelog.rst.txt b/docs/_build/html/_sources/changelog.rst.txt new file mode 100644 index 0000000..871950d --- /dev/null +++ b/docs/_build/html/_sources/changelog.rst.txt @@ -0,0 +1,2 @@ +.. _changes: +.. include:: ../CHANGELOG.rst diff --git a/docs/_build/html/_sources/contributing.rst.txt b/docs/_build/html/_sources/contributing.rst.txt new file mode 100644 index 0000000..e582053 --- /dev/null +++ b/docs/_build/html/_sources/contributing.rst.txt @@ -0,0 +1 @@ +.. include:: ../CONTRIBUTING.rst diff --git a/docs/_build/html/_sources/index.rst.txt b/docs/_build/html/_sources/index.rst.txt new file mode 100644 index 0000000..c4fc044 --- /dev/null +++ b/docs/_build/html/_sources/index.rst.txt @@ -0,0 +1,61 @@ +=========== +cristallina +=========== + +This is the documentation of **cristallina**. + +.. note:: + + This is the main page of your project's `Sphinx`_ documentation. + It is formatted in `reStructuredText`_. Add additional pages + by creating rst-files in ``docs`` and adding them to the `toctree`_ below. + Use then `references`_ in order to link them from this page, e.g. + :ref:`authors` and :ref:`changes`. + + It is also possible to refer to the documentation of other Python packages + with the `Python domain syntax`_. By default you can reference the + documentation of `Sphinx`_, `Python`_, `NumPy`_, `SciPy`_, `matplotlib`_, + `Pandas`_, `Scikit-Learn`_. You can add more by extending the + ``intersphinx_mapping`` in your Sphinx's ``conf.py``. + + The pretty useful extension `autodoc`_ is activated by default and lets + you include documentation from docstrings. Docstrings can be written in + `Google style`_ (recommended!), `NumPy style`_ and `classical style`_. + + +Contents +======== + +.. toctree:: + :maxdepth: 2 + + Overview + Contributions & Help + License + Authors + Changelog + Module Reference + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + +.. _toctree: https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html +.. _reStructuredText: https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html +.. _references: https://www.sphinx-doc.org/en/stable/markup/inline.html +.. _Python domain syntax: https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#the-python-domain +.. _Sphinx: https://www.sphinx-doc.org/ +.. _Python: https://docs.python.org/ +.. _Numpy: https://numpy.org/doc/stable +.. _SciPy: https://docs.scipy.org/doc/scipy/reference/ +.. _matplotlib: https://matplotlib.org/contents.html# +.. _Pandas: https://pandas.pydata.org/pandas-docs/stable +.. _Scikit-Learn: https://scikit-learn.org/stable +.. _autodoc: https://www.sphinx-doc.org/en/master/ext/autodoc.html +.. _Google style: https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings +.. _NumPy style: https://numpydoc.readthedocs.io/en/latest/format.html +.. _classical style: https://www.sphinx-doc.org/en/master/domains.html#info-field-lists diff --git a/docs/_build/html/_sources/license.rst.txt b/docs/_build/html/_sources/license.rst.txt new file mode 100644 index 0000000..3989c51 --- /dev/null +++ b/docs/_build/html/_sources/license.rst.txt @@ -0,0 +1,7 @@ +.. _license: + +======= +License +======= + +.. include:: ../LICENSE.txt diff --git a/docs/_build/html/_sources/readme.rst.txt b/docs/_build/html/_sources/readme.rst.txt new file mode 100644 index 0000000..81995ef --- /dev/null +++ b/docs/_build/html/_sources/readme.rst.txt @@ -0,0 +1,2 @@ +.. _readme: +.. include:: ../README.rst diff --git a/docs/_build/html/_static/alabaster.css b/docs/_build/html/_static/alabaster.css new file mode 100644 index 0000000..f98defb --- /dev/null +++ b/docs/_build/html/_static/alabaster.css @@ -0,0 +1,703 @@ +@import url("basic.css"); + +/* -- page layout ----------------------------------------------------------- */ + +body { + font-family: Georgia, serif; + font-size: 17px; + background-color: #fff; + color: #000; + margin: 0; + padding: 0; +} + + +div.document { + width: 1200px; + margin: 30px auto 0 auto; +} + +div.documentwrapper { + float: left; + width: 100%; +} + +div.bodywrapper { + margin: 0 0 0 300px; +} + +div.sphinxsidebar { + width: 300px; + font-size: 14px; + line-height: 1.5; +} + +hr { + border: 1px solid #B1B4B6; +} + +div.body { + background-color: #fff; + color: #3E4349; + padding: 0 30px 0 30px; +} + +div.body > .section { + text-align: left; +} + +div.footer { + width: 1200px; + margin: 20px auto 30px auto; + font-size: 14px; + color: #888; + text-align: right; +} + +div.footer a { + color: #888; +} + +p.caption { + font-family: inherit; + font-size: inherit; +} + + +div.relations { + display: none; +} + + +div.sphinxsidebar a { + color: #444; + text-decoration: none; + border-bottom: 1px dotted #999; +} + +div.sphinxsidebar a:hover { + border-bottom: 1px solid #999; +} + +div.sphinxsidebarwrapper { + padding: 18px 10px; +} + +div.sphinxsidebarwrapper p.logo { + padding: 0; + margin: -10px 0 0 0px; + text-align: center; +} + +div.sphinxsidebarwrapper h1.logo { + margin-top: -10px; + text-align: center; + margin-bottom: 5px; + text-align: left; +} + +div.sphinxsidebarwrapper h1.logo-name { + margin-top: 0px; +} + +div.sphinxsidebarwrapper p.blurb { + margin-top: 0; + font-style: normal; +} + +div.sphinxsidebar h3, +div.sphinxsidebar h4 { + font-family: Georgia, serif; + color: #444; + font-size: 24px; + font-weight: normal; + margin: 0 0 5px 0; + padding: 0; +} + +div.sphinxsidebar h4 { + font-size: 20px; +} + +div.sphinxsidebar h3 a { + color: #444; +} + +div.sphinxsidebar p.logo a, +div.sphinxsidebar h3 a, +div.sphinxsidebar p.logo a:hover, +div.sphinxsidebar h3 a:hover { + border: none; +} + +div.sphinxsidebar p { + color: #555; + margin: 10px 0; +} + +div.sphinxsidebar ul { + margin: 10px 0; + padding: 0; + color: #000; +} + +div.sphinxsidebar ul li.toctree-l1 > a { + font-size: 120%; +} + +div.sphinxsidebar ul li.toctree-l2 > a { + font-size: 110%; +} + +div.sphinxsidebar input { + border: 1px solid #CCC; + font-family: Georgia, serif; + font-size: 1em; +} + +div.sphinxsidebar hr { + border: none; + height: 1px; + color: #AAA; + background: #AAA; + + text-align: left; + margin-left: 0; + width: 50%; +} + +div.sphinxsidebar .badge { + border-bottom: none; +} + +div.sphinxsidebar .badge:hover { + border-bottom: none; +} + +/* To address an issue with donation coming after search */ +div.sphinxsidebar h3.donation { + margin-top: 10px; +} + +/* -- body styles ----------------------------------------------------------- */ + +a { + color: #004B6B; + text-decoration: underline; +} + +a:hover { + color: #6D4100; + text-decoration: underline; +} + +div.body h1, +div.body h2, +div.body h3, +div.body h4, +div.body h5, +div.body h6 { + font-family: Georgia, serif; + font-weight: normal; + margin: 30px 0px 10px 0px; + padding: 0; +} + +div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; } +div.body h2 { font-size: 180%; } +div.body h3 { font-size: 150%; } +div.body h4 { font-size: 130%; } +div.body h5 { font-size: 100%; } +div.body h6 { font-size: 100%; } + +a.headerlink { + color: #DDD; + padding: 0 4px; + text-decoration: none; +} + +a.headerlink:hover { + color: #444; + background: #EAEAEA; +} + +div.body p, div.body dd, div.body li { + line-height: 1.4em; +} + +div.admonition { + margin: 20px 0px; + padding: 10px 30px; + background-color: #EEE; + border: 1px solid #CCC; +} + +div.admonition tt.xref, div.admonition code.xref, div.admonition a tt { + background-color: #FBFBFB; + border-bottom: 1px solid #fafafa; +} + +div.admonition p.admonition-title { + font-family: Georgia, serif; + font-weight: normal; + font-size: 24px; + margin: 0 0 10px 0; + padding: 0; + line-height: 1; +} + +div.admonition p.last { + margin-bottom: 0; +} + +div.highlight { + background-color: #fff; +} + +dt:target, .highlight { + background: #FAF3E8; +} + +div.warning { + background-color: #FCC; + border: 1px solid #FAA; +} + +div.danger { + background-color: #FCC; + border: 1px solid #FAA; + -moz-box-shadow: 2px 2px 4px #D52C2C; + -webkit-box-shadow: 2px 2px 4px #D52C2C; + box-shadow: 2px 2px 4px #D52C2C; +} + +div.error { + background-color: #FCC; + border: 1px solid #FAA; + -moz-box-shadow: 2px 2px 4px #D52C2C; + -webkit-box-shadow: 2px 2px 4px #D52C2C; + box-shadow: 2px 2px 4px #D52C2C; +} + +div.caution { + background-color: #FCC; + border: 1px solid #FAA; +} + +div.attention { + background-color: #FCC; + border: 1px solid #FAA; +} + +div.important { + background-color: #EEE; + border: 1px solid #CCC; +} + +div.note { + background-color: #EEE; + border: 1px solid #CCC; +} + +div.tip { + background-color: #EEE; + border: 1px solid #CCC; +} + +div.hint { + background-color: #EEE; + border: 1px solid #CCC; +} + +div.seealso { + background-color: #EEE; + border: 1px solid #CCC; +} + +div.topic { + background-color: #EEE; +} + +p.admonition-title { + display: inline; +} + +p.admonition-title:after { + content: ":"; +} + +pre, tt, code { + font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; + font-size: 0.9em; +} + +.hll { + background-color: #FFC; + margin: 0 -12px; + padding: 0 12px; + display: block; +} + +img.screenshot { +} + +tt.descname, tt.descclassname, code.descname, code.descclassname { + font-size: 0.95em; +} + +tt.descname, code.descname { + padding-right: 0.08em; +} + +img.screenshot { + -moz-box-shadow: 2px 2px 4px #EEE; + -webkit-box-shadow: 2px 2px 4px #EEE; + box-shadow: 2px 2px 4px #EEE; +} + +table.docutils { + border: 1px solid #888; + -moz-box-shadow: 2px 2px 4px #EEE; + -webkit-box-shadow: 2px 2px 4px #EEE; + box-shadow: 2px 2px 4px #EEE; +} + +table.docutils td, table.docutils th { + border: 1px solid #888; + padding: 0.25em 0.7em; +} + +table.field-list, table.footnote { + border: none; + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; +} + +table.footnote { + margin: 15px 0; + width: 100%; + border: 1px solid #EEE; + background: #FDFDFD; + font-size: 0.9em; +} + +table.footnote + table.footnote { + margin-top: -15px; + border-top: none; +} + +table.field-list th { + padding: 0 0.8em 0 0; +} + +table.field-list td { + padding: 0; +} + +table.field-list p { + margin-bottom: 0.8em; +} + +/* Cloned from + * https://github.com/sphinx-doc/sphinx/commit/ef60dbfce09286b20b7385333d63a60321784e68 + */ +.field-name { + -moz-hyphens: manual; + -ms-hyphens: manual; + -webkit-hyphens: manual; + hyphens: manual; +} + +table.footnote td.label { + width: .1px; + padding: 0.3em 0 0.3em 0.5em; +} + +table.footnote td { + padding: 0.3em 0.5em; +} + +dl { + margin-left: 0; + margin-right: 0; + margin-top: 0; + padding: 0; +} + +dl dd { + margin-left: 30px; +} + +blockquote { + margin: 0 0 0 30px; + padding: 0; +} + +ul, ol { + /* Matches the 30px from the narrow-screen "li > ul" selector below */ + margin: 10px 0 10px 30px; + padding: 0; +} + +pre { + background: #EEE; + padding: 7px 30px; + margin: 15px 0px; + line-height: 1.3em; +} + +div.viewcode-block:target { + background: #ffd; +} + +dl pre, blockquote pre, li pre { + margin-left: 0; + padding-left: 30px; +} + +tt, code { + background-color: #ecf0f3; + color: #222; + /* padding: 1px 2px; */ +} + +tt.xref, code.xref, a tt { + background-color: #FBFBFB; + border-bottom: 1px solid #fff; +} + +a.reference { + text-decoration: none; + border-bottom: 1px dotted #004B6B; +} + +/* Don't put an underline on images */ +a.image-reference, a.image-reference:hover { + border-bottom: none; +} + +a.reference:hover { + border-bottom: 1px solid #6D4100; +} + +a.footnote-reference { + text-decoration: none; + font-size: 0.7em; + vertical-align: top; + border-bottom: 1px dotted #004B6B; +} + +a.footnote-reference:hover { + border-bottom: 1px solid #6D4100; +} + +a:hover tt, a:hover code { + background: #EEE; +} + + +@media screen and (max-width: 870px) { + + div.sphinxsidebar { + display: none; + } + + div.document { + width: 100%; + + } + + div.documentwrapper { + margin-left: 0; + margin-top: 0; + margin-right: 0; + margin-bottom: 0; + } + + div.bodywrapper { + margin-top: 0; + margin-right: 0; + margin-bottom: 0; + margin-left: 0; + } + + ul { + margin-left: 0; + } + + li > ul { + /* Matches the 30px from the "ul, ol" selector above */ + margin-left: 30px; + } + + .document { + width: auto; + } + + .footer { + width: auto; + } + + .bodywrapper { + margin: 0; + } + + .footer { + width: auto; + } + + .github { + display: none; + } + + + +} + + + +@media screen and (max-width: 875px) { + + body { + margin: 0; + padding: 20px 30px; + } + + div.documentwrapper { + float: none; + background: #fff; + } + + div.sphinxsidebar { + display: block; + float: none; + width: 102.5%; + margin: 50px -30px -20px -30px; + padding: 10px 20px; + background: #333; + color: #FFF; + } + + div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p, + div.sphinxsidebar h3 a { + color: #fff; + } + + div.sphinxsidebar a { + color: #AAA; + } + + div.sphinxsidebar p.logo { + display: none; + } + + div.document { + width: 100%; + margin: 0; + } + + div.footer { + display: none; + } + + div.bodywrapper { + margin: 0; + } + + div.body { + min-height: 0; + padding: 0; + } + + .rtd_doc_footer { + display: none; + } + + .document { + width: auto; + } + + .footer { + width: auto; + } + + .footer { + width: auto; + } + + .github { + display: none; + } +} + + +/* misc. */ + +.revsys-inline { + display: none!important; +} + +/* Make nested-list/multi-paragraph items look better in Releases changelog + * pages. Without this, docutils' magical list fuckery causes inconsistent + * formatting between different release sub-lists. + */ +div#changelog > div.section > ul > li > p:only-child { + margin-bottom: 0; +} + +/* Hide fugly table cell borders in ..bibliography:: directive output */ +table.docutils.citation, table.docutils.citation td, table.docutils.citation th { + border: none; + /* Below needed in some edge cases; if not applied, bottom shadows appear */ + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; +} + + +/* relbar */ + +.related { + line-height: 30px; + width: 100%; + font-size: 0.9rem; +} + +.related.top { + border-bottom: 1px solid #EEE; + margin-bottom: 20px; +} + +.related.bottom { + border-top: 1px solid #EEE; +} + +.related ul { + padding: 0; + margin: 0; + list-style: none; +} + +.related li { + display: inline; +} + +nav#rellinks { + float: right; +} + +nav#rellinks li+li:before { + content: "|"; +} + +nav#breadcrumbs li+li:before { + content: "\00BB"; +} + +/* Hide certain items when printing */ +@media print { + div.related { + display: none; + } +} \ No newline at end of file diff --git a/docs/_build/html/_static/basic.css b/docs/_build/html/_static/basic.css new file mode 100644 index 0000000..7577acb --- /dev/null +++ b/docs/_build/html/_static/basic.css @@ -0,0 +1,903 @@ +/* + * basic.css + * ~~~~~~~~~ + * + * Sphinx stylesheet -- basic theme. + * + * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/* -- main layout ----------------------------------------------------------- */ + +div.clearer { + clear: both; +} + +div.section::after { + display: block; + content: ''; + clear: left; +} + +/* -- relbar ---------------------------------------------------------------- */ + +div.related { + width: 100%; + font-size: 90%; +} + +div.related h3 { + display: none; +} + +div.related ul { + margin: 0; + padding: 0 0 0 10px; + list-style: none; +} + +div.related li { + display: inline; +} + +div.related li.right { + float: right; + margin-right: 5px; +} + +/* -- sidebar --------------------------------------------------------------- */ + +div.sphinxsidebarwrapper { + padding: 10px 5px 0 10px; +} + +div.sphinxsidebar { + float: left; + width: 230px; + margin-left: -100%; + font-size: 90%; + word-wrap: break-word; + overflow-wrap : break-word; +} + +div.sphinxsidebar ul { + list-style: none; +} + +div.sphinxsidebar ul ul, +div.sphinxsidebar ul.want-points { + margin-left: 20px; + list-style: square; +} + +div.sphinxsidebar ul ul { + margin-top: 0; + margin-bottom: 0; +} + +div.sphinxsidebar form { + margin-top: 10px; +} + +div.sphinxsidebar input { + border: 1px solid #98dbcc; + font-family: sans-serif; + font-size: 1em; +} + +div.sphinxsidebar #searchbox form.search { + overflow: hidden; +} + +div.sphinxsidebar #searchbox input[type="text"] { + float: left; + width: 80%; + padding: 0.25em; + box-sizing: border-box; +} + +div.sphinxsidebar #searchbox input[type="submit"] { + float: left; + width: 20%; + border-left: none; + padding: 0.25em; + box-sizing: border-box; +} + + +img { + border: 0; + max-width: 100%; +} + +/* -- search page ----------------------------------------------------------- */ + +ul.search { + margin: 10px 0 0 20px; + padding: 0; +} + +ul.search li { + padding: 5px 0 5px 20px; + background-image: url(file.png); + background-repeat: no-repeat; + background-position: 0 7px; +} + +ul.search li a { + font-weight: bold; +} + +ul.search li p.context { + color: #888; + margin: 2px 0 0 30px; + text-align: left; +} + +ul.keywordmatches li.goodmatch a { + font-weight: bold; +} + +/* -- index page ------------------------------------------------------------ */ + +table.contentstable { + width: 90%; + margin-left: auto; + margin-right: auto; +} + +table.contentstable p.biglink { + line-height: 150%; +} + +a.biglink { + font-size: 1.3em; +} + +span.linkdescr { + font-style: italic; + padding-top: 5px; + font-size: 90%; +} + +/* -- general index --------------------------------------------------------- */ + +table.indextable { + width: 100%; +} + +table.indextable td { + text-align: left; + vertical-align: top; +} + +table.indextable ul { + margin-top: 0; + margin-bottom: 0; + list-style-type: none; +} + +table.indextable > tbody > tr > td > ul { + padding-left: 0em; +} + +table.indextable tr.pcap { + height: 10px; +} + +table.indextable tr.cap { + margin-top: 10px; + background-color: #f2f2f2; +} + +img.toggler { + margin-right: 3px; + margin-top: 3px; + cursor: pointer; +} + +div.modindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +div.genindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +/* -- domain module index --------------------------------------------------- */ + +table.modindextable td { + padding: 2px; + border-collapse: collapse; +} + +/* -- general body styles --------------------------------------------------- */ + +div.body { + min-width: 360px; + max-width: 800px; +} + +div.body p, div.body dd, div.body li, div.body blockquote { + -moz-hyphens: auto; + -ms-hyphens: auto; + -webkit-hyphens: auto; + hyphens: auto; +} + +a.headerlink { + visibility: hidden; +} + +h1:hover > a.headerlink, +h2:hover > a.headerlink, +h3:hover > a.headerlink, +h4:hover > a.headerlink, +h5:hover > a.headerlink, +h6:hover > a.headerlink, +dt:hover > a.headerlink, +caption:hover > a.headerlink, +p.caption:hover > a.headerlink, +div.code-block-caption:hover > a.headerlink { + visibility: visible; +} + +div.body p.caption { + text-align: inherit; +} + +div.body td { + text-align: left; +} + +.first { + margin-top: 0 !important; +} + +p.rubric { + margin-top: 30px; + font-weight: bold; +} + +img.align-left, figure.align-left, .figure.align-left, object.align-left { + clear: left; + float: left; + margin-right: 1em; +} + +img.align-right, figure.align-right, .figure.align-right, object.align-right { + clear: right; + float: right; + margin-left: 1em; +} + +img.align-center, figure.align-center, .figure.align-center, object.align-center { + display: block; + margin-left: auto; + margin-right: auto; +} + +img.align-default, figure.align-default, .figure.align-default { + display: block; + margin-left: auto; + margin-right: auto; +} + +.align-left { + text-align: left; +} + +.align-center { + text-align: center; +} + +.align-default { + text-align: center; +} + +.align-right { + text-align: right; +} + +/* -- sidebars -------------------------------------------------------------- */ + +div.sidebar, +aside.sidebar { + margin: 0 0 0.5em 1em; + border: 1px solid #ddb; + padding: 7px; + background-color: #ffe; + width: 40%; + float: right; + clear: right; + overflow-x: auto; +} + +p.sidebar-title { + font-weight: bold; +} + +nav.contents, +aside.topic, +div.admonition, div.topic, blockquote { + clear: left; +} + +/* -- topics ---------------------------------------------------------------- */ + +nav.contents, +aside.topic, +div.topic { + border: 1px solid #ccc; + padding: 7px; + margin: 10px 0 10px 0; +} + +p.topic-title { + font-size: 1.1em; + font-weight: bold; + margin-top: 10px; +} + +/* -- admonitions ----------------------------------------------------------- */ + +div.admonition { + margin-top: 10px; + margin-bottom: 10px; + padding: 7px; +} + +div.admonition dt { + font-weight: bold; +} + +p.admonition-title { + margin: 0px 10px 5px 0px; + font-weight: bold; +} + +div.body p.centered { + text-align: center; + margin-top: 25px; +} + +/* -- content of sidebars/topics/admonitions -------------------------------- */ + +div.sidebar > :last-child, +aside.sidebar > :last-child, +nav.contents > :last-child, +aside.topic > :last-child, +div.topic > :last-child, +div.admonition > :last-child { + margin-bottom: 0; +} + +div.sidebar::after, +aside.sidebar::after, +nav.contents::after, +aside.topic::after, +div.topic::after, +div.admonition::after, +blockquote::after { + display: block; + content: ''; + clear: both; +} + +/* -- tables ---------------------------------------------------------------- */ + +table.docutils { + margin-top: 10px; + margin-bottom: 10px; + border: 0; + border-collapse: collapse; +} + +table.align-center { + margin-left: auto; + margin-right: auto; +} + +table.align-default { + margin-left: auto; + margin-right: auto; +} + +table caption span.caption-number { + font-style: italic; +} + +table caption span.caption-text { +} + +table.docutils td, table.docutils th { + padding: 1px 8px 1px 5px; + border-top: 0; + border-left: 0; + border-right: 0; + border-bottom: 1px solid #aaa; +} + +th { + text-align: left; + padding-right: 5px; +} + +table.citation { + border-left: solid 1px gray; + margin-left: 1px; +} + +table.citation td { + border-bottom: none; +} + +th > :first-child, +td > :first-child { + margin-top: 0px; +} + +th > :last-child, +td > :last-child { + margin-bottom: 0px; +} + +/* -- figures --------------------------------------------------------------- */ + +div.figure, figure { + margin: 0.5em; + padding: 0.5em; +} + +div.figure p.caption, figcaption { + padding: 0.3em; +} + +div.figure p.caption span.caption-number, +figcaption span.caption-number { + font-style: italic; +} + +div.figure p.caption span.caption-text, +figcaption span.caption-text { +} + +/* -- field list styles ----------------------------------------------------- */ + +table.field-list td, table.field-list th { + border: 0 !important; +} + +.field-list ul { + margin: 0; + padding-left: 1em; +} + +.field-list p { + margin: 0; +} + +.field-name { + -moz-hyphens: manual; + -ms-hyphens: manual; + -webkit-hyphens: manual; + hyphens: manual; +} + +/* -- hlist styles ---------------------------------------------------------- */ + +table.hlist { + margin: 1em 0; +} + +table.hlist td { + vertical-align: top; +} + +/* -- object description styles --------------------------------------------- */ + +.sig { + font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; +} + +.sig-name, code.descname { + background-color: transparent; + font-weight: bold; +} + +.sig-name { + font-size: 1.1em; +} + +code.descname { + font-size: 1.2em; +} + +.sig-prename, code.descclassname { + background-color: transparent; +} + +.optional { + font-size: 1.3em; +} + +.sig-paren { + font-size: larger; +} + +.sig-param.n { + font-style: italic; +} + +/* C++ specific styling */ + +.sig-inline.c-texpr, +.sig-inline.cpp-texpr { + font-family: unset; +} + +.sig.c .k, .sig.c .kt, +.sig.cpp .k, .sig.cpp .kt { + color: #0033B3; +} + +.sig.c .m, +.sig.cpp .m { + color: #1750EB; +} + +.sig.c .s, .sig.c .sc, +.sig.cpp .s, .sig.cpp .sc { + color: #067D17; +} + + +/* -- other body styles ----------------------------------------------------- */ + +ol.arabic { + list-style: decimal; +} + +ol.loweralpha { + list-style: lower-alpha; +} + +ol.upperalpha { + list-style: upper-alpha; +} + +ol.lowerroman { + list-style: lower-roman; +} + +ol.upperroman { + list-style: upper-roman; +} + +:not(li) > ol > li:first-child > :first-child, +:not(li) > ul > li:first-child > :first-child { + margin-top: 0px; +} + +:not(li) > ol > li:last-child > :last-child, +:not(li) > ul > li:last-child > :last-child { + margin-bottom: 0px; +} + +ol.simple ol p, +ol.simple ul p, +ul.simple ol p, +ul.simple ul p { + margin-top: 0; +} + +ol.simple > li:not(:first-child) > p, +ul.simple > li:not(:first-child) > p { + margin-top: 0; +} + +ol.simple p, +ul.simple p { + margin-bottom: 0; +} + +aside.footnote > span, +div.citation > span { + float: left; +} +aside.footnote > span:last-of-type, +div.citation > span:last-of-type { + padding-right: 0.5em; +} +aside.footnote > p { + margin-left: 2em; +} +div.citation > p { + margin-left: 4em; +} +aside.footnote > p:last-of-type, +div.citation > p:last-of-type { + margin-bottom: 0em; +} +aside.footnote > p:last-of-type:after, +div.citation > p:last-of-type:after { + content: ""; + clear: both; +} + +dl.field-list { + display: grid; + grid-template-columns: fit-content(30%) auto; +} + +dl.field-list > dt { + font-weight: bold; + word-break: break-word; + padding-left: 0.5em; + padding-right: 5px; +} + +dl.field-list > dd { + padding-left: 0.5em; + margin-top: 0em; + margin-left: 0em; + margin-bottom: 0em; +} + +dl { + margin-bottom: 15px; +} + +dd > :first-child { + margin-top: 0px; +} + +dd ul, dd table { + margin-bottom: 10px; +} + +dd { + margin-top: 3px; + margin-bottom: 10px; + margin-left: 30px; +} + +dl > dd:last-child, +dl > dd:last-child > :last-child { + margin-bottom: 0; +} + +dt:target, span.highlighted { + background-color: #fbe54e; +} + +rect.highlighted { + fill: #fbe54e; +} + +dl.glossary dt { + font-weight: bold; + font-size: 1.1em; +} + +.versionmodified { + font-style: italic; +} + +.system-message { + background-color: #fda; + padding: 5px; + border: 3px solid red; +} + +.footnote:target { + background-color: #ffa; +} + +.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; +} + +.line-block .line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; +} + +.guilabel, .menuselection { + font-family: sans-serif; +} + +.accelerator { + text-decoration: underline; +} + +.classifier { + font-style: oblique; +} + +.classifier:before { + font-style: normal; + margin: 0 0.5em; + content: ":"; + display: inline-block; +} + +abbr, acronym { + border-bottom: dotted 1px; + cursor: help; +} + +/* -- code displays --------------------------------------------------------- */ + +pre { + overflow: auto; + overflow-y: hidden; /* fixes display issues on Chrome browsers */ +} + +pre, div[class*="highlight-"] { + clear: both; +} + +span.pre { + -moz-hyphens: none; + -ms-hyphens: none; + -webkit-hyphens: none; + hyphens: none; + white-space: nowrap; +} + +div[class*="highlight-"] { + margin: 1em 0; +} + +td.linenos pre { + border: 0; + background-color: transparent; + color: #aaa; +} + +table.highlighttable { + display: block; +} + +table.highlighttable tbody { + display: block; +} + +table.highlighttable tr { + display: flex; +} + +table.highlighttable td { + margin: 0; + padding: 0; +} + +table.highlighttable td.linenos { + padding-right: 0.5em; +} + +table.highlighttable td.code { + flex: 1; + overflow: hidden; +} + +.highlight .hll { + display: block; +} + +div.highlight pre, +table.highlighttable pre { + margin: 0; +} + +div.code-block-caption + div { + margin-top: 0; +} + +div.code-block-caption { + margin-top: 1em; + padding: 2px 5px; + font-size: small; +} + +div.code-block-caption code { + background-color: transparent; +} + +table.highlighttable td.linenos, +span.linenos, +div.highlight span.gp { /* gp: Generic.Prompt */ + user-select: none; + -webkit-user-select: text; /* Safari fallback only */ + -webkit-user-select: none; /* Chrome/Safari */ + -moz-user-select: none; /* Firefox */ + -ms-user-select: none; /* IE10+ */ +} + +div.code-block-caption span.caption-number { + padding: 0.1em 0.3em; + font-style: italic; +} + +div.code-block-caption span.caption-text { +} + +div.literal-block-wrapper { + margin: 1em 0; +} + +code.xref, a code { + background-color: transparent; + font-weight: bold; +} + +h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { + background-color: transparent; +} + +.viewcode-link { + float: right; +} + +.viewcode-back { + float: right; + font-family: sans-serif; +} + +div.viewcode-block:target { + margin: -1px -10px; + padding: 0 10px; +} + +/* -- math display ---------------------------------------------------------- */ + +img.math { + vertical-align: middle; +} + +div.body div.math p { + text-align: center; +} + +span.eqno { + float: right; +} + +span.eqno a.headerlink { + position: absolute; + z-index: 1; +} + +div.math:hover a.headerlink { + visibility: visible; +} + +/* -- printout stylesheet --------------------------------------------------- */ + +@media print { + div.document, + div.documentwrapper, + div.bodywrapper { + margin: 0 !important; + width: 100%; + } + + div.sphinxsidebar, + div.related, + div.footer, + #top-link { + display: none; + } +} \ No newline at end of file diff --git a/docs/_build/html/_static/custom.css b/docs/_build/html/_static/custom.css new file mode 100644 index 0000000..2a924f1 --- /dev/null +++ b/docs/_build/html/_static/custom.css @@ -0,0 +1 @@ +/* This file intentionally left blank. */ diff --git a/docs/_build/html/_static/doctools.js b/docs/_build/html/_static/doctools.js new file mode 100644 index 0000000..d06a71d --- /dev/null +++ b/docs/_build/html/_static/doctools.js @@ -0,0 +1,156 @@ +/* + * doctools.js + * ~~~~~~~~~~~ + * + * Base JavaScript utilities for all Sphinx HTML documentation. + * + * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ +"use strict"; + +const BLACKLISTED_KEY_CONTROL_ELEMENTS = new Set([ + "TEXTAREA", + "INPUT", + "SELECT", + "BUTTON", +]); + +const _ready = (callback) => { + if (document.readyState !== "loading") { + callback(); + } else { + document.addEventListener("DOMContentLoaded", callback); + } +}; + +/** + * Small JavaScript module for the documentation. + */ +const Documentation = { + init: () => { + Documentation.initDomainIndexTable(); + Documentation.initOnKeyListeners(); + }, + + /** + * i18n support + */ + TRANSLATIONS: {}, + PLURAL_EXPR: (n) => (n === 1 ? 0 : 1), + LOCALE: "unknown", + + // gettext and ngettext don't access this so that the functions + // can safely bound to a different name (_ = Documentation.gettext) + gettext: (string) => { + const translated = Documentation.TRANSLATIONS[string]; + switch (typeof translated) { + case "undefined": + return string; // no translation + case "string": + return translated; // translation exists + default: + return translated[0]; // (singular, plural) translation tuple exists + } + }, + + ngettext: (singular, plural, n) => { + const translated = Documentation.TRANSLATIONS[singular]; + if (typeof translated !== "undefined") + return translated[Documentation.PLURAL_EXPR(n)]; + return n === 1 ? singular : plural; + }, + + addTranslations: (catalog) => { + Object.assign(Documentation.TRANSLATIONS, catalog.messages); + Documentation.PLURAL_EXPR = new Function( + "n", + `return (${catalog.plural_expr})` + ); + Documentation.LOCALE = catalog.locale; + }, + + /** + * helper function to focus on search bar + */ + focusSearchBar: () => { + document.querySelectorAll("input[name=q]")[0]?.focus(); + }, + + /** + * Initialise the domain index toggle buttons + */ + initDomainIndexTable: () => { + const toggler = (el) => { + const idNumber = el.id.substr(7); + const toggledRows = document.querySelectorAll(`tr.cg-${idNumber}`); + if (el.src.substr(-9) === "minus.png") { + el.src = `${el.src.substr(0, el.src.length - 9)}plus.png`; + toggledRows.forEach((el) => (el.style.display = "none")); + } else { + el.src = `${el.src.substr(0, el.src.length - 8)}minus.png`; + toggledRows.forEach((el) => (el.style.display = "")); + } + }; + + const togglerElements = document.querySelectorAll("img.toggler"); + togglerElements.forEach((el) => + el.addEventListener("click", (event) => toggler(event.currentTarget)) + ); + togglerElements.forEach((el) => (el.style.display = "")); + if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) togglerElements.forEach(toggler); + }, + + initOnKeyListeners: () => { + // only install a listener if it is really needed + if ( + !DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS && + !DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS + ) + return; + + document.addEventListener("keydown", (event) => { + // bail for input elements + if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; + // bail with special keys + if (event.altKey || event.ctrlKey || event.metaKey) return; + + if (!event.shiftKey) { + switch (event.key) { + case "ArrowLeft": + if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; + + const prevLink = document.querySelector('link[rel="prev"]'); + if (prevLink && prevLink.href) { + window.location.href = prevLink.href; + event.preventDefault(); + } + break; + case "ArrowRight": + if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; + + const nextLink = document.querySelector('link[rel="next"]'); + if (nextLink && nextLink.href) { + window.location.href = nextLink.href; + event.preventDefault(); + } + break; + } + } + + // some keyboard layouts may need Shift to get / + switch (event.key) { + case "/": + if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) break; + Documentation.focusSearchBar(); + event.preventDefault(); + } + }); + }, +}; + +// quick alias for translations +const _ = Documentation.gettext; + +_ready(Documentation.init); diff --git a/docs/_build/html/_static/documentation_options.js b/docs/_build/html/_static/documentation_options.js new file mode 100644 index 0000000..6dc336b --- /dev/null +++ b/docs/_build/html/_static/documentation_options.js @@ -0,0 +1,14 @@ +var DOCUMENTATION_OPTIONS = { + URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), + VERSION: '0.0.post1.dev53+g9be81e9.d20230129', + LANGUAGE: 'en', + COLLAPSE_INDEX: false, + BUILDER: 'html', + FILE_SUFFIX: '.html', + LINK_SUFFIX: '.html', + HAS_SOURCE: true, + SOURCELINK_SUFFIX: '.txt', + NAVIGATION_WITH_KEYS: false, + SHOW_SEARCH_SUMMARY: true, + ENABLE_SEARCH_SHORTCUTS: true, +}; \ No newline at end of file diff --git a/docs/_build/html/_static/file.png b/docs/_build/html/_static/file.png new file mode 100644 index 0000000..a858a41 Binary files /dev/null and b/docs/_build/html/_static/file.png differ diff --git a/docs/_build/html/_static/language_data.js b/docs/_build/html/_static/language_data.js new file mode 100644 index 0000000..250f566 --- /dev/null +++ b/docs/_build/html/_static/language_data.js @@ -0,0 +1,199 @@ +/* + * language_data.js + * ~~~~~~~~~~~~~~~~ + * + * This script contains the language-specific data used by searchtools.js, + * namely the list of stopwords, stemmer, scorer and splitter. + * + * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +var stopwords = ["a", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "near", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"]; + + +/* Non-minified version is copied as a separate JS file, is available */ + +/** + * Porter Stemmer + */ +var Stemmer = function() { + + var step2list = { + ational: 'ate', + tional: 'tion', + enci: 'ence', + anci: 'ance', + izer: 'ize', + bli: 'ble', + alli: 'al', + entli: 'ent', + eli: 'e', + ousli: 'ous', + ization: 'ize', + ation: 'ate', + ator: 'ate', + alism: 'al', + iveness: 'ive', + fulness: 'ful', + ousness: 'ous', + aliti: 'al', + iviti: 'ive', + biliti: 'ble', + logi: 'log' + }; + + var step3list = { + icate: 'ic', + ative: '', + alize: 'al', + iciti: 'ic', + ical: 'ic', + ful: '', + ness: '' + }; + + var c = "[^aeiou]"; // consonant + var v = "[aeiouy]"; // vowel + var C = c + "[^aeiouy]*"; // consonant sequence + var V = v + "[aeiou]*"; // vowel sequence + + var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 + var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 + var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 + var s_v = "^(" + C + ")?" + v; // vowel in stem + + this.stemWord = function (w) { + var stem; + var suffix; + var firstch; + var origword = w; + + if (w.length < 3) + return w; + + var re; + var re2; + var re3; + var re4; + + firstch = w.substr(0,1); + if (firstch == "y") + w = firstch.toUpperCase() + w.substr(1); + + // Step 1a + re = /^(.+?)(ss|i)es$/; + re2 = /^(.+?)([^s])s$/; + + if (re.test(w)) + w = w.replace(re,"$1$2"); + else if (re2.test(w)) + w = w.replace(re2,"$1$2"); + + // Step 1b + re = /^(.+?)eed$/; + re2 = /^(.+?)(ed|ing)$/; + if (re.test(w)) { + var fp = re.exec(w); + re = new RegExp(mgr0); + if (re.test(fp[1])) { + re = /.$/; + w = w.replace(re,""); + } + } + else if (re2.test(w)) { + var fp = re2.exec(w); + stem = fp[1]; + re2 = new RegExp(s_v); + if (re2.test(stem)) { + w = stem; + re2 = /(at|bl|iz)$/; + re3 = new RegExp("([^aeiouylsz])\\1$"); + re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); + if (re2.test(w)) + w = w + "e"; + else if (re3.test(w)) { + re = /.$/; + w = w.replace(re,""); + } + else if (re4.test(w)) + w = w + "e"; + } + } + + // Step 1c + re = /^(.+?)y$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(s_v); + if (re.test(stem)) + w = stem + "i"; + } + + // Step 2 + re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + suffix = fp[2]; + re = new RegExp(mgr0); + if (re.test(stem)) + w = stem + step2list[suffix]; + } + + // Step 3 + re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + suffix = fp[2]; + re = new RegExp(mgr0); + if (re.test(stem)) + w = stem + step3list[suffix]; + } + + // Step 4 + re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; + re2 = /^(.+?)(s|t)(ion)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(mgr1); + if (re.test(stem)) + w = stem; + } + else if (re2.test(w)) { + var fp = re2.exec(w); + stem = fp[1] + fp[2]; + re2 = new RegExp(mgr1); + if (re2.test(stem)) + w = stem; + } + + // Step 5 + re = /^(.+?)e$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(mgr1); + re2 = new RegExp(meq1); + re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); + if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) + w = stem; + } + re = /ll$/; + re2 = new RegExp(mgr1); + if (re.test(w) && re2.test(w)) { + re = /.$/; + w = w.replace(re,""); + } + + // and turn initial Y back to y + if (firstch == "y") + w = firstch.toLowerCase() + w.substr(1); + return w; + } +} + diff --git a/docs/_build/html/_static/minus.png b/docs/_build/html/_static/minus.png new file mode 100644 index 0000000..d96755f Binary files /dev/null and b/docs/_build/html/_static/minus.png differ diff --git a/docs/_build/html/_static/plus.png b/docs/_build/html/_static/plus.png new file mode 100644 index 0000000..7107cec Binary files /dev/null and b/docs/_build/html/_static/plus.png differ diff --git a/docs/_build/html/_static/pygments.css b/docs/_build/html/_static/pygments.css new file mode 100644 index 0000000..691aeb8 --- /dev/null +++ b/docs/_build/html/_static/pygments.css @@ -0,0 +1,74 @@ +pre { line-height: 125%; } +td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } +span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } +td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +.highlight .hll { background-color: #ffffcc } +.highlight { background: #eeffcc; } +.highlight .c { color: #408090; font-style: italic } /* Comment */ +.highlight .err { border: 1px solid #FF0000 } /* Error */ +.highlight .k { color: #007020; font-weight: bold } /* Keyword */ +.highlight .o { color: #666666 } /* Operator */ +.highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */ +.highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */ +.highlight .cp { color: #007020 } /* Comment.Preproc */ +.highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */ +.highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */ +.highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ +.highlight .gd { color: #A00000 } /* Generic.Deleted */ +.highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .gr { color: #FF0000 } /* Generic.Error */ +.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.highlight .gi { color: #00A000 } /* Generic.Inserted */ +.highlight .go { color: #333333 } /* Generic.Output */ +.highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ +.highlight .gs { font-weight: bold } /* Generic.Strong */ +.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.highlight .gt { color: #0044DD } /* Generic.Traceback */ +.highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ +.highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ +.highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ +.highlight .kp { color: #007020 } /* Keyword.Pseudo */ +.highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ +.highlight .kt { color: #902000 } /* Keyword.Type */ +.highlight .m { color: #208050 } /* Literal.Number */ +.highlight .s { color: #4070a0 } /* Literal.String */ +.highlight .na { color: #4070a0 } /* Name.Attribute */ +.highlight .nb { color: #007020 } /* Name.Builtin */ +.highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */ +.highlight .no { color: #60add5 } /* Name.Constant */ +.highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ +.highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */ +.highlight .ne { color: #007020 } /* Name.Exception */ +.highlight .nf { color: #06287e } /* Name.Function */ +.highlight .nl { color: #002070; font-weight: bold } /* Name.Label */ +.highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ +.highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */ +.highlight .nv { color: #bb60d5 } /* Name.Variable */ +.highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */ +.highlight .w { color: #bbbbbb } /* Text.Whitespace */ +.highlight .mb { color: #208050 } /* Literal.Number.Bin */ +.highlight .mf { color: #208050 } /* Literal.Number.Float */ +.highlight .mh { color: #208050 } /* Literal.Number.Hex */ +.highlight .mi { color: #208050 } /* Literal.Number.Integer */ +.highlight .mo { color: #208050 } /* Literal.Number.Oct */ +.highlight .sa { color: #4070a0 } /* Literal.String.Affix */ +.highlight .sb { color: #4070a0 } /* Literal.String.Backtick */ +.highlight .sc { color: #4070a0 } /* Literal.String.Char */ +.highlight .dl { color: #4070a0 } /* Literal.String.Delimiter */ +.highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */ +.highlight .s2 { color: #4070a0 } /* Literal.String.Double */ +.highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */ +.highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */ +.highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ +.highlight .sx { color: #c65d09 } /* Literal.String.Other */ +.highlight .sr { color: #235388 } /* Literal.String.Regex */ +.highlight .s1 { color: #4070a0 } /* Literal.String.Single */ +.highlight .ss { color: #517918 } /* Literal.String.Symbol */ +.highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ +.highlight .fm { color: #06287e } /* Name.Function.Magic */ +.highlight .vc { color: #bb60d5 } /* Name.Variable.Class */ +.highlight .vg { color: #bb60d5 } /* Name.Variable.Global */ +.highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */ +.highlight .vm { color: #bb60d5 } /* Name.Variable.Magic */ +.highlight .il { color: #208050 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/docs/_build/html/_static/searchtools.js b/docs/_build/html/_static/searchtools.js new file mode 100644 index 0000000..97d56a7 --- /dev/null +++ b/docs/_build/html/_static/searchtools.js @@ -0,0 +1,566 @@ +/* + * searchtools.js + * ~~~~~~~~~~~~~~~~ + * + * Sphinx JavaScript utilities for the full-text search. + * + * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ +"use strict"; + +/** + * Simple result scoring code. + */ +if (typeof Scorer === "undefined") { + var Scorer = { + // Implement the following function to further tweak the score for each result + // The function takes a result array [docname, title, anchor, descr, score, filename] + // and returns the new score. + /* + score: result => { + const [docname, title, anchor, descr, score, filename] = result + return score + }, + */ + + // query matches the full name of an object + objNameMatch: 11, + // or matches in the last dotted part of the object name + objPartialMatch: 6, + // Additive scores depending on the priority of the object + objPrio: { + 0: 15, // used to be importantResults + 1: 5, // used to be objectResults + 2: -5, // used to be unimportantResults + }, + // Used when the priority is not in the mapping. + objPrioDefault: 0, + + // query found in title + title: 15, + partialTitle: 7, + // query found in terms + term: 5, + partialTerm: 2, + }; +} + +const _removeChildren = (element) => { + while (element && element.lastChild) element.removeChild(element.lastChild); +}; + +/** + * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping + */ +const _escapeRegExp = (string) => + string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string + +const _displayItem = (item, searchTerms) => { + const docBuilder = DOCUMENTATION_OPTIONS.BUILDER; + const docUrlRoot = DOCUMENTATION_OPTIONS.URL_ROOT; + const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX; + const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX; + const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY; + + const [docName, title, anchor, descr, score, _filename] = item; + + let listItem = document.createElement("li"); + let requestUrl; + let linkUrl; + if (docBuilder === "dirhtml") { + // dirhtml builder + let dirname = docName + "/"; + if (dirname.match(/\/index\/$/)) + dirname = dirname.substring(0, dirname.length - 6); + else if (dirname === "index/") dirname = ""; + requestUrl = docUrlRoot + dirname; + linkUrl = requestUrl; + } else { + // normal html builders + requestUrl = docUrlRoot + docName + docFileSuffix; + linkUrl = docName + docLinkSuffix; + } + let linkEl = listItem.appendChild(document.createElement("a")); + linkEl.href = linkUrl + anchor; + linkEl.dataset.score = score; + linkEl.innerHTML = title; + if (descr) + listItem.appendChild(document.createElement("span")).innerHTML = + " (" + descr + ")"; + else if (showSearchSummary) + fetch(requestUrl) + .then((responseData) => responseData.text()) + .then((data) => { + if (data) + listItem.appendChild( + Search.makeSearchSummary(data, searchTerms) + ); + }); + Search.output.appendChild(listItem); +}; +const _finishSearch = (resultCount) => { + Search.stopPulse(); + Search.title.innerText = _("Search Results"); + if (!resultCount) + Search.status.innerText = Documentation.gettext( + "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories." + ); + else + Search.status.innerText = _( + `Search finished, found ${resultCount} page(s) matching the search query.` + ); +}; +const _displayNextItem = ( + results, + resultCount, + searchTerms +) => { + // results left, load the summary and display it + // this is intended to be dynamic (don't sub resultsCount) + if (results.length) { + _displayItem(results.pop(), searchTerms); + setTimeout( + () => _displayNextItem(results, resultCount, searchTerms), + 5 + ); + } + // search finished, update title and status message + else _finishSearch(resultCount); +}; + +/** + * Default splitQuery function. Can be overridden in ``sphinx.search`` with a + * custom function per language. + * + * The regular expression works by splitting the string on consecutive characters + * that are not Unicode letters, numbers, underscores, or emoji characters. + * This is the same as ``\W+`` in Python, preserving the surrogate pair area. + */ +if (typeof splitQuery === "undefined") { + var splitQuery = (query) => query + .split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}]+/gu) + .filter(term => term) // remove remaining empty strings +} + +/** + * Search Module + */ +const Search = { + _index: null, + _queued_query: null, + _pulse_status: -1, + + htmlToText: (htmlString) => { + const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html'); + htmlElement.querySelectorAll(".headerlink").forEach((el) => { el.remove() }); + const docContent = htmlElement.querySelector('[role="main"]'); + if (docContent !== undefined) return docContent.textContent; + console.warn( + "Content block not found. Sphinx search tries to obtain it via '[role=main]'. Could you check your theme or template." + ); + return ""; + }, + + init: () => { + const query = new URLSearchParams(window.location.search).get("q"); + document + .querySelectorAll('input[name="q"]') + .forEach((el) => (el.value = query)); + if (query) Search.performSearch(query); + }, + + loadIndex: (url) => + (document.body.appendChild(document.createElement("script")).src = url), + + setIndex: (index) => { + Search._index = index; + if (Search._queued_query !== null) { + const query = Search._queued_query; + Search._queued_query = null; + Search.query(query); + } + }, + + hasIndex: () => Search._index !== null, + + deferQuery: (query) => (Search._queued_query = query), + + stopPulse: () => (Search._pulse_status = -1), + + startPulse: () => { + if (Search._pulse_status >= 0) return; + + const pulse = () => { + Search._pulse_status = (Search._pulse_status + 1) % 4; + Search.dots.innerText = ".".repeat(Search._pulse_status); + if (Search._pulse_status >= 0) window.setTimeout(pulse, 500); + }; + pulse(); + }, + + /** + * perform a search for something (or wait until index is loaded) + */ + performSearch: (query) => { + // create the required interface elements + const searchText = document.createElement("h2"); + searchText.textContent = _("Searching"); + const searchSummary = document.createElement("p"); + searchSummary.classList.add("search-summary"); + searchSummary.innerText = ""; + const searchList = document.createElement("ul"); + searchList.classList.add("search"); + + const out = document.getElementById("search-results"); + Search.title = out.appendChild(searchText); + Search.dots = Search.title.appendChild(document.createElement("span")); + Search.status = out.appendChild(searchSummary); + Search.output = out.appendChild(searchList); + + const searchProgress = document.getElementById("search-progress"); + // Some themes don't use the search progress node + if (searchProgress) { + searchProgress.innerText = _("Preparing search..."); + } + Search.startPulse(); + + // index already loaded, the browser was quick! + if (Search.hasIndex()) Search.query(query); + else Search.deferQuery(query); + }, + + /** + * execute search (requires search index to be loaded) + */ + query: (query) => { + const filenames = Search._index.filenames; + const docNames = Search._index.docnames; + const titles = Search._index.titles; + const allTitles = Search._index.alltitles; + const indexEntries = Search._index.indexentries; + + // stem the search terms and add them to the correct list + const stemmer = new Stemmer(); + const searchTerms = new Set(); + const excludedTerms = new Set(); + const highlightTerms = new Set(); + const objectTerms = new Set(splitQuery(query.toLowerCase().trim())); + splitQuery(query.trim()).forEach((queryTerm) => { + const queryTermLower = queryTerm.toLowerCase(); + + // maybe skip this "word" + // stopwords array is from language_data.js + if ( + stopwords.indexOf(queryTermLower) !== -1 || + queryTerm.match(/^\d+$/) + ) + return; + + // stem the word + let word = stemmer.stemWord(queryTermLower); + // select the correct list + if (word[0] === "-") excludedTerms.add(word.substr(1)); + else { + searchTerms.add(word); + highlightTerms.add(queryTermLower); + } + }); + + if (SPHINX_HIGHLIGHT_ENABLED) { // set in sphinx_highlight.js + localStorage.setItem("sphinx_highlight_terms", [...highlightTerms].join(" ")) + } + + // console.debug("SEARCH: searching for:"); + // console.info("required: ", [...searchTerms]); + // console.info("excluded: ", [...excludedTerms]); + + // array of [docname, title, anchor, descr, score, filename] + let results = []; + _removeChildren(document.getElementById("search-progress")); + + const queryLower = query.toLowerCase(); + for (const [title, foundTitles] of Object.entries(allTitles)) { + if (title.toLowerCase().includes(queryLower) && (queryLower.length >= title.length/2)) { + for (const [file, id] of foundTitles) { + let score = Math.round(100 * queryLower.length / title.length) + results.push([ + docNames[file], + titles[file] !== title ? `${titles[file]} > ${title}` : title, + id !== null ? "#" + id : "", + null, + score, + filenames[file], + ]); + } + } + } + + // search for explicit entries in index directives + for (const [entry, foundEntries] of Object.entries(indexEntries)) { + if (entry.includes(queryLower) && (queryLower.length >= entry.length/2)) { + for (const [file, id] of foundEntries) { + let score = Math.round(100 * queryLower.length / entry.length) + results.push([ + docNames[file], + titles[file], + id ? "#" + id : "", + null, + score, + filenames[file], + ]); + } + } + } + + // lookup as object + objectTerms.forEach((term) => + results.push(...Search.performObjectSearch(term, objectTerms)) + ); + + // lookup as search terms in fulltext + results.push(...Search.performTermsSearch(searchTerms, excludedTerms)); + + // let the scorer override scores with a custom scoring function + if (Scorer.score) results.forEach((item) => (item[4] = Scorer.score(item))); + + // now sort the results by score (in opposite order of appearance, since the + // display function below uses pop() to retrieve items) and then + // alphabetically + results.sort((a, b) => { + const leftScore = a[4]; + const rightScore = b[4]; + if (leftScore === rightScore) { + // same score: sort alphabetically + const leftTitle = a[1].toLowerCase(); + const rightTitle = b[1].toLowerCase(); + if (leftTitle === rightTitle) return 0; + return leftTitle > rightTitle ? -1 : 1; // inverted is intentional + } + return leftScore > rightScore ? 1 : -1; + }); + + // remove duplicate search results + // note the reversing of results, so that in the case of duplicates, the highest-scoring entry is kept + let seen = new Set(); + results = results.reverse().reduce((acc, result) => { + let resultStr = result.slice(0, 4).concat([result[5]]).map(v => String(v)).join(','); + if (!seen.has(resultStr)) { + acc.push(result); + seen.add(resultStr); + } + return acc; + }, []); + + results = results.reverse(); + + // for debugging + //Search.lastresults = results.slice(); // a copy + // console.info("search results:", Search.lastresults); + + // print the results + _displayNextItem(results, results.length, searchTerms); + }, + + /** + * search for object names + */ + performObjectSearch: (object, objectTerms) => { + const filenames = Search._index.filenames; + const docNames = Search._index.docnames; + const objects = Search._index.objects; + const objNames = Search._index.objnames; + const titles = Search._index.titles; + + const results = []; + + const objectSearchCallback = (prefix, match) => { + const name = match[4] + const fullname = (prefix ? prefix + "." : "") + name; + const fullnameLower = fullname.toLowerCase(); + if (fullnameLower.indexOf(object) < 0) return; + + let score = 0; + const parts = fullnameLower.split("."); + + // check for different match types: exact matches of full name or + // "last name" (i.e. last dotted part) + if (fullnameLower === object || parts.slice(-1)[0] === object) + score += Scorer.objNameMatch; + else if (parts.slice(-1)[0].indexOf(object) > -1) + score += Scorer.objPartialMatch; // matches in last name + + const objName = objNames[match[1]][2]; + const title = titles[match[0]]; + + // If more than one term searched for, we require other words to be + // found in the name/title/description + const otherTerms = new Set(objectTerms); + otherTerms.delete(object); + if (otherTerms.size > 0) { + const haystack = `${prefix} ${name} ${objName} ${title}`.toLowerCase(); + if ( + [...otherTerms].some((otherTerm) => haystack.indexOf(otherTerm) < 0) + ) + return; + } + + let anchor = match[3]; + if (anchor === "") anchor = fullname; + else if (anchor === "-") anchor = objNames[match[1]][1] + "-" + fullname; + + const descr = objName + _(", in ") + title; + + // add custom score for some objects according to scorer + if (Scorer.objPrio.hasOwnProperty(match[2])) + score += Scorer.objPrio[match[2]]; + else score += Scorer.objPrioDefault; + + results.push([ + docNames[match[0]], + fullname, + "#" + anchor, + descr, + score, + filenames[match[0]], + ]); + }; + Object.keys(objects).forEach((prefix) => + objects[prefix].forEach((array) => + objectSearchCallback(prefix, array) + ) + ); + return results; + }, + + /** + * search for full-text terms in the index + */ + performTermsSearch: (searchTerms, excludedTerms) => { + // prepare search + const terms = Search._index.terms; + const titleTerms = Search._index.titleterms; + const filenames = Search._index.filenames; + const docNames = Search._index.docnames; + const titles = Search._index.titles; + + const scoreMap = new Map(); + const fileMap = new Map(); + + // perform the search on the required terms + searchTerms.forEach((word) => { + const files = []; + const arr = [ + { files: terms[word], score: Scorer.term }, + { files: titleTerms[word], score: Scorer.title }, + ]; + // add support for partial matches + if (word.length > 2) { + const escapedWord = _escapeRegExp(word); + Object.keys(terms).forEach((term) => { + if (term.match(escapedWord) && !terms[word]) + arr.push({ files: terms[term], score: Scorer.partialTerm }); + }); + Object.keys(titleTerms).forEach((term) => { + if (term.match(escapedWord) && !titleTerms[word]) + arr.push({ files: titleTerms[word], score: Scorer.partialTitle }); + }); + } + + // no match but word was a required one + if (arr.every((record) => record.files === undefined)) return; + + // found search word in contents + arr.forEach((record) => { + if (record.files === undefined) return; + + let recordFiles = record.files; + if (recordFiles.length === undefined) recordFiles = [recordFiles]; + files.push(...recordFiles); + + // set score for the word in each file + recordFiles.forEach((file) => { + if (!scoreMap.has(file)) scoreMap.set(file, {}); + scoreMap.get(file)[word] = record.score; + }); + }); + + // create the mapping + files.forEach((file) => { + if (fileMap.has(file) && fileMap.get(file).indexOf(word) === -1) + fileMap.get(file).push(word); + else fileMap.set(file, [word]); + }); + }); + + // now check if the files don't contain excluded terms + const results = []; + for (const [file, wordList] of fileMap) { + // check if all requirements are matched + + // as search terms with length < 3 are discarded + const filteredTermCount = [...searchTerms].filter( + (term) => term.length > 2 + ).length; + if ( + wordList.length !== searchTerms.size && + wordList.length !== filteredTermCount + ) + continue; + + // ensure that none of the excluded terms is in the search result + if ( + [...excludedTerms].some( + (term) => + terms[term] === file || + titleTerms[term] === file || + (terms[term] || []).includes(file) || + (titleTerms[term] || []).includes(file) + ) + ) + break; + + // select one (max) score for the file. + const score = Math.max(...wordList.map((w) => scoreMap.get(file)[w])); + // add result to the result list + results.push([ + docNames[file], + titles[file], + "", + null, + score, + filenames[file], + ]); + } + return results; + }, + + /** + * helper function to return a node containing the + * search summary for a given text. keywords is a list + * of stemmed words. + */ + makeSearchSummary: (htmlText, keywords) => { + const text = Search.htmlToText(htmlText); + if (text === "") return null; + + const textLower = text.toLowerCase(); + const actualStartPosition = [...keywords] + .map((k) => textLower.indexOf(k.toLowerCase())) + .filter((i) => i > -1) + .slice(-1)[0]; + const startWithContext = Math.max(actualStartPosition - 120, 0); + + const top = startWithContext === 0 ? "" : "..."; + const tail = startWithContext + 240 < text.length ? "..." : ""; + + let summary = document.createElement("p"); + summary.classList.add("context"); + summary.textContent = top + text.substr(startWithContext, 240).trim() + tail; + + return summary; + }, +}; + +_ready(Search.init); diff --git a/docs/_build/html/_static/sphinx_highlight.js b/docs/_build/html/_static/sphinx_highlight.js new file mode 100644 index 0000000..aae669d --- /dev/null +++ b/docs/_build/html/_static/sphinx_highlight.js @@ -0,0 +1,144 @@ +/* Highlighting utilities for Sphinx HTML documentation. */ +"use strict"; + +const SPHINX_HIGHLIGHT_ENABLED = true + +/** + * highlight a given string on a node by wrapping it in + * span elements with the given class name. + */ +const _highlight = (node, addItems, text, className) => { + if (node.nodeType === Node.TEXT_NODE) { + const val = node.nodeValue; + const parent = node.parentNode; + const pos = val.toLowerCase().indexOf(text); + if ( + pos >= 0 && + !parent.classList.contains(className) && + !parent.classList.contains("nohighlight") + ) { + let span; + + const closestNode = parent.closest("body, svg, foreignObject"); + const isInSVG = closestNode && closestNode.matches("svg"); + if (isInSVG) { + span = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); + } else { + span = document.createElement("span"); + span.classList.add(className); + } + + span.appendChild(document.createTextNode(val.substr(pos, text.length))); + parent.insertBefore( + span, + parent.insertBefore( + document.createTextNode(val.substr(pos + text.length)), + node.nextSibling + ) + ); + node.nodeValue = val.substr(0, pos); + + if (isInSVG) { + const rect = document.createElementNS( + "http://www.w3.org/2000/svg", + "rect" + ); + const bbox = parent.getBBox(); + rect.x.baseVal.value = bbox.x; + rect.y.baseVal.value = bbox.y; + rect.width.baseVal.value = bbox.width; + rect.height.baseVal.value = bbox.height; + rect.setAttribute("class", className); + addItems.push({ parent: parent, target: rect }); + } + } + } else if (node.matches && !node.matches("button, select, textarea")) { + node.childNodes.forEach((el) => _highlight(el, addItems, text, className)); + } +}; +const _highlightText = (thisNode, text, className) => { + let addItems = []; + _highlight(thisNode, addItems, text, className); + addItems.forEach((obj) => + obj.parent.insertAdjacentElement("beforebegin", obj.target) + ); +}; + +/** + * Small JavaScript module for the documentation. + */ +const SphinxHighlight = { + + /** + * highlight the search words provided in localstorage in the text + */ + highlightSearchWords: () => { + if (!SPHINX_HIGHLIGHT_ENABLED) return; // bail if no highlight + + // get and clear terms from localstorage + const url = new URL(window.location); + const highlight = + localStorage.getItem("sphinx_highlight_terms") + || url.searchParams.get("highlight") + || ""; + localStorage.removeItem("sphinx_highlight_terms") + url.searchParams.delete("highlight"); + window.history.replaceState({}, "", url); + + // get individual terms from highlight string + const terms = highlight.toLowerCase().split(/\s+/).filter(x => x); + if (terms.length === 0) return; // nothing to do + + // There should never be more than one element matching "div.body" + const divBody = document.querySelectorAll("div.body"); + const body = divBody.length ? divBody[0] : document.querySelector("body"); + window.setTimeout(() => { + terms.forEach((term) => _highlightText(body, term, "highlighted")); + }, 10); + + const searchBox = document.getElementById("searchbox"); + if (searchBox === null) return; + searchBox.appendChild( + document + .createRange() + .createContextualFragment( + '" + ) + ); + }, + + /** + * helper function to hide the search marks again + */ + hideSearchWords: () => { + document + .querySelectorAll("#searchbox .highlight-link") + .forEach((el) => el.remove()); + document + .querySelectorAll("span.highlighted") + .forEach((el) => el.classList.remove("highlighted")); + localStorage.removeItem("sphinx_highlight_terms") + }, + + initEscapeListener: () => { + // only install a listener if it is really needed + if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) return; + + document.addEventListener("keydown", (event) => { + // bail for input elements + if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; + // bail with special keys + if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return; + if (DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS && (event.key === "Escape")) { + SphinxHighlight.hideSearchWords(); + event.preventDefault(); + } + }); + }, +}; + +_ready(SphinxHighlight.highlightSearchWords); +_ready(SphinxHighlight.initEscapeListener); diff --git a/docs/_build/html/api/cristallina.html b/docs/_build/html/api/cristallina.html new file mode 100644 index 0000000..b5bbd6f --- /dev/null +++ b/docs/_build/html/api/cristallina.html @@ -0,0 +1,539 @@ + + + + + + + + + cristallina package — cristallina 0.0.post1.dev53+g9be81e9.d20230129 documentation + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

cristallina package

+
+

Submodules

+
+
+

cristallina.SEA_GraphClient module

+

client for SEA GraphServer

+

Usage:

+

# open a client to host ‘samenv’, port 8764 +# the port number for the graph server may be retrived by +# the command ‘sea list’ on the samenv machine

+

client = GraphClient(‘samenv:8764’)

+

# get one curve

+

tlist, vlist, period = client.get_curves(start, end, name)

+

or

+

# get all important curves +curves = client.get_curves(start, end)

+

# where:

+
+

start, end: interval (unix time, as retrieved from time.time()) +name: the name of a curve (if no name or a list of names

+
+

is given, the result is a curves dict)

+
+

curves: dict <name> of [tlist, vlist, period] +tlist: time axis (unix time) +vlist: values (y-axis) +period: the expected resolution (a hint for graphic clients,

+
+

saying that for a time step t(n) - t(n-1) significantly +bigger than period, an additional point should be added +at t(n) - period)

+
+
+
+
+class cristallina.SEA_GraphClient.GraphClient(hostport)[source]
+

Bases: object

+
+
+close()[source]
+
+ +
+
+get_curves(start, end, name=None, none_value=None, nmax=None)[source]
+

get curves

+
+
start, end: interval (unix time, as retrieved from time.time())

non positive values are taken relative to the current time

+
+
+

name: a single name or a list of names or None to get all curves (as shown in the SEA GUI) +none_value: replacement when no value is defined +nmax: max. number of points per curve

+

when name is a string, returns [tlist, vlist, period] +when name is None or a list of strings (names) returns a dict <name> of [tlist, vlist, period]

+

tlist: time axis (unix time) +vlist: values (y-axis) +period: the expected resolution (a hint for graphic clients)

+
+ +
+
+get_names(start, end=None)[source]
+

get names and properties of curves configured to be display on SEA GUI graphics

+
+ +
+
+get_raw(start, end, *args)[source]
+

get raw curves (values as text)

+
+ +
+ +
+
+cristallina.SEA_GraphClient.expect_reply(sock, expected)[source]
+
+ +
+
+cristallina.SEA_GraphClient.raw_sics_client(hostport, login)[source]
+
+ +
+
+cristallina.SEA_GraphClient.sics_client(hostport, command=None, login='Spy 007')[source]
+
+ +
+
+

cristallina.analysis module

+
+
+cristallina.analysis.fit_2d_gaussian(image, roi: ROI | None = None)[source]
+

2D Gaussian fit using LMFit for a given image and an optional region of interest.

+

Returns the x, y coordinates of the center and the results object which contains +further fit statistics.

+
+ +
+
+cristallina.analysis.get_contrast_images(fileset, channel='JF16T03V01', alignment_channels=None, batch_size=10, roi: ROI | None = None, preview=False)[source]
+

See perform_image_calculations. Here calculates mean and standard deviation for a given set of images.

+
+ +
+
+cristallina.analysis.setup_cachedirs(pgroup=None, cachedir=None)[source]
+

Sets the path to a persistent cache directory either from the given p-group (e.g. “p20841”) +or an explicitly given directory.

+

If heuristics fail we use “/tmp” as a non-persistent alternative.

+
+ +
+
+

cristallina.config module

+
+
+

cristallina.plot module

+
+
+cristallina.plot.axis_styling(ax, channel_name, description)[source]
+
+ +
+
+cristallina.plot.ju_patch_less_verbose(ju_module)[source]
+

Quick monkey patch to suppress verbose messages from gain & pedestal file searcher.

+
+ +
+
+cristallina.plot.plot_1d_channel(data: SFDataFiles, channel_name, ax=None)[source]
+

Plots channel data for a channel that contains a single numeric value per pulse.

+
+ +
+
+cristallina.plot.plot_2d_channel(data: SFDataFiles, channel_name, ax=None)[source]
+

Plots channel data for a channel that contains a 1d array of numeric values per pulse.

+
+ +
+
+cristallina.plot.plot_channel(data: SFDataFiles, channel_name, ax=None)[source]
+

Plots a given channel from an SFDataFiles object.

+

Optionally: a matplotlib axis to plot into

+
+ +
+
+cristallina.plot.plot_correlation(x, y, ax=None, **ax_kwargs)[source]
+

Plots the correlation of x and y in a normalized scatterplot. +If no axis is given a figure and axis are created.

+
+
Returns: The axis object and the correlation coefficient between

x and y.

+
+
+
+ +
+
+cristallina.plot.plot_image_channel(data: SFDataFiles, channel_name, pulse=0, ax=None, rois=None, norms=None)[source]
+

Plots channel data for a channel that contains an image (2d array) of numeric values per pulse.

+
+ +
+
+cristallina.plot.plot_spectrum_channel(data: SFDataFiles, channel_name_x, channel_name_y, average=True, pulse=0, ax=None)[source]
+

Plots channel data for two channels where the first is taken as the (constant) x-axis +and the second as the y-axis (here we take by default the mean over the individual pulses).

+
+ +
+
+

cristallina.skeleton module

+

This is a skeleton file that can serve as a starting point for a Python +console script. To run this script uncomment the following lines in the +[options.entry_points] section in setup.cfg:

+
console_scripts =
+     fibonacci = cristallina.skeleton:run
+
+
+

Then run pip install . (or pip install -e . for editable mode) +which will install the command fibonacci inside your current environment.

+

Besides console scripts, the header (i.e. until _logger…) of this file can +also be used as template for Python modules.

+
+

Note

+

This file can be renamed depending on your needs or safely removed if not needed.

+
+

References

+ +
+
+cristallina.skeleton.fib(n)[source]
+

Fibonacci example function

+
+
Parameters:
+

n (int) – integer

+
+
Returns:
+

n-th Fibonacci number

+
+
Return type:
+

int

+
+
+
+ +
+
+cristallina.skeleton.main(args)[source]
+

Wrapper allowing fib() to be called with string arguments in a CLI fashion

+

Instead of returning the value from fib(), it prints the result to the +stdout in a nicely formatted message.

+
+
Parameters:
+

args (List[str]) – command line parameters as list of strings +(for example ["--verbose", "42"]).

+
+
+
+ +
+
+cristallina.skeleton.parse_args(args)[source]
+

Parse command line parameters

+
+
Parameters:
+

args (List[str]) – command line parameters as list of strings +(for example ["--help"]).

+
+
Returns:
+

command line parameters namespace

+
+
Return type:
+

argparse.Namespace

+
+
+
+ +
+
+cristallina.skeleton.run()[source]
+

Calls main() passing the CLI arguments extracted from sys.argv

+

This function can be used as entry point to create console scripts with setuptools.

+
+ +
+
+cristallina.skeleton.setup_logging(loglevel)[source]
+

Setup basic logging

+
+
Parameters:
+

loglevel (int) – minimum loglevel for emitting messages

+
+
+
+ +
+
+

cristallina.utils module

+
+
+cristallina.utils.FWHM_to_sigma(FWHM)[source]
+

FWHM to gaussian sigma

+
+ +
+
+class cristallina.utils.ROI(left: int | None = None, right: int | None = None, top: int | None = None, bottom: int | None = None, center_x: int | None = None, center_y: int | None = None, width: int | None = None, height: int | None = None, name: str | None = None)[source]
+

Bases: object

+

Definition of region of interest (ROI) in image coordinates.

+

Example: ROI(left=10, right=20, bottom=100, top=200).

+

Directions assume that lower left corner of image is at (x=0, y=0).

+
+
+property LeftRightBottomTop
+
+ +
+
+property cols
+
+ +
+
+from_centers_widths(center_x, center_y, width, height)[source]
+
+ +
+
+property height
+
+ +
+
+property rows
+
+ +
+
+property width
+
+ +
+ +
+
+cristallina.utils.channel_names(run_number, verbose=False)[source]
+

Prints channel names for a given run_number or scan object

+
+ +
+
+cristallina.utils.eV_to_joules(eV)[source]
+

Just a unit conversion

+
+ +
+
+cristallina.utils.find_nearest(array, value)[source]
+

Finds an index in an array with a value that is nearest to given number

+
+ +
+
+cristallina.utils.find_two_nearest(time_array, percentage)[source]
+

Finds indeces of the two values that are the nearest to the given value in an array

+
+ +
+
+cristallina.utils.gauss(x, H, A, x0, sigma)[source]
+

Returns gauss function value

+
+ +
+
+cristallina.utils.gauss_fit(x, y, fit_details=None, plot=None)[source]
+

Returns [baseline_offset, Amplitude, center, sigma, FWHM]

+
+ +
+
+cristallina.utils.heuristic_extract_base_path()[source]
+

The function tries to guess the full path where the raw data is saved.

+
+ +
+
+cristallina.utils.heuristic_extract_pgroup(path=None)[source]
+

The function tries to guess the current p-group from the +current working directory (default) or the contents of +the given path.

+
+ +
+
+cristallina.utils.heuristic_extract_smalldata_path()[source]
+

The function tries to guess the full path where the small data is saved.

+
+ +
+
+cristallina.utils.joules_to_eV(joules)[source]
+

Just a unit conversion

+
+ +
+
+cristallina.utils.photon_energy_from_wavelength(wavelength)[source]
+

Returns photon energy in eV from wavelength in meters. Source https://www.kmlabs.com/en/wavelength-to-photon-energy-calculator

+
+ +
+
+cristallina.utils.print_run_info(run_number=42, print_channels=True, extra_verbose=False, base_path=None)[source]
+

Prints overview of run information.

+

Extra verbose output contains all files and pids.

+
+ +
+
+cristallina.utils.process_run(run_number, rois, detector='JF16T03V01', calculate=None, only_shots=slice(None, None, None), n_jobs=16)[source]
+

Process rois for a given detector. Save the results small data in the res/small_data/run… +By default only sum of rois is calculated, [mean,std,img] can be added to the “calculate” optional parameter.

+
+ +
+
+cristallina.utils.scan_info(run_number, base_path=None, small_data=True)[source]
+

Returns SFScanInfo object for a given run number. +If there is are small data channels, they will be added (small_data=False to suppress their loading).

+
+ +
+
+cristallina.utils.sigma_to_FWHM(sigma)[source]
+

Gaussian sigma to FWHM

+
+ +
+
+cristallina.utils.wavelength_from_photon_energy(Eph)[source]
+

Returns wavelength in meters from photon energy in eV. Source https://www.kmlabs.com/en/wavelength-to-photon-energy-calculator

+
+ +
+
+cristallina.utils.xray_transmission(energy, thickness, material='Si', density=[])[source]
+

Calculate x-ray tranmission for given energy, thickness and material. Default material is Si. Add material=element as a string for another material. Density as optional parameter

+
+ +
+
+

Module contents

+
+
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/_build/html/api/modules.html b/docs/_build/html/api/modules.html new file mode 100644 index 0000000..760089e --- /dev/null +++ b/docs/_build/html/api/modules.html @@ -0,0 +1,194 @@ + + + + + + + + + cristallina — cristallina 0.0.post1.dev53+g9be81e9.d20230129 documentation + + + + + + + + + + + + + + + + + + +
+ + +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/_build/html/authors.html b/docs/_build/html/authors.html new file mode 100644 index 0000000..119ad25 --- /dev/null +++ b/docs/_build/html/authors.html @@ -0,0 +1,116 @@ + + + + + + + + + Contributors — cristallina 0.0.post1.dev53+g9be81e9.d20230129 documentation + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

Contributors

+ +
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/_build/html/changelog.html b/docs/_build/html/changelog.html new file mode 100644 index 0000000..2fcf305 --- /dev/null +++ b/docs/_build/html/changelog.html @@ -0,0 +1,123 @@ + + + + + + + + + Changelog — cristallina 0.0.post1.dev53+g9be81e9.d20230129 documentation + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

Changelog

+
+

Version 0.1

+
    +
  • Some basic functionality is implemented.

  • +
  • Requires some example notebooks and documentation.

  • +
+
+
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/_build/html/contributing.html b/docs/_build/html/contributing.html new file mode 100644 index 0000000..791ff2b --- /dev/null +++ b/docs/_build/html/contributing.html @@ -0,0 +1,357 @@ + + + + + + + + + TODO — cristallina 0.0.post1.dev53+g9be81e9.d20230129 documentation + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

TODO

+

This is a general guide to contribute to python based projects and does not yet contain any cristallina specific information.

+
+
+

Contributing

+

Welcome to cristallina contributor’s guide.

+

This document focuses on getting any potential contributor familiarized +with the development processes, but other kinds of contributions are also +appreciated.

+

If you are new to using git or have never collaborated in a project previously, +please have a look at contribution-guide.org. Other resources are also +listed in the excellent guide created by FreeCodeCamp [1].

+

Please notice, all users and contributors are expected to be open, +considerate, reasonable, and respectful. When in doubt, Python Software +Foundation’s Code of Conduct is a good reference in terms of behavior +guidelines.

+
+

Issue Reports

+

If you experience bugs or general issues with cristallina, please have a look +on the issue tracker. If you don’t see anything useful there, please feel +free to fire an issue report.

+
+

Tip

+

Please don’t forget to include the closed issues in your search. +Sometimes a solution was already reported, and the problem is considered +solved.

+
+

New issue reports should include information about your programming environment +(e.g., operating system, Python version) and steps to reproduce the problem. +Please try also to simplify the reproduction steps to a very minimal example +that still illustrates the problem you are facing. By removing other factors, +you help us to identify the root cause of the issue.

+
+
+

Documentation Improvements

+

You can help improve cristallina docs by making them more readable and coherent, or +by adding missing information and correcting mistakes.

+

cristallina documentation uses Sphinx as its main documentation compiler. +This means that the docs are kept in the same repository as the project code, and +that any documentation update is done in the same way was a code contribution.

+

When working on documentation changes in your local machine, you can +compile them using tox:

+
tox -e docs
+
+
+

and use Python’s built-in web server for a preview in your web browser +(http://localhost:8000):

+
python3 -m http.server --directory 'docs/_build/html'
+
+
+
+
+

Code Contributions

+
+

Submit an issue

+

Before you work on any non-trivial code contribution it’s best to first create +a report in the issue tracker to start a discussion on the subject. +This often provides additional considerations and avoids unnecessary work.

+
+
+

Create an environment

+

Before you start coding, we recommend creating an isolated virtual +environment to avoid any problems with your installed Python packages. +This can easily be done via either virtualenv:

+
virtualenv <PATH TO VENV>
+source <PATH TO VENV>/bin/activate
+
+
+

or Miniconda:

+
conda create -n cristallina python=3 six virtualenv pytest pytest-cov
+conda activate cristallina
+
+
+
+
+

Clone the repository

+
    +
  1. Create an user account on GitHub if you do not already have one.

  2. +
  3. Fork the project repository: click on the Fork button near the top of the +page. This creates a copy of the code under your account on GitHub.

  4. +
  5. Clone this copy to your local disk:

    +
    git clone git@github.com:YourLogin/cristallina.git
    +cd cristallina
    +
    +
    +
  6. +
  7. You should run:

    +
    pip install -U pip setuptools -e .
    +
    +
    +

    to be able to import the package under development in the Python REPL.

    +
  8. +
  9. Install pre-commit:

    +
    pip install pre-commit
    +pre-commit install
    +
    +
    +

    cristallina comes with a lot of hooks configured to automatically help the +developer to check the code being written.

    +
  10. +
+
+
+

Implement your changes

+
    +
  1. Create a branch to hold your changes:

    +
    git checkout -b my-feature
    +
    +
    +

    and start making changes. Never work on the main branch!

    +
  2. +
  3. Start your work on this branch. Don’t forget to add docstrings to new +functions, modules and classes, especially if they are part of public APIs.

  4. +
  5. Add yourself to the list of contributors in AUTHORS.rst.

  6. +
  7. When you’re done editing, do:

    +
    git add <MODIFIED FILES>
    +git commit
    +
    +
    +

    to record your changes in git.

    +

    Please make sure to see the validation messages from pre-commit and fix +any eventual issues. +This should automatically use flake8/black to check/fix the code style +in a way that is compatible with the project.

    +
    +

    Important

    +

    Don’t forget to add unit tests and documentation in case your +contribution adds an additional feature and is not just a bugfix.

    +

    Moreover, writing a descriptive commit message is highly recommended. +In case of doubt, you can check the commit history with:

    +
    git log --graph --decorate --pretty=oneline --abbrev-commit --all
    +
    +
    +

    to look for recurring communication patterns.

    +
    +
  8. +
  9. Please check that your changes don’t break any unit tests with:

    +
    tox
    +
    +
    +

    (after having installed tox with pip install tox or pipx).

    +

    You can also use tox to run several other pre-configured tasks in the +repository. Try tox -av to see a list of the available checks.

    +
  10. +
+
+
+

Submit your contribution

+
    +
  1. If everything works fine, push your local branch to GitHub with:

    +
    git push -u origin my-feature
    +
    +
    +
  2. +
  3. Go to the web page of your fork and click “Create pull request” +to send your changes for review.

    +
  4. +
+
+
+

Troubleshooting

+

The following tips can be used when facing problems to build or test the +package:

+
    +
  1. Make sure to fetch all the tags from the upstream repository. +The command git describe --abbrev=0 --tags should return the version you +are expecting. If you are trying to run CI scripts in a fork repository, +make sure to push all the tags. +You can also try to remove all the egg files or the complete egg folder, i.e., +.eggs, as well as the *.egg-info folders in the src folder or +potentially in the root of your project.

  2. +
  3. Sometimes tox misses out when new dependencies are added, especially to +setup.cfg and docs/requirements.txt. If you find any problems with +missing dependencies when running a command with tox, try to recreate the +tox environment using the -r flag. For example, instead of:

    +
    tox -e docs
    +
    +
    +

    Try running:

    +
    tox -r -e docs
    +
    +
    +
  4. +
  5. Make sure to have a reliable tox installation that uses the correct +Python version (e.g., 3.7+). When in doubt you can run:

    +
    tox --version
    +# OR
    +which tox
    +
    +
    +

    If you have trouble and are seeing weird errors upon running tox, you can +also try to create a dedicated virtual environment with a tox binary +freshly installed. For example:

    +
    virtualenv .venv
    +source .venv/bin/activate
    +.venv/bin/pip install tox
    +.venv/bin/tox -e all
    +
    +
    +
  6. +
  7. Pytest can drop you in an interactive session in the case an error occurs. +In order to do that you need to pass a --pdb option (for example by +running tox -- -k <NAME OF THE FALLING TEST> --pdb). +You can also setup breakpoints manually instead of using the --pdb option.

  8. +
+
+
+
+

Maintainer tasks

+
+

Releases

+

If you are part of the group of maintainers and have correct user permissions +on PyPI, the following steps can be used to release a new version for +cristallina:

+
    +
  1. Make sure all unit tests are successful.

  2. +
  3. Tag the current commit on the main branch with a release tag, e.g., v1.2.3.

  4. +
  5. Push the new tag to the upstream repository, e.g., git push upstream v1.2.3

  6. +
  7. Clean up the dist and build folders with tox -e clean +(or rm -rf dist build) +to avoid confusion with old builds and Sphinx docs.

  8. +
  9. Run tox -e build and check that the files in dist have +the correct version (no .dirty or git hash) according to the git tag. +Also check the sizes of the distributions, if they are too big (e.g., > +500KB), unwanted clutter may have been accidentally included.

  10. +
  11. Run tox -e publish -- --repository pypi and check that everything was +uploaded to PyPI correctly.

  12. +
+ +
+
+
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/_build/html/genindex.html b/docs/_build/html/genindex.html new file mode 100644 index 0000000..9ac93be --- /dev/null +++ b/docs/_build/html/genindex.html @@ -0,0 +1,392 @@ + + + + + + + + Index — cristallina 0.0.post1.dev53+g9be81e9.d20230129 documentation + + + + + + + + + + + + + + + + +
+
+
+ + +
+ + +

Index

+ +
+ A + | C + | E + | F + | G + | H + | J + | L + | M + | P + | R + | S + | W + | X + +
+

A

+ + +
+ +

C

+ + + +
    +
  • + cristallina.plot + +
  • +
  • + cristallina.SEA_GraphClient + +
  • +
  • + cristallina.skeleton + +
  • +
  • + cristallina.utils + +
  • +
+ +

E

+ + + +
+ +

F

+ + + +
+ +

G

+ + + +
+ +

H

+ + + +
+ +

J

+ + + +
+ +

L

+ + +
+ +

M

+ + +
+ +

P

+ + + +
+ +

R

+ + + +
+ +

S

+ + + +
+ +

W

+ + + +
+ +

X

+ + +
+ + + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/_build/html/index.html b/docs/_build/html/index.html new file mode 100644 index 0000000..f8563d4 --- /dev/null +++ b/docs/_build/html/index.html @@ -0,0 +1,162 @@ + + + + + + + + + cristallina — cristallina 0.0.post1.dev53+g9be81e9.d20230129 documentation + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

cristallina

+

This is the documentation of cristallina.

+
+

Note

+

This is the main page of your project’s Sphinx documentation. +It is formatted in reStructuredText. Add additional pages +by creating rst-files in docs and adding them to the toctree below. +Use then references in order to link them from this page, e.g. +Contributors and Changelog.

+

It is also possible to refer to the documentation of other Python packages +with the Python domain syntax. By default you can reference the +documentation of Sphinx, Python, NumPy, SciPy, matplotlib, +Pandas, Scikit-Learn. You can add more by extending the +intersphinx_mapping in your Sphinx’s conf.py.

+

The pretty useful extension autodoc is activated by default and lets +you include documentation from docstrings. Docstrings can be written in +Google style (recommended!), NumPy style and classical style.

+
+
+

Contents

+ +
+
+

Indices and tables

+ +
+
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/_build/html/license.html b/docs/_build/html/license.html new file mode 100644 index 0000000..eecf815 --- /dev/null +++ b/docs/_build/html/license.html @@ -0,0 +1,114 @@ + + + + + + + + + License — cristallina 0.0.post1.dev53+g9be81e9.d20230129 documentation + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

License

+

No explicit LICENSE given, all code belongs to the respective authors.

+
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/_build/html/objects.inv b/docs/_build/html/objects.inv new file mode 100644 index 0000000..dcbd0c9 Binary files /dev/null and b/docs/_build/html/objects.inv differ diff --git a/docs/_build/html/py-modindex.html b/docs/_build/html/py-modindex.html new file mode 100644 index 0000000..d6ec0ae --- /dev/null +++ b/docs/_build/html/py-modindex.html @@ -0,0 +1,153 @@ + + + + + + + + Python Module Index — cristallina 0.0.post1.dev53+g9be81e9.d20230129 documentation + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ + +

Python Module Index

+ +
+ c +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
 
+ c
+ cristallina +
    + cristallina.analysis +
    + cristallina.config +
    + cristallina.plot +
    + cristallina.SEA_GraphClient +
    + cristallina.skeleton +
    + cristallina.utils +
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/_build/html/readme.html b/docs/_build/html/readme.html new file mode 100644 index 0000000..111b65d --- /dev/null +++ b/docs/_build/html/readme.html @@ -0,0 +1,123 @@ + + + + + + + + + cristallina — cristallina 0.0.post1.dev53+g9be81e9.d20230129 documentation + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ + Project generated with PyScaffold +
+

+
+
+

cristallina

+
+

Cristallina data analysis modules and plotting utilities.

+
+

Here we collect modules for data analysis, plotting and utility functions for the Cristallina endstation.

+

The data analysis is based on the common SwissFEL data architecture, with convienent access provided by sf_datafiles.

+

The test suite (based on pytest) requires access to some data only available on either the cristallina consoles or the RA cluster.

+
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/_build/html/search.html b/docs/_build/html/search.html new file mode 100644 index 0000000..98c9bcc --- /dev/null +++ b/docs/_build/html/search.html @@ -0,0 +1,127 @@ + + + + + + + + Search — cristallina 0.0.post1.dev53+g9be81e9.d20230129 documentation + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +

Search

+ + + + +

+ Searching for multiple words only shows matches that contain + all words. +

+ + +
+ + + +
+ + + +
+ +
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/_build/html/searchindex.js b/docs/_build/html/searchindex.js new file mode 100644 index 0000000..9010fd6 --- /dev/null +++ b/docs/_build/html/searchindex.js @@ -0,0 +1 @@ +Search.setIndex({"docnames": ["api/cristallina", "api/modules", "authors", "changelog", "contributing", "index", "license", "readme"], "filenames": ["api/cristallina.rst", "api/modules.rst", "authors.rst", "changelog.rst", "contributing.rst", "index.rst", "license.rst", "readme.rst"], "titles": ["cristallina package", "cristallina", "Contributors", "Changelog", "TODO", "cristallina", "License", "cristallina"], "terms": {"packag": [1, 4, 5], "submodul": 1, "sea_graphcli": 1, "modul": [1, 4, 5, 7], "analysi": [1, 7], "config": 1, "plot": [1, 7], "skeleton": 1, "util": [1, 7], "content": [1, 4], "alexand": 2, "steppk": 2, "psi": 2, "ch": 2, "featur": 4, "A": 0, "ad": [0, 4, 5], "fix": 4, "nasti": [], "bug": 4, "1729": [], "add": [0, 4, 5], "your": [0, 5], "chang": [], "here": [0, 7], "thi": [0, 4, 5], "i": [0, 3, 4, 5, 7], "suppos": 4, "TO": 4, "BE": 4, "exampl": [0, 3, 4], "modifi": 4, "IT": 4, "accord": 4, "need": [0, 4], "The": [0, 4, 5, 7], "assum": [0, 4], "you": [4, 5], "ar": [0, 4], "us": [0, 4, 5], "sourc": [0, 4], "servic": 4, "promot": 4, "model": 4, "similar": 4, "github": 4, "": [4, 5], "fork": 4, "pull": 4, "request": 4, "workflow": 4, "while": 4, "true": [0, 4], "major": 4, "like": 4, "gitlab": 4, "bitbucket": 4, "might": 4, "case": 4, "privat": 4, "e": [0, 4, 5], "g": [0, 4, 5], "when": [0, 4], "gerrit": 4, "also": [0, 4, 5], "notic": 4, "refer": [0, 4, 5], "url": 4, "text": [0, 4], "specif": 4, "terminologi": 4, "instead": [0, 4], "merg": 4, "pleas": 4, "make": 4, "sure": 4, "check": 4, "have": 4, "assumpt": 4, "mind": 4, "updat": 4, "thing": 4, "accordingli": 4, "provid": [4, 7], "correct": 4, "link": [4, 5], "replac": [0, 4], "bottom": [0, 4], "want": 4, "look": 4, "pyscaffold": 4, "contributor": [4, 5], "guid": 4, "especi": 4, "project": [4, 5], "open": [0, 4], "should": [0, 4], "veri": 4, "templat": [0, 4], "few": 4, "extra": [0, 4], "decid": 4, "includ": [4, 5], "mention": 4, "label": 4, "tracker": 4, "autom": 4, "gener": 4, "python": [0, 4, 5], "base": [0, 4, 7], "doe": 4, "yet": 4, "contain": [0, 4], "ani": 4, "cristallina": 4, "inform": [0, 4], "welcom": 4, "focus": 4, "get": [0, 4], "potenti": 4, "familiar": 4, "develop": 4, "process": [0, 4], "other": [4, 5], "kind": 4, "appreci": 4, "If": [0, 4], "new": 4, "git": 4, "never": 4, "collabor": 4, "previous": 4, "org": 4, "resourc": 4, "list": [0, 4], "excel": 4, "freecodecamp": 4, "1": [0, 4, 5], "all": [0, 4, 6], "user": 4, "expect": [0, 4], "consider": 4, "reason": 4, "respect": [4, 6], "doubt": 4, "softwar": 4, "foundat": 4, "conduct": 4, "good": 4, "term": 4, "behavior": 4, "guidelin": 4, "experi": 4, "don": 4, "t": [0, 4], "see": [0, 4], "anyth": 4, "feel": 4, "free": 4, "fire": 4, "forget": 4, "close": [0, 1, 4], "search": [4, 5], "sometim": 4, "solut": 4, "wa": 4, "alreadi": 4, "problem": 4, "consid": 4, "solv": 4, "about": 4, "program": 4, "oper": 4, "system": 4, "version": [4, 5], "step": [0, 4], "reproduc": 4, "try": 4, "simplifi": 4, "reproduct": 4, "minim": 4, "still": 4, "illustr": 4, "face": 4, "By": [0, 4, 5], "remov": [0, 4], "factor": 4, "help": [0, 4], "u": 4, "identifi": 4, "root": 4, "caus": 4, "can": [0, 4, 5], "doc": [4, 5], "them": [4, 5], "more": [4, 5], "readabl": 4, "coher": 4, "miss": 4, "mistak": 4, "sphinx": [4, 5], "its": 4, "main": [0, 1, 4, 5], "compil": 4, "mean": [0, 4], "kept": 4, "same": 4, "done": 4, "wai": 4, "which": [0, 4], "markup": 4, "languag": 4, "restructuredtext": [4, 5], "commonmark": 4, "myst": 4, "extens": [4, 5], "host": [0, 4], "follow": [0, 4], "tip": 4, "web": 4, "interfac": 4, "quick": [0, 4], "propos": 4, "file": [0, 4, 5], "mechan": 4, "tricki": 4, "normal": [0, 4], "work": [0, 4], "perfectli": 4, "fine": 4, "quit": 4, "handi": 4, "interest": [0, 4], "method": 4, "out": 4, "navig": 4, "folder": 4, "find": [0, 4], "would": 4, "click": 4, "littl": 4, "pencil": 4, "icon": 4, "top": [0, 4], "editor": 4, "onc": 4, "finish": 4, "edit": [0, 4], "write": 4, "messag": [0, 4], "form": 4, "page": [4, 5], "describ": 4, "made": 4, "what": 4, "motiv": 4, "behind": 4, "local": 4, "machin": [0, 4], "tox": 4, "built": 4, "server": [0, 4], "preview": [0, 4], "browser": 4, "http": [0, 4], "localhost": 4, "8000": 4, "python3": 4, "m": 4, "directori": [0, 4], "_build": 4, "html": [0, 4], "explan": 4, "intern": 4, "architectur": [4, 7], "descript": [0, 4], "design": 4, "principl": 4, "least": 4, "summari": 4, "concept": 4, "easi": 4, "start": [0, 4], "quickli": 4, "befor": 4, "non": [0, 4], "trivial": 4, "best": 4, "first": [0, 4], "discuss": 4, "subject": 4, "often": 4, "addit": [0, 4, 5], "avoid": 4, "unnecessari": 4, "we": [0, 4, 7], "recommend": [4, 5], "isol": 4, "virtual": 4, "instal": [0, 4], "easili": 4, "via": 4, "either": [0, 4, 7], "virtualenv": 4, "path": [0, 4], "venv": 4, "bin": 4, "activ": [4, 5], "miniconda": 4, "conda": 4, "n": [0, 4], "3": 4, "six": 4, "pytest": [4, 7], "cov": 4, "account": 4, "do": 4, "one": [0, 4], "button": 4, "copi": 4, "under": 4, "disk": 4, "com": [0, 4], "yourlogin": 4, "cd": 4, "run": [0, 1, 4], "pip": [0, 4], "setuptool": [0, 4], "abl": 4, "import": [0, 4], "repl": 4, "pre": 4, "commit": 4, "item": 4, "come": 4, "lot": 4, "hook": 4, "configur": [0, 4], "automat": 4, "being": 4, "written": [4, 5], "branch": 4, "hold": 4, "checkout": 4, "b": 4, "my": 4, "docstr": [4, 5], "function": [0, 3, 4, 7], "class": [0, 4], "thei": [0, 4], "part": 4, "public": 4, "api": 4, "yourself": 4, "author": [4, 5, 6], "rst": [4, 5], "re": [0, 4], "record": 4, "valid": 4, "from": [0, 4, 5], "eventu": 4, "flake8": 4, "black": 4, "style": [4, 5], "compat": 4, "unit": [0, 4], "test": [4, 7], "just": [0, 4], "bugfix": 4, "moreov": 4, "highli": 4, "In": 4, "histori": 4, "log": [0, 4], "graph": [0, 4], "decor": 4, "pretti": [4, 5], "onelin": 4, "abbrev": 4, "recur": 4, "commun": 4, "pattern": 4, "break": 4, "after": 4, "pipx": 4, "sever": 4, "av": 4, "avail": [4, 7], "everyth": 4, "push": 4, "origin": 4, "go": 4, "send": 4, "review": 4, "uncom": [0, 4], "paragraph": 4, "detail": 4, "pr": 4, "draft": 4, "mark": 4, "readi": 4, "feedback": 4, "continu": 4, "integr": 4, "ci": 4, "requir": [3, 4, 7], "build": 4, "fetch": 4, "tag": 4, "upstream": 4, "command": [0, 4], "0": [0, 4, 5], "return": [0, 4], "script": [0, 4], "egg": 4, "complet": 4, "well": 4, "info": 4, "src": 4, "depend": [0, 4], "setup": [0, 4], "cfg": [0, 4], "txt": 4, "recreat": 4, "r": 4, "flag": 4, "For": 4, "reliabl": 4, "7": 4, "OR": 4, "troubl": 4, "weird": 4, "error": 4, "upon": 4, "dedic": 4, "binari": 4, "freshli": 4, "drop": 4, "interact": 4, "session": 4, "occur": 4, "order": [4, 5], "pass": [0, 4], "pdb": 4, "option": [0, 4], "k": 4, "name": [0, 4], "OF": 4, "THE": 4, "fall": 4, "breakpoint": 4, "manual": 4, "section": [0, 4], "pypi": 4, "publicli": 4, "differ": 4, "index": [0, 4, 5], "instruct": 4, "group": [0, 4], "permiss": 4, "success": 4, "current": [0, 4], "v1": 4, "2": 4, "clean": 4, "up": 4, "dist": 4, "rm": 4, "rf": 4, "confus": 4, "old": 4, "dirti": 4, "hash": 4, "size": 4, "distribut": 4, "too": 4, "big": 4, "500kb": 4, "unwant": 4, "clutter": 4, "mai": [0, 4], "been": 4, "accident": 4, "publish": 4, "upload": 4, "correctli": 4, "even": 4, "though": 4, "focu": 4, "idea": 4, "collect": [4, 7], "appli": 4, "sort": 4, "compani": 4, "proprietari": 4, "definit": [0, 4], "document": [3, 5], "It": 5, "format": [0, 5], "creat": [0, 5], "toctre": 5, "below": 5, "changelog": 5, "possibl": 5, "domain": 5, "syntax": 5, "default": [0, 5], "numpi": 5, "scipi": 5, "matplotlib": [0, 5], "panda": 5, "scikit": 5, "learn": 5, "extend": 5, "intersphinx_map": 5, "conf": 5, "py": 5, "autodoc": 5, "let": 5, "googl": 5, "classic": 5, "overview": [0, 5], "todo": 5, "contribut": 5, "issu": 5, "report": 5, "improv": 5, "code": [5, 6], "maintain": 5, "task": 5, "licens": 5, "No": 6, "explicit": 6, "given": [0, 6], "belong": 6, "data": [0, 7], "endstat": 7, "common": 7, "swissfel": 7, "convien": 7, "access": 7, "sf_datafil": 7, "suit": 7, "some": [3, 7], "onli": [0, 7], "consol": [0, 7], "ra": 7, "cluster": 7, "basic": [0, 3], "implement": 3, "notebook": 3, "client": 0, "sea": 0, "graphserv": 0, "usag": 0, "samenv": 0, "port": 0, "8764": 0, "number": 0, "retriv": 0, "graphclient": [0, 1], "curv": 0, "tlist": 0, "vlist": 0, "period": 0, "get_curv": [0, 1], "end": 0, "where": 0, "interv": 0, "unix": 0, "time": 0, "retriev": 0, "result": 0, "dict": 0, "axi": 0, "valu": 0, "y": 0, "resolut": 0, "hint": 0, "graphic": 0, "sai": 0, "significantli": 0, "bigger": 0, "than": 0, "an": 0, "point": 0, "hostport": 0, "object": 0, "none": 0, "none_valu": 0, "nmax": 0, "posit": 0, "taken": 0, "rel": 0, "singl": 0, "shown": 0, "gui": 0, "defin": 0, "max": 0, "per": 0, "string": 0, "get_nam": [0, 1], "properti": 0, "displai": 0, "get_raw": [0, 1], "arg": 0, "raw": 0, "expect_repli": [0, 1], "sock": 0, "raw_sics_cli": [0, 1], "login": 0, "sics_client": [0, 1], "spy": 0, "007": 0, "serv": 0, "To": 0, "line": 0, "entry_point": 0, "console_script": 0, "fibonacci": 0, "Then": 0, "mode": 0, "insid": 0, "environ": 0, "besid": 0, "header": 0, "until": 0, "_logger": 0, "renam": 0, "safe": 0, "pypa": 0, "io": 0, "en": 0, "latest": 0, "userguid": 0, "stabl": 0, "pip_instal": 0, "fib": [0, 1], "paramet": 0, "int": 0, "integ": 0, "th": 0, "type": 0, "wrapper": 0, "allow": 0, "call": 0, "argument": 0, "cli": 0, "fashion": 0, "print": 0, "stdout": 0, "nice": 0, "str": 0, "verbos": 0, "42": 0, "parse_arg": [0, 1], "pars": 0, "namespac": 0, "argpars": 0, "extract": 0, "sy": 0, "argv": 0, "entri": 0, "setup_log": [0, 1], "loglevel": 0, "minimum": 0, "emit": 0, "fit_2d_gaussian": [0, 1], "imag": 0, "roi": [0, 1], "2d": 0, "gaussian": 0, "fit": 0, "lmfit": 0, "region": 0, "x": 0, "coordin": 0, "center": 0, "further": 0, "statist": 0, "get_contrast_imag": [0, 1], "fileset": 0, "channel": 0, "jf16t03v01": 0, "alignment_channel": 0, "batch_siz": 0, "10": 0, "fals": 0, "perform_image_calcul": 0, "calcul": 0, "standard": 0, "deviat": 0, "set": 0, "setup_cachedir": [0, 1], "pgroup": 0, "cachedir": 0, "persist": 0, "cach": 0, "p": 0, "p20841": 0, "explicitli": 0, "heurist": 0, "fail": 0, "tmp": 0, "altern": 0, "axis_styl": [0, 1], "ax": 0, "channel_nam": [0, 1], "ju_patch_less_verbos": [0, 1], "ju_modul": 0, "monkei": 0, "patch": 0, "suppress": 0, "gain": 0, "pedest": 0, "searcher": 0, "plot_1d_channel": [0, 1], "sfdatafil": 0, "numer": 0, "puls": 0, "plot_2d_channel": [0, 1], "1d": 0, "arrai": 0, "plot_channel": [0, 1], "plot_correl": [0, 1], "ax_kwarg": 0, "correl": 0, "scatterplot": 0, "figur": 0, "coeffici": 0, "between": 0, "plot_image_channel": [0, 1], "norm": 0, "plot_spectrum_channel": [0, 1], "channel_name_x": 0, "channel_name_i": 0, "averag": 0, "two": 0, "constant": 0, "second": 0, "take": 0, "over": 0, "individu": 0, "fwhm_to_sigma": [0, 1], "fwhm": 0, "sigma": 0, "left": 0, "right": 0, "center_x": 0, "center_i": 0, "width": [0, 1], "height": [0, 1], "20": 0, "100": 0, "200": 0, "direct": 0, "lower": 0, "corner": 0, "leftrightbottomtop": [0, 1], "col": [0, 1], "from_centers_width": [0, 1], "row": [0, 1], "run_numb": 0, "scan": 0, "ev_to_joul": [0, 1], "ev": 0, "convers": 0, "find_nearest": [0, 1], "nearest": 0, "find_two_nearest": [0, 1], "time_arrai": 0, "percentag": 0, "indec": 0, "gauss": [0, 1], "h": 0, "x0": 0, "gauss_fit": [0, 1], "fit_detail": 0, "baseline_offset": 0, "amplitud": 0, "heuristic_extract_base_path": [0, 1], "tri": 0, "guess": 0, "full": 0, "save": 0, "heuristic_extract_pgroup": [0, 1], "heuristic_extract_smalldata_path": [0, 1], "small": 0, "joules_to_ev": [0, 1], "joul": 0, "photon_energy_from_wavelength": [0, 1], "wavelength": 0, "photon": 0, "energi": 0, "meter": 0, "www": 0, "kmlab": 0, "print_run_info": [0, 1], "print_channel": 0, "extra_verbos": 0, "base_path": 0, "output": 0, "pid": 0, "process_run": [0, 1], "detector": 0, "only_shot": 0, "slice": 0, "n_job": 0, "16": 0, "small_data": 0, "sum": 0, "std": 0, "img": 0, "scan_info": [0, 1], "sfscaninfo": 0, "load": 0, "sigma_to_fwhm": [0, 1], "wavelength_from_photon_energi": [0, 1], "eph": 0, "xray_transmiss": [0, 1], "thick": 0, "materi": 0, "si": 0, "densiti": 0, "rai": 0, "tranmiss": 0, "element": 0, "anoth": 0}, "objects": {"": [[0, 0, 0, "-", "cristallina"]], "cristallina": [[0, 0, 0, "-", "SEA_GraphClient"], [0, 0, 0, "-", "analysis"], [0, 0, 0, "-", "config"], [0, 0, 0, "-", "plot"], [0, 0, 0, "-", "skeleton"], [0, 0, 0, "-", "utils"]], "cristallina.SEA_GraphClient": [[0, 1, 1, "", "GraphClient"], [0, 3, 1, "", "expect_reply"], [0, 3, 1, "", "raw_sics_client"], [0, 3, 1, "", "sics_client"]], "cristallina.SEA_GraphClient.GraphClient": [[0, 2, 1, "", "close"], [0, 2, 1, "", "get_curves"], [0, 2, 1, "", "get_names"], [0, 2, 1, "", "get_raw"]], "cristallina.analysis": [[0, 3, 1, "", "fit_2d_gaussian"], [0, 3, 1, "", "get_contrast_images"], [0, 3, 1, "", "setup_cachedirs"]], "cristallina.plot": [[0, 3, 1, "", "axis_styling"], [0, 3, 1, "", "ju_patch_less_verbose"], [0, 3, 1, "", "plot_1d_channel"], [0, 3, 1, "", "plot_2d_channel"], [0, 3, 1, "", "plot_channel"], [0, 3, 1, "", "plot_correlation"], [0, 3, 1, "", "plot_image_channel"], [0, 3, 1, "", "plot_spectrum_channel"]], "cristallina.skeleton": [[0, 3, 1, "", "fib"], [0, 3, 1, "", "main"], [0, 3, 1, "", "parse_args"], [0, 3, 1, "", "run"], [0, 3, 1, "", "setup_logging"]], "cristallina.utils": [[0, 3, 1, "", "FWHM_to_sigma"], [0, 1, 1, "", "ROI"], [0, 3, 1, "", "channel_names"], [0, 3, 1, "", "eV_to_joules"], [0, 3, 1, "", "find_nearest"], [0, 3, 1, "", "find_two_nearest"], [0, 3, 1, "", "gauss"], [0, 3, 1, "", "gauss_fit"], [0, 3, 1, "", "heuristic_extract_base_path"], [0, 3, 1, "", "heuristic_extract_pgroup"], [0, 3, 1, "", "heuristic_extract_smalldata_path"], [0, 3, 1, "", "joules_to_eV"], [0, 3, 1, "", "photon_energy_from_wavelength"], [0, 3, 1, "", "print_run_info"], [0, 3, 1, "", "process_run"], [0, 3, 1, "", "scan_info"], [0, 3, 1, "", "sigma_to_FWHM"], [0, 3, 1, "", "wavelength_from_photon_energy"], [0, 3, 1, "", "xray_transmission"]], "cristallina.utils.ROI": [[0, 4, 1, "", "LeftRightBottomTop"], [0, 4, 1, "", "cols"], [0, 2, 1, "", "from_centers_widths"], [0, 4, 1, "", "height"], [0, 4, 1, "", "rows"], [0, 4, 1, "", "width"]]}, "objtypes": {"0": "py:module", "1": "py:class", "2": "py:method", "3": "py:function", "4": "py:property"}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "class", "Python class"], "2": ["py", "method", "Python method"], "3": ["py", "function", "Python function"], "4": ["py", "property", "Python property"]}, "titleterms": {"cristallina": [0, 1, 5, 7], "packag": 0, "submodul": 0, "sea_graphcli": 0, "modul": 0, "analysi": 0, "config": 0, "plot": 0, "skeleton": 0, "util": 0, "content": [0, 5], "contributor": 2, "changelog": 3, "version": 3, "0": 3, "1": 3, "todo": 4, "contribut": 4, "issu": 4, "report": 4, "document": 4, "improv": 4, "code": 4, "submit": 4, "an": 4, "creat": 4, "environ": 4, "clone": 4, "repositori": 4, "implement": 4, "your": 4, "chang": 4, "troubleshoot": 4, "maintain": 4, "task": 4, "releas": 4, "indic": 5, "tabl": 5, "licens": 6}, "envversion": {"sphinx.domains.c": 2, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 8, "sphinx.domains.index": 1, "sphinx.domains.javascript": 2, "sphinx.domains.math": 2, "sphinx.domains.python": 3, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx.ext.intersphinx": 1, "sphinx.ext.todo": 2, "sphinx.ext.viewcode": 1, "sphinx": 57}, "alltitles": {"Contributors": [[2, "contributors"]], "Changelog": [[3, "changelog"]], "Version 0.1": [[3, "version-0-1"]], "Todo": [[4, "id1"], [4, "id2"], [4, "id3"], [4, "id5"], [4, "id6"], [4, "id7"], [4, "id8"], [4, "id9"], [4, "id10"], [4, "id11"], [4, "id12"]], "TODO": [[4, "todo"]], "Contributing": [[4, "contributing"]], "Issue Reports": [[4, "issue-reports"]], "Documentation Improvements": [[4, "documentation-improvements"]], "Code Contributions": [[4, "code-contributions"]], "Submit an issue": [[4, "submit-an-issue"]], "Create an environment": [[4, "create-an-environment"]], "Clone the repository": [[4, "clone-the-repository"]], "Implement your changes": [[4, "implement-your-changes"]], "Submit your contribution": [[4, "submit-your-contribution"]], "Troubleshooting": [[4, "troubleshooting"]], "Maintainer tasks": [[4, "maintainer-tasks"]], "Releases": [[4, "releases"]], "cristallina": [[5, "cristallina"], [7, "cristallina"], [1, "cristallina"]], "Contents": [[5, "contents"]], "Indices and tables": [[5, "indices-and-tables"]], "License": [[6, "license"]], "cristallina package": [[0, "cristallina-package"]], "Submodules": [[0, "submodules"]], "cristallina.SEA_GraphClient module": [[0, "module-cristallina.SEA_GraphClient"]], "cristallina.analysis module": [[0, "module-cristallina.analysis"]], "cristallina.config module": [[0, "module-cristallina.config"]], "cristallina.plot module": [[0, "module-cristallina.plot"]], "cristallina.skeleton module": [[0, "module-cristallina.skeleton"]], "cristallina.utils module": [[0, "module-cristallina.utils"]], "Module contents": [[0, "module-cristallina"]]}, "indexentries": {"fwhm_to_sigma() (in module cristallina.utils)": [[0, "cristallina.utils.FWHM_to_sigma"]], "graphclient (class in cristallina.sea_graphclient)": [[0, "cristallina.SEA_GraphClient.GraphClient"]], "leftrightbottomtop (cristallina.utils.roi property)": [[0, "cristallina.utils.ROI.LeftRightBottomTop"]], "roi (class in cristallina.utils)": [[0, "cristallina.utils.ROI"]], "axis_styling() (in module cristallina.plot)": [[0, "cristallina.plot.axis_styling"]], "channel_names() (in module cristallina.utils)": [[0, "cristallina.utils.channel_names"]], "close() (cristallina.sea_graphclient.graphclient method)": [[0, "cristallina.SEA_GraphClient.GraphClient.close"]], "cols (cristallina.utils.roi property)": [[0, "cristallina.utils.ROI.cols"]], "cristallina": [[0, "module-cristallina"]], "cristallina.sea_graphclient": [[0, "module-cristallina.SEA_GraphClient"]], "cristallina.analysis": [[0, "module-cristallina.analysis"]], "cristallina.config": [[0, "module-cristallina.config"]], "cristallina.plot": [[0, "module-cristallina.plot"]], "cristallina.skeleton": [[0, "module-cristallina.skeleton"]], "cristallina.utils": [[0, "module-cristallina.utils"]], "ev_to_joules() (in module cristallina.utils)": [[0, "cristallina.utils.eV_to_joules"]], "expect_reply() (in module cristallina.sea_graphclient)": [[0, "cristallina.SEA_GraphClient.expect_reply"]], "fib() (in module cristallina.skeleton)": [[0, "cristallina.skeleton.fib"]], "find_nearest() (in module cristallina.utils)": [[0, "cristallina.utils.find_nearest"]], "find_two_nearest() (in module cristallina.utils)": [[0, "cristallina.utils.find_two_nearest"]], "fit_2d_gaussian() (in module cristallina.analysis)": [[0, "cristallina.analysis.fit_2d_gaussian"]], "from_centers_widths() (cristallina.utils.roi method)": [[0, "cristallina.utils.ROI.from_centers_widths"]], "gauss() (in module cristallina.utils)": [[0, "cristallina.utils.gauss"]], "gauss_fit() (in module cristallina.utils)": [[0, "cristallina.utils.gauss_fit"]], "get_contrast_images() (in module cristallina.analysis)": [[0, "cristallina.analysis.get_contrast_images"]], "get_curves() (cristallina.sea_graphclient.graphclient method)": [[0, "cristallina.SEA_GraphClient.GraphClient.get_curves"]], "get_names() (cristallina.sea_graphclient.graphclient method)": [[0, "cristallina.SEA_GraphClient.GraphClient.get_names"]], "get_raw() (cristallina.sea_graphclient.graphclient method)": [[0, "cristallina.SEA_GraphClient.GraphClient.get_raw"]], "height (cristallina.utils.roi property)": [[0, "cristallina.utils.ROI.height"]], "heuristic_extract_base_path() (in module cristallina.utils)": [[0, "cristallina.utils.heuristic_extract_base_path"]], "heuristic_extract_pgroup() (in module cristallina.utils)": [[0, "cristallina.utils.heuristic_extract_pgroup"]], "heuristic_extract_smalldata_path() (in module cristallina.utils)": [[0, "cristallina.utils.heuristic_extract_smalldata_path"]], "joules_to_ev() (in module cristallina.utils)": [[0, "cristallina.utils.joules_to_eV"]], "ju_patch_less_verbose() (in module cristallina.plot)": [[0, "cristallina.plot.ju_patch_less_verbose"]], "main() (in module cristallina.skeleton)": [[0, "cristallina.skeleton.main"]], "module": [[0, "module-cristallina"], [0, "module-cristallina.SEA_GraphClient"], [0, "module-cristallina.analysis"], [0, "module-cristallina.config"], [0, "module-cristallina.plot"], [0, "module-cristallina.skeleton"], [0, "module-cristallina.utils"]], "parse_args() (in module cristallina.skeleton)": [[0, "cristallina.skeleton.parse_args"]], "photon_energy_from_wavelength() (in module cristallina.utils)": [[0, "cristallina.utils.photon_energy_from_wavelength"]], "plot_1d_channel() (in module cristallina.plot)": [[0, "cristallina.plot.plot_1d_channel"]], "plot_2d_channel() (in module cristallina.plot)": [[0, "cristallina.plot.plot_2d_channel"]], "plot_channel() (in module cristallina.plot)": [[0, "cristallina.plot.plot_channel"]], "plot_correlation() (in module cristallina.plot)": [[0, "cristallina.plot.plot_correlation"]], "plot_image_channel() (in module cristallina.plot)": [[0, "cristallina.plot.plot_image_channel"]], "plot_spectrum_channel() (in module cristallina.plot)": [[0, "cristallina.plot.plot_spectrum_channel"]], "print_run_info() (in module cristallina.utils)": [[0, "cristallina.utils.print_run_info"]], "process_run() (in module cristallina.utils)": [[0, "cristallina.utils.process_run"]], "raw_sics_client() (in module cristallina.sea_graphclient)": [[0, "cristallina.SEA_GraphClient.raw_sics_client"]], "rows (cristallina.utils.roi property)": [[0, "cristallina.utils.ROI.rows"]], "run() (in module cristallina.skeleton)": [[0, "cristallina.skeleton.run"]], "scan_info() (in module cristallina.utils)": [[0, "cristallina.utils.scan_info"]], "setup_cachedirs() (in module cristallina.analysis)": [[0, "cristallina.analysis.setup_cachedirs"]], "setup_logging() (in module cristallina.skeleton)": [[0, "cristallina.skeleton.setup_logging"]], "sics_client() (in module cristallina.sea_graphclient)": [[0, "cristallina.SEA_GraphClient.sics_client"]], "sigma_to_fwhm() (in module cristallina.utils)": [[0, "cristallina.utils.sigma_to_FWHM"]], "wavelength_from_photon_energy() (in module cristallina.utils)": [[0, "cristallina.utils.wavelength_from_photon_energy"]], "width (cristallina.utils.roi property)": [[0, "cristallina.utils.ROI.width"]], "xray_transmission() (in module cristallina.utils)": [[0, "cristallina.utils.xray_transmission"]]}}) \ No newline at end of file diff --git a/docs/api/cristallina.rst b/docs/api/cristallina.rst new file mode 100644 index 0000000..d7dab71 --- /dev/null +++ b/docs/api/cristallina.rst @@ -0,0 +1,61 @@ +cristallina package +=================== + +Submodules +---------- + +cristallina.SEA\_GraphClient module +----------------------------------- + +.. automodule:: cristallina.SEA_GraphClient + :members: + :undoc-members: + :show-inheritance: + +cristallina.analysis module +--------------------------- + +.. automodule:: cristallina.analysis + :members: + :undoc-members: + :show-inheritance: + +cristallina.config module +------------------------- + +.. automodule:: cristallina.config + :members: + :undoc-members: + :show-inheritance: + +cristallina.plot module +----------------------- + +.. automodule:: cristallina.plot + :members: + :undoc-members: + :show-inheritance: + +cristallina.skeleton module +--------------------------- + +.. automodule:: cristallina.skeleton + :members: + :undoc-members: + :show-inheritance: + +cristallina.utils module +------------------------ + +.. automodule:: cristallina.utils + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: cristallina + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/api/modules.rst b/docs/api/modules.rst new file mode 100644 index 0000000..61c19b0 --- /dev/null +++ b/docs/api/modules.rst @@ -0,0 +1,7 @@ +cristallina +=========== + +.. toctree:: + :maxdepth: 4 + + cristallina diff --git a/setup.cfg b/setup.cfg index 56a4805..6dbf64d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -48,8 +48,22 @@ package_dir = # new major versions. This works if the required packages follow Semantic Versioning. # For more information, check out https://semver.org/. install_requires = - importlib-metadata; python_version<"3.8" - + importlib-metadata; python_version>="3.8" + pyyaml + matplotlib + numpy + numba + joblib + xraydb + pandas + lmfit + tqdm + h5py + jungfrau_utils @ git+https://github.com/paulscherrerinstitute/jungfrau_utils.git + bitshuffle + colorama + xarray + sfdata @ git+https://github.com/paulscherrerinstitute/sf_datafiles.git [options.packages.find] where = src @@ -119,5 +133,5 @@ exclude = [pyscaffold] # PyScaffold's parameters when the project was created. # This will be used when updating. Do not change! -version = 4.2.1 +version = 4.4 package = cristallina diff --git a/setup.py b/setup.py index c4e84f5..1d96f3b 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ Setup file for cristallina. Use setup.cfg to configure your project. - This file was generated with PyScaffold 4.2.1. + This file was generated with PyScaffold 4.4. PyScaffold helps you to put up the scaffold of your new Python project. Learn more under: https://pyscaffold.org/ """