Metadata-Version: 2.1
Name: ika
Version: 1.12.0
Summary: Unofficial Python package to control IKA products; we are not affiliated with IKA.
Home-page: https://gitlab.com/heingroup/ika
Author: Veronica Lai // Hein Group
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: ftdi-serial
Requires-Dist: numpy
Requires-Dist: pandas
Requires-Dist: hein-utilities (==3.14.2)
Requires-Dist: scipy

# ika

Unofficial Python package to control IKA products; we are not affiliated with IKA.

Package not compatible with Mac OS

## Products supported
- Magnetic stirrer
  - IKA Magnetic Stirrer model C-MAG HS 7
      - https://www.ika.com/en/Products-Lab-Eq/Magnetic-Stirrers-Hot-Plate-Lab-Mixer-Stirrer-Blender-csp-188/C-MAG-HS-7-control-Downloads-cpdl-20002694/
  - IKA RCT 5 digital
      - https://www.ika.com/en/Products-Lab-Eq/Magnetic-Stirrers-Hot-Plate-Lab-Mixer-Stirrer-Blender-csp-188/RCT-5-digital-cpdt-20002704/
- Thermoshaker
  - IKA MATRIX Orbital Delta plus
    - https://www.ika.com/en/Products-Lab-Eq/Thermoshakers-csp-918/MATRIX-Orbital-Delta-Plus-cpdt-10006853/

### Basics

Make sure you have installed the necessary driver for your computer:
- https://www.ika.com/en/Products-Lab-Eq/Magnetic-Stirrers-Hot-Plate-Lab-Mixer-Stirrer-Blender-csp-188/C-MAG-HS-7-control-Package-Downloads-cpdl-10003279/

To control a magnetic stirrer with the `ika` package, you need to identify the comport the device is when connected to
your computer.

### Example usage

#### Magnetic stirrer
```python
import time
from ika.magnetic_stirrer import MagneticStirrer

port = 'COM5'
plate = MagneticStirrer(device_port=port)
plate.start_stirring()
plate.target_stir_rate = 100
time.sleep(10)
plate.target_stir_rate = 200
plate.stop_stirring()

plate.target_temperature = 20
plate.start_heating()
plate.target_temperature = 19
time.sleep(5)
plate.stop_heating()

plate.disconnect()
```

#### Thermoshaker
```python
import time
import logging

from ika.thermoshaker import Thermoshaker

logger = logging.getLogger(__name__)
format = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
logging.basicConfig(format=format, level=logging.DEBUG)


if __name__ == '__main__':
    port = 'COM8'  # todo set to the correct port
    dummy = True  # todo set to true if testing without connecting to an actual thermoshaker

    kwargs = {
        'port': port,
        'dummy': dummy,
    }
    ts = Thermoshaker.create(**kwargs)

    ts.watchdog_safety_temperature = 15.5
    ts.start_watchdog_mode_1(30)
    ts.start_watchdog_mode_2(30)
    ts.switch_to_normal_operation_mode()

    actual_temperature = ts.temperature
    set_temperature = ts.set_temperature
    actual_speed = ts.speed
    set_speed = ts.set_speed
    logger.info(f'actual temperature: {actual_temperature}, '
                f'set temperature: {set_temperature}, '
                f'actual speed: {actual_speed}, '
                f'set speed: {set_speed}')

    logger.info('change the set temperature to 30 and speed to 500')
    ts.set_temperature = 30
    ts.set_speed = 500
    set_temperature = ts.set_temperature
    set_speed = ts.set_speed
    logger.info(f'set temperature: {set_temperature}, '
                f'set speed: {set_speed}')

    logger.info('start tempering and shaking')
    ts.start_tempering()
    ts.start_shaking()

    time.sleep(5)

    actual_temperature = ts.temperature
    actual_speed = ts.speed
    logger.info(f'actual temperature: {actual_temperature}, '
                f'actual speed: {actual_speed}')

    logger.info('change the set temperature to 25 and speed 0')
    ts.set_temperature = 25
    ts.set_speed = 0
    set_temperature = ts.set_temperature
    set_speed = ts.set_speed
    logger.info(f'set temperature: {set_temperature}, '
                f'set speed: {set_speed}')
    actual_temperature = ts.temperature
    actual_speed = ts.speed
    logger.info(f'actual temperature: {actual_temperature}, '
                f'actual speed: {actual_speed}')

    logger.info('stop tempering and shaking')
    ts.stop_tempering()
    ts.stop_shaking()
```


