Giter VIP home page Giter VIP logo

openmalaria.tools's Introduction

openmalaria.tools

This is a set of (command line) tools for end users for usage in combination with the openMalaria simulator program from SwissTPH.

No programming experience is required to use these tools.

It contains scripts for

Reasons to implement openmalaria.tools as a separate project from vecnet.openmalaria

  1. Different license can be used (say user tools can be GPL, while core library can use less restrictive license)
  2. openmalaria.tools will have a lot of dependencies on other libraries (lxml, mathlibplot and so on). vecnet.openmalaria should have as few dependencies as possible - ideally, none.
  3. openmalaria.tools is focused on end users, and do not require any programming to be used. vecnet.openmalaria is a library and is intended to be used by python programmers.
  4. We may have different versioning approaches for vecnet.openmalaria and openmalaria.tools. For example, the tools may have a version number that tracks the newest OM schema version it supports (e.g., OM Toolkit v33.# supports OM versions up to and including version 33). In contrast, the vecnet.openmalaria library should use semantic versioning, and only change its major version when there's a backward-incompatible change to its API.

Tool documentation

Some documentation can be found in the openmalaria wiki.

Result plotting

The plotResults.py script is a tool to quickly plot standard outputs (not the "continuous" outputs) from one or a small number of simulations. Documentation can be found here.

Generating documentation

This tool generates a set of wiki pages from XML Schema Documents (XSD). Here is the output for OpenMalaria schemas.

Usage:

  1. Change to the directory where you want the output
  2. Run, giving the path to all schemas of interest (e.g. /path/to/generateDoc.py /path/to/schemas/schema_*.xsd)

Note that the tool supports only the limited schema features found in OpenMalaria schemas and will likely need extension for any other schema.

XML tools

The script reformat_xmls.py standardises indentation, new-lines and general usage of white-space in an XML file. It is an alternative to xmllint --format. Usage: ./reformat_xmls.py -p folder_path | file_path

Another script, translateXML.py, eases migration of existing OpenMalaria scenarios (XML files) to later versions of OpenMalaria. Usage is simply translateXML.py -t 33 scenario.xml. Full instructions below:

usage: translateXML.py [-h] [-t VER] [-d DIR | -i | --db DBNAME] [-u USER]
                    [-r RUN_ID] [--mol5d-pairwise] [--add-human-weight]
                    [FILE [FILE ...]]

This tool translates one or more OpenMalaria scenario files (XML) from one
version to the next.

positional arguments:
FILE                  A file to translate. Multiple files may be specified.

optional arguments:
-h, --help            show this help message and exit
-t VER, --target-version VER
                        Target version for translation. Default: 33
-d DIR, --dest DIR    Destination directory for translated scenarios
-i, --in-place        If set, files will be updated in-place (incompatible
                        with -d option)
--db DBNAME           If set, files will be updated from the scenarios table
                        of this database.
-u USER, --user USER  Username to connect to database with. If not set, will
                        try to connect without username.
-r RUN_ID, --run-id RUN_ID
                        [DB mode] If given, only scenarios with this run_id                                               
                        are updated; if not, all are updated.                                                             
--mol5d-pairwise      Update XMLs using a 5-day time step to use the                                                    
                        Molineaux model with pairwise sampling.                                                           
--add-human-weight    Add scenario/model/human/weight data to scenarios                                                 

openmalaria.tools's People

Contributors

baguage avatar dhardy avatar slremy avatar tph-thuering avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openmalaria.tools's Issues

unexpected child of xs:choice: xs:sequence

When I try to generate documentation from the current version I get the following error:

Error: unexpected child of <{http://www.w3.org/2001/XMLSchema}choice>: <{http://www.w3.org/2001/XMLSchema}sequence>

$ ~/om/vecnet/openmalaria.tools/openmalaria/tools/generateDoc.py ~/om/openmalaria/build/schema/scenario_current.xsd

Generated schema _ documentation

This page is automatically generated from the following schema file: scenario_current.xsd.
I recommend against editing it because edits will likely be lost later.

Key:
abc required (one) [ def ] optional (zero or one) ( ghi )* any number (zero or more) ( jkl )+ at least one ( mno ){2,inf} two or more occurrences \
Error: unexpected child of <{http://www.w3.org/2001/XMLSchema}choice>: <{http://www.w3.org/2001/XMLSchema}sequence>

TypeError: split() takes no keyword arguments

I receive an error when trying to generate Documentation for schema-34. (related to SwissTPH/openmalaria#89)

$ generateDoc.py build/schema/scenario_34.xsd
Generated schema 34 documentation
=================================
This page is automatically generated from the following schema file: `scenario_34.xsd`.
I recommend against editing it because edits will likely be lost later.

Key:
\```
    abc             required (one)
  [ def ]           optional (zero or one)
  ( ghi )*          any number (zero or more)
  ( jkl )+          at least one
  ( mno ){2,inf}    two or more occurrences
\```
Traceback (most recent call last):
  File "/usr/local/bin/generateDoc.py", line 579, in <module>
    main()
  File "/usr/local/bin/generateDoc.py", line 549, in main
    translate(f_in, sys.stdout, schema_name)
  File "/usr/local/bin/generateDoc.py", line 502, in translate
    omroot = Element(child)
  File "/usr/local/bin/generateDoc.py", line 390, in __init__
    Node.__init__(self, node)
  File "/usr/local/bin/generateDoc.py", line 174, in __init__
    self.read_child(child)
  File "/usr/local/bin/generateDoc.py", line 397, in read_child
    Node.read_child(self, child)
  File "/usr/local/bin/generateDoc.py", line 183, in read_child
    self.appinfo = parse_appinfo(appinfo.text)
  File "/usr/local/bin/generateDoc.py", line 124, in parse_appinfo
    parts = pair.split(':', maxsplit=1)
TypeError: split() takes no keyword arguments

Installation is incomplete

Installation procedure:

foo:~/openmalaria.tools$ python setup.py build
foo:~/openmalaria.tools$ sudo python setup.py install

Expectation: run an installed script from anywhere

foo:~/bar$ generateDoc.py
generateDoc.py: command not found

I would expect e.g. "generateDoc.py" to be copied to /usr/local/bin or a similar path, so the user can run generateDoc.py from any folder.

Like this:

foo:~/bar$ generateDoc.py 
usage: generateDoc.py [-h] [-o FILE] SCHEMA [SCHEMA ...]
...

Issue: There are no python files (e.g. generateDoc.py) in any of $PATH related directories.

Question: Can anybody else confirm, if this is an expected behaviour or a bug?

further platform related information:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 15.04
Release:    15.04
Codename:   vivid

$ python --version
Python 2.7.9

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.