Commit 1afaede5 authored by Pierre Paleo's avatar Pierre Paleo
Browse files

Tinkering with sphinx

parent 46d7b6d9
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
# add these directories to sys.path here. If the directory is relative to the # add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here. # documentation root, use os.path.abspath to make it absolute, like shown here.
# #
# import os import os
# import sys import sys
# sys.path.insert(0, os.path.abspath('.')) sys.path.insert(0, os.path.abspath('../'))
# -- Project information ----------------------------------------------------- # -- Project information -----------------------------------------------------
...@@ -32,13 +32,19 @@ release = '2019.1.0' ...@@ -32,13 +32,19 @@ release = '2019.1.0'
# ones. # ones.
extensions = [ extensions = [
'recommonmark', 'recommonmark',
'numpydoc', # 'numpydoc',
'sphinx.ext.napoleon',
'sphinx.ext.autodoc', 'sphinx.ext.autodoc',
'sphinx.ext.mathjax', 'sphinx.ext.mathjax',
'sphinx.ext.viewcode', 'sphinx.ext.viewcode',
'nbsphinx' 'nbsphinx',
# 'sphinx.ext.autosummary',
# 'sphinx.ext.doctest',
# 'sphinx.ext.inheritance_diagram',
] ]
#autosummary_generate = True
autodoc_member_order = 'bysource'
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates'] templates_path = ['_templates']
...@@ -73,3 +79,5 @@ def setup(app): ...@@ -73,3 +79,5 @@ def setup(app):
'auto_toc_tree_section': 'Contents', 'auto_toc_tree_section': 'Contents',
}, True) }, True)
app.add_transform(AutoStructify) app.add_transform(AutoStructify)
...@@ -11,7 +11,7 @@ A **radiograph** (or **radio**) is the raw data at the output of a X-ray detecto ...@@ -11,7 +11,7 @@ A **radiograph** (or **radio**) is the raw data at the output of a X-ray detecto
In this documentation, we distinguish between radios and sinograms. In this documentation, we distinguish between radios and sinograms.
As stated before, a radio is a raw projection data, i.e what comes out of the detector. "Corrected radios" refer to radios after some CCD corrections and flat-field normalization. As stated before, a radio is a raw projection data, i.e what comes out of the detector. "Corrected radios" refer to radios after some CCD corrections.
Each radio has *Nx* pixels horizontally, and *Nz* pixels vertically. During a scan, a collections of *Na* radios are acquired, where *Na* is the number of projection angles. Each radio has *Nx* pixels horizontally, and *Nz* pixels vertically. During a scan, a collections of *Na* radios are acquired, where *Na* is the number of projection angles.
......
...@@ -7,13 +7,20 @@ Welcome to Nabu's documentation! ...@@ -7,13 +7,20 @@ Welcome to Nabu's documentation!
================================ ================================
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 1
:caption: Contents: :caption: Contents:
definitions.md definitions.md
ccdprocessing.md
nabu_config_file.md nabu_config_file.md
validators.md validators.md
modules/index.rst
..
apidoc/nabu.rst
..
Indices and tables Indices and tables
================== ==================
......
...@@ -145,8 +145,8 @@ class MedianFilter(CudaProcessing): ...@@ -145,8 +145,8 @@ class MedianFilter(CudaProcessing):
else: else:
self._allocate_array("d_output", self.shape) self._allocate_array("d_output", self.shape)
self.cuda_kernel_2d( self.cuda_kernel_2d(
self.d_input.gpudata, self.d_input,
self.d_output.gpudata, self.d_output,
self.Nx, self.Nx,
self.Ny, self.Ny,
self.Nz, self.Nz,
......
...@@ -71,12 +71,3 @@ __global__ void medfilt2d( ...@@ -71,12 +71,3 @@ __global__ void medfilt2d(
#endif #endif
} }
...@@ -286,34 +286,6 @@ class FlatField(CCDProcessing): ...@@ -286,34 +286,6 @@ class FlatField(CCDProcessing):
return radios_corrected return radios_corrected
"""
# It should generate a mask of valid/invalid pixels.
# This does not work yet !
def sigma_clip_mask(data, nsigma_low=4, nsigma_up=None, axis=None, maxiter=5):
NAN = np.float32(np.nan)
nsigma_up = nsigma_up or nsigma_low
res = np.zeros(data.shape, np.float32)
res[:] = data[:]
iteration = 0
outliers = 1
invalids = np.zeros(data.shape, np.bool)
valid_mask = np.ones_like(invalids)
while outliers > 0 and iteration < maxiter:
m = np.nanmean(res, axis=axis)
std = np.nanstd(res, axis=axis)
lower_bound = m - std * nsigma_low
upper_bound = m + std * nsigma_up
invalid_mask = (res[valid_mask] < lower_bound) + (res[valid_mask] > upper_bound)
valid_mask = np.logical_not(invalid_mask)
invalids = invalids + invalid_mask
res[invalid_mask] = NAN
outliers = invalid_mask.sum()
iteration += 1
return invalids
"""
class CCDCorrection(CCDProcessing): class CCDCorrection(CCDProcessing):
""" """
......
...@@ -6,7 +6,6 @@ import pycuda.driver as cuda ...@@ -6,7 +6,6 @@ import pycuda.driver as cuda
from pycuda import gpuarray as garray from pycuda import gpuarray as garray
from ..utils import updiv, get_cuda_srcfile, _sizeof from ..utils import updiv, get_cuda_srcfile, _sizeof
#~ from ..cuda.utils import copy_array, get_cuda_context
from ..cuda.processing import CudaProcessing from ..cuda.processing import CudaProcessing
from ..cuda.kernel import CudaKernel from ..cuda.kernel import CudaKernel
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment