Welcome to Cortex Loom#
Cortex Loom is a Python library designed for developers to create, customise, and publish Flows on Kelvin Cortex, our advanced machine learning platform. With this library, you can seamlessly integrate your ML workflows into Cortex to leverage its data types and powerful compute.
Features#
- Custom Function Injection: Define a custom function and deploy it as a custom Flow.
- Rich Data Types: Access and manipulate Cortex-native data structures for ML and analytics.
- Comprehensive Documentation: Tutorials, examples, and detailed API references all in one place.
Getting Started#
Create a Kelvin account
Ensure you have your Kelvin Cloud account set up first, you will need it to access Cortex and publish your own Flows. Visit machinemedicine.com to find out more about Kelvin.
Install the package:
The library can be installed using pip:
Publish your first Flow:
import numpy as np
from cortex_loom import FlowBuilder
from cortex_loom.types import PoseObject
# Define a simple function
def average_tapping_velocity(pose: PoseObject):
"""Compute the velocity [pixels/s] of left hand finger tapping."""
# Get signal arrays for both fingers
xy_index = pose.pose_array["LeftHandIndexFingerTip"][:, :2]
xy_thumb = pose.pose_array["LeftHandThumbTip"][:, :2]
# Convert timestamps to seconds
sec_time = pose.timestamps / 1000
# Compute the distance between finger tips
distance = np.sqrt(((xy_index - xy_thumb) ** 2).sum(axis=-1))
# Calculate the absolute velocity
velocity = np.abs(np.diff(distance)) / np.diff(sec_time)
# Return the mean
return np.mean(velocity)
# Initialise a FlowBuilder
builder = FlowBuilder(api_token=API_TOKEN)
# Publish the function as a Flow
builder.publish(func=average_tapping_velocity)
Check out the tutorials to see how to obtain the API_TOKEN,
and to learn more about the Cortex data types!
Explore tutorials:#
Our tutorial section contains step-by-step guides for interacting with Cortex Loom and understanding the data types exposed by Kelvin Cortex. Learn how to:
Visit the tutorials page for in-depth examples.
API Documentation#
Full API reference is available in in the API documentation.
Support#
For questions or support, contact our team at support@machinemedicine.com.