Code Monkey home page Code Monkey logo

figure_portfolio's Introduction

figure portfolio - collect your computer-generated figures and plots in a TiddlyWiki

INSTALLATION

Put the file figure_portfolio.py in your current directory or under your PYTHONPATH.

DESCRIPTION

figure_portfolio is a python module that adds a tiddler in a TiddlyWiki 5 html file. The tiddler, a micro content in a TiddlyWiki, includes markdown links to existing figures, and you can edit the tiddlers after they are added by this module.

python figure_portfolio.py  -i tw5md_figs.html --title TimeDependency --image "temp_*.png" --tags "cheese"

TiddlyWiki01

Figure: Each box is a tiddler in the TiddlyWiki.

The idea behind this module is that when you do a bunch of numerical experiment, you often get a lot of plots as calculation results. Then you often need to browse them to examine how the calculation went on. Maybe, you need to keep records on how you generated these plots, what was the parameter used for the calculation, which version of the code was used, and so on.

The python module figure_portfolio is made to help keep track of the plots. The module can be used from command line interface or imported into other python programs as follows:

import figure_portfolio

#do some calculations and make plots `myfig1` and `myfig2` with matplotlib
images = ["fig1.png", "fig2.png"]
myfig1.figsave(images[0])
myfig2.figsave(images[1])
figure_portfolio.addtiddler(infile='tw5md_figs.html', title='Figs 1-2', image=images,  
    description='Two plots made with some parameter set', tags=['tomato', 'potato'])

Tiddly Wiki is "a unique non-linear notebook for capturing, organizing and sharing complex information." See A Gentle Guide to TiddlyWiki for more information. There is an add-on to use markdown in the TiddlyWiki, and the file tw5md_figs.html already includes that add-on. So use the file tw5md_figs.html as a template for TiddlyWiki to use with figure_portfolio.
The tiddlers can be searched by its title or tags, enabling systematic comparison of the plots, once you collect the plots in one TiddlyWiki. TiddlyWiki is highly customizable. Read instructions in http://tiddlywiki.com

COMMAND-LINE-OPTIONS

-i htmlfile   Path to input TiddlyWiki file. Required.
--title TITLE Title for the new Tiddler. Required.
-o htmlfile   Path to output TiddlyWiki file.  
              If not specified, the input is overwritten. 
--description Text to be added below the image 
              in the tiddler. 
              Markdown (Maruku flavor) can be used.
--image       Path to the image file. Wildcard character
              like "*.png" gets expanded.
--tags        Quoted space-delimited tags for this tiddler. 
              Ex: --tags "images temperature depth"

MODULE-OPTIONS

Set these parameters and call figure_porfolio.addtiddler() .

def addtiddler(infile, title, outfile=None, image=None,
    description='', tags='', replace=True):
    """Add a new tiddler to a TiddlyWiki file.

    infile(str): TiddlyWiki file.
    title(str): The title of the new tiddler.
    outfile(str): Output file. Default is the input file.
    image(str or list[str]: The image file(s) to be linked
         from the new tiddler.
    description(str): The text content of the new tiddler
         (mark down text).  Either `image` or `description`
         must have some content at least. 
    tags(str): Tags to be added to the new tiddler. 
         Multiple tag can be one string, 
         `"red, blue triangle"`, 
         or a list `["red", "blue triangle"]`. 
         Alpha numeric + SPC + underscore can be used 
         for the tag.
    replace(boolean): Replace an existing tiddler 
         with the same title (True) or rename the new one
         as 'title-1'(maximum 'title-99').
    """

COPYRIGHT

figure_portfolio is released into the public domain by the copyright holders with MIT licence.

This README file was originally written by Natsuhiko Mizutani and is likewise released into the public domain. โ€‹

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.