Getting Started

This is an introduction on how to create a protocol for a MultispeQ and how they can be saved to a single file so you can use it with multiple scipts/projects or share it.

Note

This is also the standard format if you want to submit your protocol to JII-MultispeQ-Protocols.

Template for a MultispeQ protocol with an analysis function
 1"""
 2Protocol Name
 3=============
 4
 5A detailed protocol description
 6
 7"""
 8
 9# MultispeQ Protocol
10_protocol = [{}]
11
12# Function to analyze MultispeQ measurement
13def _analyze ( data ):
14  """
15  Analysis of the data returned from the MultispeQ
16  """
17
18  # Define the output dictionary here
19  output = {}
20
21  return output
22
23# Example measurement (from MultispeQ, not analyzed - optional)
24_example = [
25  {
26    "device_name": "MultispeQ",
27    "device_version": "2",
28    "device_id": "2a:4d:f4:81",
29    "device_battery": 82,
30    "device_firmware": "2.345",
31    "sample": [
32      []
33    ]
34  }
35]

Protocol Code

The default variable name should be _protocol, but any can be used to do the analysis. If needed, the protocol can be generated using a function, it just needs to be a valid JSON.

Example: Minimum valid MultispeQ protocol
1# MultispeQ Protocol
2_protocol = [{}]

Analysis Function

After the meaurement data is returned by the MultispeQ, it can be analyzed further. For example, the Photosystem II quantum yield needs to be derived from a fluorescence trace, since the MultispeQ will not directly return a value. The default function name should be _analyze, but any can be used to do the analysis.

Example: Basic function to analyze data
 1# Function to analyze MultispeQ measurement
 2def _analyze ( data ):
 3  """
 4  Analysis of the data returned from the MultispeQ
 5  """
 6
 7  # Define the output dictionary here
 8  output = {}
 9
10  return output

Warning

When creating an analysis function, keep the calculations and plotting separate. If you would run the function on multiple measurements, a potentially large number of plots would be generated, slowing everything down. Instead, take the output of the analysis function and then create the graphs to plot the data.

Example Measurement

If you want the output returned from the MultispeQ can be saved as an example. The default variable name should be _example, but any can be used to hold the example.

Example: Measurement returned from MultispeQ
 1# Example measurement (from MultispeQ, not analyzed - optional)
 2_example = [
 3  {
 4    "device_name": "MultispeQ",
 5    "device_version": "2",
 6    "device_id": "2a:4d:f4:81",
 7    "device_battery": 82,
 8    "device_firmware": "2.345",
 9    "sample": [
10      []
11    ]
12  }
13]

Validation beta

This package provides a function to test your protocol to see if there might be an issue. Use the following function to see if there are any unknown commands used or if there are any other issues.

# Manual validation (verbose to print errors)
validate( _protocol, True )

# In a script
is_valid, errors = validate( _protocol )

Test your protocol for issues before you continue to work with it or you publish it.

validate(protocol=None, verbose=False)[source]

Test protocol

Parameters:
  • protocol – Protocol code to test

  • type – dict or str

  • verbose – Print errors

  • type – bool

Returns:

True if tests are passed with an empty list, otherwise False with a list of errors

Return type:

bool, list

class SchemaValidator(schema: Dict)[source]

Bases: object

validate_with_all_errors(data: Dict) Tuple[bool, List[str]][source]

Validates data and returns all validation errors.

Parameters:

data – The data to validate against the schema

Returns:

Tuple of (is_valid, list_of_error_messages)

Publish

Of course you can publish your protocol any way you want, but you can also provide it to the JII community, by integrating it into the JII-MultispeQ-Protocols package for others to use. To do that, you have to do a pull request for this repository. Once approved, the version number of the package will be increased and your protocol is now available to the community through the package.

Note

Find a detailed desciption on how to create protocols on https://help.photosynq.com/protocols/create-edit-protocol.html