pyMez_Documentation

# Welcome to pyMez, an open source python library for science.¶

This documentation is for the pyMez package, designed by Aric Sanders aric.sanders@gmail.com 2016.

## Table of Contents¶

1. ### Introduction

A brief introduction to pyMez and its motivation.

2. ### Installing and Loading pyMez

How to install pyMez and its requirements

3. ### Getting Help

How to get help on the pyMez package and general.

4. ### The Design of pyMez

The overall design of pyMez, including how to contribute.

5. ### License

pyMez License Statement

back to top | previous topic | next topic

## Introduction

pyMez is a python package born out of the daily needs of a laboratory scientist. In particular, there is a constant need to use external equipment to acquire data, store that data in a sensible way, analyze the stored data, and generate collections and reports after analyzing the data. In the world of scientific computation there is an endless universe of solutions to do this, however none of the solutions met my personal daily needs and philosophy simultaneously. This package tries to stitch together many tools to meet those needs, while serving as a backend library to a webserver. It thus has many dependencies. Some of the dependencies are os specific, however the lack of them should not prevent operation. Although it currently has a single primary developer, it is my hope that it will be adopted by at least 10's of people and help them accomplish their daily scientific goals.

back to top | previous topic | next topic

## Installing and Loading pyMez

### Installation using pip¶

`>> pip install pyMez`

### Long Installation¶

1. Install Anaconda 2.7 from https://www.continuum.io/downloads
2. Install pyvisa using pip install pyvisa
3. Install NI-Visa from http://www.ni.com/download/ni-visa-15.0.1/5693/en/
4. Clone boa repository to Anaconda2/Lib/site-packages
5. Clone pyMez to Anaconda2/Lib/site-packages
6. Install wx from source forge http://wxpython.org/
7. In addition, the USB-GPIB interface needs drivers from NI (NI488.2 version 15) and a computer restart.

### Optional Dependencies¶

1. Inkscape from https://inkscape.org/en/download/
2. Microscoft Office
3. pdfkit and wkhtmltopdf pip install pdfkit and install from http://wkhtmltopdf.org/
4. statistiCAL and Microwave Uncertainty Framework from http://www.nist.gov/ctl/rf-technology/related-software.cfm

### Development Environment Details¶

A detailed description of my development environment can be found here

### Accessing the API after installation¶

The API is best accessed by importing as

    from pyMez import *

However, if a specific function or class is required then direct import also works (this form imports the full API)

    from pyMez.Code.DataHandlers.XMLModels import XMLBase

If you want to have the import skip the API, then add the pyMez folder to sys.path and then import beginning with Code

    import sys
    sys.path.append(r"C:\ProgramData\Anaconda2\Lib\site-packages\pyMez")
    from Code.DataHandlers.XMLModels import XMLBase

back to top | previous topic | next topic

## Getting Help

There are many ways to get help on pyMez. Internal to pyMez there are several primary help components:

- This page
- API help
- Html Examples
- Jupyter Interactive Examples
- Index of All Classes and Functions in pyMez

</ul> Additionally, python has a series of help functions including the command line tool pydoc, in `jupyter` or Ipython help can be reached by ?object or help(object). `?XMLBase`

    help(XMLBase)

In addition there are several tools in pyMez.Code.Utils.HelpUtils for generating html based help files.

back to top | previous topic | next topic

## The Design of pyMez

### Overall Design Goal¶

pyMez was designed with the overall goal of being easy to use, well documented, well tested and modular. The overall design follows a pattern of Models (DataHandlers), View and View-Controllers (FrontEnds), Anaylsis and Instrument Control. The python modules that compose pyMez follow these jupyter version of the guidelines or html version of the guidelines

### Directory Structure¶

- pyMez : The top directory that should be installed in python27/Lib/site-packages or C:\ProgramData\Anaconda2\Lib\site-packages
  - Code: The top level folder for the code repository
  - Utils: Subpackage for utility functions needed by all of pyMez
  - DataHandlers: Data models needed by everything but Utils
  - Analysis: Functions and classes based on analyzing data. Requires Utils and DataHandlers.
  - InstrumentControl: Functions and classes that communicate with external devices. Requires Utils and DataHandlers
  - FrontEnds: Functions and classes that tie it altogether for the user, requires all other modules.
  - Documentation: Top level folder for docs including examples
  - Instruments: A repository for XML sheets describing instruments
  - Data: A repository for data, this is volatile and likely to change
  - Measurements: Storage for measurement data, either in xml or ascii
  - Logs: Storage for xml logs
  - States: Storage for Instrument and Experimental States
  - Reports: Storage for formatted output

### Testing Infrastructure¶

pyMez has a multi-tiered testing infrastructure. It is comprised of basic unit tests, mesoscopic in-module tests, and integration tests.

1. Unit tests : These tests check if functions and classes with a basic input return what is expected. They are found in the module pyMez.Code.Utils.pyMezUnitTests
2. In Module Tests : Theses tests are scripts included in each module that test a series of things about functions or classes, they are typically named test_thing_of_interest(). For example in the module pyMez.Code.DataHandlers.XMLModels there are >15 scripts to test functions and classes with names like test_get_header.
3. Integration Tests: These tests check if a large number of interacting components work as expected. For the wx frontend this is primarily the class AdvancedInterfaceFrame, or an integrated application that can open new window panels, run the in module tests and check if data objects appear as they are expected. For the django FrontEnd this is a Test_Server run using Django's development server found in manage.py. For Jupyter, this is a series of examples that live in pyMez/Documentation/Examples.

back to top | previous topic | next topic

## License

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to http://unlicense.org/