MSL Resources are specific classes that are used to communicate with the equipment.
MXSeries– MX100QP, MX100TP, MX180TP
CMI (Czech Metrology Institute)
SIA3– Switched Integrator Amplifier
TCSeries– Temperature Controller (TC LV, TC M, TC Lite)
EQ99– EQ-99 Manager
GMH3000– GMH 3000 Series thermometer
PR4000B– Flow and Pressure controller
iTHX– iTHX-W3, iTHX-D3, iTHX-SD, iTHX-M, iTHX-W, iTHX-2
SHOT702– Two-axis Stage Controller
PicoScope2000- PicoScope 2000 Series
PicoScope2000A- PicoScope 2000 Series A
PicoScope3000- PicoScope 3000 Series
PicoScope3000A- PicoScope 3000 Series A
PicoScope4000- PicoScope 4000 Series
PicoScope4000A- PicoScope 4000 Series A
PicoScope5000- PicoScope 5000 Series
PicoScope5000A- PicoScope 5000 Series A
PicoScope6000- PicoScope 6000 Series
RaicolTEC– TEC (Peltier-based) oven
Wrapper around the Kinesis SDK.
FilterWheelXX2C– FW102C, FW212C
Creating a new MSL Resource
If you do not want to upload the new MSL Resource class to the repository then you only need to write the code found in Step 5 to use your class in your own programs.
If you are adding a new MSL Resource for equipment from a manufacturer that does not already exist in the msl/equipment/resources directory then create a new Python package in msl/equipment/resources using the name of the manufacturer as the package name.
Create a new Python module, in the package from Step 2, using the model number of the equipment as the name of the module.
msl.equipment.exceptionsclass has not been created for this manufacture then create a new exception handler class using the name of the manufacturer in the class name.
Create a new connection class within the module that you created in Step 3. The class must be a subclass of one of the Connection Classes.
# msl/equipment/resources/<manufacturer>/<model_number>.py # from msl.equipment.resources import register from msl.equipment.exceptions import TheErrorClassFromStep4 # this is optional from msl.equipment.connection_xxx import ConnectionXxx # replace xxx with the Connection subclass # Register your class so that MSL-Equipment knows that it exists @register(manufacturer='a regex pattern', model='a regex pattern') # can include a `flags` kwarg class ModelNumber(ConnectionXxx): # change ModelNumber and ConnectionXxx def __init__(self, record): """Edit the docstring... Do not instantiate this class directly. Use the :meth:`~.EquipmentRecord.connect` method to connect to the equipment. Parameters ---------- record : :class:`~.EquipmentRecord` A record from an :ref:`equipment-database`. """ super(ModelNumber, self).__init__(record) # change ModelNumber # the following is optional, the default exception handler is MSLConnectionError self.set_exception_class(TheErrorClassFromStep4) # change TheErrorClassFromStep4
Add at least one example for how to use the new MSL Resource in msl/examples/equipment. Follow the template of the other examples in this package for naming conventions and for showing how to use the new MSL Resource.
Create tests for the new MSL Resource. The tests cannot be dependent on whether the equipment is physically connected to the computer running the test (ideally the examples that you write in Step 6 will demonstrate that communicating with the equipment works). The very minimal test to create is to add a test case to the def test_find_resource_class() function for ensuring that your class is returned for various values of manufacturer and model. Run the tests using
python setup.py test(ideally you would run the tests for all currently-supported versions of Python, see also condatests.py).
.rstdocumentation files for the new MSL Resource to the docs/_api folder. You can either run
python setup.py apidocto automatically generate the
.rstdocumentation files or you can create the necessary
.rstfiles manually. Running
python setup.py apidocwill generate
.rstfiles for all modules in MSL-Equipment in the
docs/_autosummaryfolder. Only copy the
.rstfiles that are associated with your new MSL Resource to the docs/_api folder. After copying the files you can delete the
docs/_autosummaryfolder before running
python setup.py docsto build the documentation, otherwise you will get numerous warnings. If you want to manually create the
.rstfiles then look in the docs/_api folder for examples from other MSL Resources.
If you created a new package in Step 2 then you need to add the new package to the
Subpackagessection in docs/_api/msl.equipment.resources.rst. Insert the name of the new MSL Resource package in the file alphabetically. If you forget to do this step then a warning will appear when building the documentation to help remind you to do it. If you did not create a new package in Step 2 then add the
.rstfile from Step 8 to the
Subpackagessection in the appropriate
Add the new MSL Resource class, alphabetically, to the list of MSL Resources in docs/resources.rst. Follow the template that is used for the other MSL Resources listed in this file.
Add yourself to
AUTHORS.rstand add a note in
CHANGES.rstthat you created this new Resource. These files are located in the root directory of the MSL-Equipment package.
If running the tests pass and building the docs show no errors/warnings then create a pull request.