Scientific Reporting in Python

I am working on a python science project doing a lot of computing generating a lot of data.

The problem arises when reports are to be generated from this data, while embedded images (mostly calculated using matplotlib). I would like to use a python module or tool to be able to describe reports and β€œcreate” HTML pages for these reports (or any format supported by the browser).

I was thinking of creating an ipython notebook, but I was not able to find out if there is a way to do this (except for creating json, but I doubt this approach).

Another way to use Sphinx is a bit like matplotlib, but I'm not sure how I could fine tune layouts on different pages.

The last option is to use jinja2 templates (or django-templates or any template engine) and insert the matplotlib code inside.

I know this is vague, but could not find any link.

+4
source share
4 answers

nbconvert was combined with IPython itself, so please no longer use the standalone version. Now it is completely based on templates, so you can change something by simply tweaking css, completely rewriting your templates, or just overwriting the current part of the templates you need.

The notebook format is a pure json file, it takes ~ 20 lines to write a program that passes through it and re-starts the codec. This is a command line argument that it’s easy to write a laptop, make it a notebook template and run it on multiple data sets without opening a browser.

Some resources:

programmatically start nbconvert and start the headless laptop (first link)

+5
source

I think you want to work in ipython laptop and then use nbconvert

Currently, it is already its own utility, which already works (although it works with some obstacles during installation), but now it is being implemented directly in the ipython laptop device, which, I believe, should be released in the fall or so .

The goal (and Fernando Perez demonstrated that this works) is that after the conversion, the laptop becomes a fully documented image containing a pdf document.

+2
source

Using the built-in modus ipython notebook,

ipython notebook --pylab inline

you can execute your matplotlib scripts in a browser interactively (thus generating your graphs). Then go to

File β†’ Print View (in the laptop menu, not in the browser menu)

and save the generated html file (via the browser menu). This will include all the plots you created, as well as python code. Of course, you cannot change these html files anymore if the laptop server is not in the background. Is that what you mean?

+1
source

I just found this old question and want to add PWeave to the list, which is ideal for generating reports from laptops with Python / Jupyter code. I use it to share my work with colleagues who don't do too much programming.

It also integrates into the Spyder, spyder-reports IDE for python using the spyder-reports module.

0
source

Source: https://habr.com/ru/post/1490259/


All Articles