Getting Started

base.py as a template

The heart of each chemios driver is a base.py file. This file contains an abstract base class that models the interface for all instruments of that type.

For example, the temperature controllers base file has a set_temperature and get_current_temperature method: Each temperature controller must implement the set_temperature and get_current_temperature methods.

# -*- coding: utf-8 -*-

"""Base Class for Temperature Controllers"""

from abc import ABC

class TemperatureControllers(ABC):
    '''Base Class for Temperature Controllers
    '''
    def get_current_temperature(self):
        ''' Method to get the current temperature
        Returns:
            update: dict

            update = {
                    'temp_set_point': setpoint in °C,
                    'current_temp': temperature in °C
                    }
        '''

    def set_temperature(self, temp_set_point):
        ''' Method to set the temperature
        Args:
            temp_set_point (float): temperature setpoint in °C
        Returns:
            update: dict

            update = {
                    'temp_set_point': setpoint in °C,
                    'current_temp': temperature in °C
                    }
        '''

The standard inteface is enforced by each temperature controller inheriting the TemperatureControllers base class. See Omega9300Series.py for an example.

New Instrument

To create a new instrument, we will use the `new_instrument.py`_ script.

This script creates a new instrument file based on the base file. It also imports the newly created class inside that file to the package level (via __init__.py)

« Installation (5 minutes) | Next Steps »