Online - Projects

The code below is an example on how to download the MultispeQ data collected for a project as well as the information about the project.

examples/python/project-data.py
1import jii_multispeq.project as project
2
3email = "your-email@domain.com"
4projectId = 29652
5
6## Get the project data and information
7df, info = project.get(email, projectId)

You start by importing the project module from the JII-MultispeQ package as project.

Next you create two variables email and projectId with the respective values relevant for your data analysis (highlighted rows).

The following step is using the download() function from the project module to download the MultispeQ data. If you run the code for the first time, you will be prompted to enter your Password to authenticate and download the data. When all data has been downloaded, two files will be generated in the same folder as your script that you are running. The next time you run the scipt it will load the data from your local files instead of downloading them again.

You see that the download() function returns two variables, df holding a list of dataframes (Pandas) and the project information (dict)

Example of files for a data analysis:

<your project directory>/
├── PhotosynQ_123.json     # Project Information
├── PhotosynQ_123.pickle   # Project Data (dataframes)
└── <your script>.py       # can be a *.jpynb as well

Important

If you want to share your analysis with somebody not signed up with PhotosynQ, you can share the two data files together with your analysis. The analysis will require to sign again to download the data.

Pro-Tip: You can use the code below to load data locally, if you provide data files and don’t want to share your email address.

df, info = project.download( projectId=projectId )

Project Information info

In the previous example we use the download() function to access and save the project’s MultispeQ data and information. The functions below allow you to view the information about the project.

Meta Data

Using the print_info() (alias: show()) function of the project module, a summary can be printed to view the project’s information.

View the information about the selected project
## Print the project information
project.print_info(info)
Output: Information about the selected Project
===========================
  D1 screen 2 (ID: 29652)
===========================

URL: https://photosynq.org/projects/d1-screen-2

Basic Info:
-----------
Datasets:    399
Created:     2024-09-09T13:59:57.452Z
Last Update: 2024-09-10T06:59:47.674Z
Locations:
 - Wageningen, NL (51.97, 5.6667)

Project Creator:
----------------
Name:      Thekla von Bismarck
Institute: Jan IngenHousz Institute
URL:       https://photosynq.org/users/thekla-von-bismarck

Project Details:
----------------
PIRK screen in D1
Directions: 
None

Meta Data:
----------
 * Plant? - Short Answer
   Unique Inputs: 38
 * Replicate # - Short Answer
   Unique Inputs: 8

Protocol(s):
------------
 * PIRK - FIELD Fluor red act orange PIRK wPSI DMK 2024_TB3 (ID: 3356)
   Post-illumination relaxation kinetics with fluorescence and P700 with fixed 
   intensities (100, 500)

Tip

If you would like to see the protocol code used by the MultispeQ as well, set the show_code variable to True.

project.print_info(info, True)

Protocol

The information about the protocol used in the project is stored inside the info variable as well. In addition to the project module, also the module is required.

Example: Get the protocol name and code
import jii_multispeq.protocol as protocol

## Get Protocol Name
protocol_name =  protocol.get_protocol_name(info)
print(protocol_name)

## Get Protocol Code
protocol_code = protocol.get_protocol(info)
print(protocol_code)
Output: Information about the selected Project
PIRK - FIELD Fluor red act orange PIRK wPSI DMK 2024_TB3

Note

The example assumes, that the project has only one protocol. In case your project has more than one protocol, a specific protocol can be selected adding the index position of the protocol to the function as well.

Output: Information about the selected Project
[{"_protocol_set_": [{"averages": 1,
                      "check_battery": 1,
                      "do_once": 1,
                      "label": "no_leaf_baseline",
                      "par_led_start_on_open": 2},
                     {"bleed_correction": 1,
                      "do_once": 1,
                      "par_led_start_on_close": 2},
                     {"autogain": [[1, 1, 3, 20, 50000], [0, 10, 1, 20, 50000]],
                      "do_once": 1,
                      "e_time": 1,
                      "environmental": [["light_intensity"],
                                        ["temperature_humidity_pressure"],
                                        ["temperature_humidity_pressure2"],
                                        ["contactless_temp"],
                                        ["compass_and_angle"]],
                      "label": "env"},
                     {"detectors": [[1, 1, 3], [1, 1, 3], [1, 1, 3], [1, 1, 3],
                                    [1, 1, 3], [1, 1, 3], [1, 1, 3], [1, 1, 3],
                                    [1, 1, 3], [1, 1, 3], [1, 1, 3], [1, 1, 3],
                                    [1, 1, 3], [1, 1, 3], [1, 1, 3], [1, 1, 3],
                                    [1, 1, 3]],
                      "e_time": 1,
                      "label": "PIRK",
                      "nonpulsed_lights": [[2, 4], [2, 4], [2, 4], [2, 4],
                                           [2, 4], [2, 4], [2, 4], [2, 4],
                                           [2, 4], [2, 4], [2, 4], [2, 4],
                                           [2, 4], [2, 4], [2, 4], [2, 4],
                                           [2, 4]],
                      "nonpulsed_lights_brightness": [["@s0", 0],
                                                      ["@s0", "@n1:0"],
                                                      ["@s0", 0],
                                                      ["@s0", "@n1:1"],
                                                      ["@s0", 0],
                                                      ["@s0", "@n1:2"], [0, 0],
                                                      [0, "@n1:2"], [0, 0],
                                                      [0, "@n1:2"], [0, 0],
                                                      [0, "@n1:2"], [0, 0],
                                                      [0, "@n1:2"], [0, 0],
                                                      [0, "@n1:2"], [0, 0]],
                      "pre_illumination": [2, "@s0", 10000],
                      "protocol_averages": 1,
                      "protocol_repeats": 1,
                      "pulse_distance": [1000, 1000, 1000, 1000, 1000, 1000,
                                         1000, 1000, 1000, 1000, 1000, 1000,
                                         1000, 1000, 1000, 1000, 1000],
                      "pulse_length": [["a_d0", 10, "a_d1"],
                                       ["a_d0", 10, "a_d1"],
                                       ["a_d0", 10, "a_d1"],
                                       ["a_d0", 10, "a_d1"],
                                       ["a_d0", 10, "a_d1"],
                                       ["a_d0", 10, "a_d1"],
                                       ["a_d0", 10, "a_d1"],
                                       ["a_d0", 10, "a_d1"],
                                       ["a_d0", 10, "a_d1"],
                                       ["a_d0", 10, "a_d1"],
                                       ["a_d0", 10, "a_d1"],
                                       ["a_d0", 10, "a_d1"],
                                       ["a_d0", 10, "a_d1"],
                                       ["a_d0", 10, "a_d1"],
                                       ["a_d0", 10, "a_d1"],
                                       ["a_d0", 10, "a_d1"],
                                       ["a_d0", 10, "a_d1"]],
                      "pulsed_lights": [[10, 3, 1], [10, 3, 1], [10, 3, 1],
                                        [10, 3, 1], [10, 3, 1], [10, 3, 1],
                                        [10, 3, 1], [10, 3, 1], [10, 3, 1],
                                        [10, 3, 1], [10, 3, 1], [10, 3, 1],
                                        [10, 3, 1], [10, 3, 1], [10, 3, 1],
                                        [10, 3, 1], [10, 3, 1]],
                      "pulsed_lights_brightness": [["a_b0", "@n4:0", "a_b1"],
                                                   ["a_b0", "@n4:0", "a_b1"],
                                                   ["a_b0", "@n4:0", "a_b1"],
                                                   ["a_b0", "@n4:0", "a_b1"],
                                                   ["a_b0", "@n4:0", "a_b1"],
                                                   ["a_b0", "@n4:0", "a_b1"],
                                                   ["a_b0", "@n4:0", "a_b1"],
                                                   ["a_b0", "@n4:0", "a_b1"],
                                                   ["a_b0", "@n4:0", "a_b1"],
                                                   ["a_b0", "@n4:0", "a_b1"],
                                                   ["a_b0", "@n4:0", "a_b1"],
                                                   ["a_b0", "@n4:0", "a_b1"],
                                                   ["a_b0", "@n4:0", "a_b1"],
                                                   ["a_b0", "@n4:0", "a_b1"],
                                                   ["a_b0", "@n4:0", "a_b1"],
                                                   ["a_b0", "@n4:0", "a_b1"],
                                                   ["a_b0", "@n4:0", "a_b1"]],
                      "pulses": ["@n1:4", "@n1:3", "@n1:4", "@n1:3", "@n1:4",
                                 "@n1:3", "@n1:5", "@n1:3", "@n1:5", "@n1:3",
                                 "@n1:6", "@n1:3", "@n1:7", "@n1:3", "@n1:7",
                                 "@n1:3", "@n1:5"]},
                     {"detectors": [[1], [1], [1], [1], [1], [1], [1]],
                      "e_time": 1,
                      "label": "PAM",
                      "nonpulsed_lights": [[2, 9, 7], [2, 9, 7], [2, 9, 7],
                                           [2, 9, 7], [2, 9, 7], [2, 9, 7],
                                           [2, 9, 7]],
                      "nonpulsed_lights_brightness": [["@s0", 0, 0],
                                                      ["@n2:0", 0, 2000],
                                                      ["@n2:1", 0, 2000],
                                                      ["@n2:2", 0, 2000],
                                                      [0, -400, 0], [0, 0, 0],
                                                      ["@s0", 0, 0]],
                      "pre_illumination": [2, "@s0", 5000],
                      "protocol_averages": 1,
                      "protocol_repeats": 1,
                      "pulse_distance": [1500, 1500, 1500, 1500, 30000, 1500,
                                         1500],
                      "pulse_length": [[20, "a_d0"], [20, "a_d0"], [20, "a_d0"],
                                       [20, "a_d0"], [20, "a_d0"], [20, "a_d0"],
                                       [20, "a_d0"]],
                      "pulsed_lights": [[3, 10], [3, 10], [3, 10], [3, 10],
                                        [3, 10], [3, 10], [3, 10]],
                      "pulsed_lights_brightness": [["@n4:0", "a_b0"],
                                                   ["@n4:0", "a_b0"],
                                                   ["@n4:0", "a_b0"],
                                                   ["@n4:0", "a_b0"],
                                                   ["@n4:0", "a_b0"],
                                                   ["@n4:0", "a_b0"],
                                                   ["@n4:0", "a_b0"]],
                      "pulses": [40, 50, 50, 50, 100, 50, 40]},
                     {"label": "spad", "spad": [1]},
                     {"e_time": 1, "label": "finish"}],
  "protocol_id": 3356,
  "set_repeats": "#l0",
  "share": 1,
  "v_arrays": [[100, 500], [500, 1000, 2000, 1, 30, 15, 20, 40, 80],
               [8000, 6000, 4000], [1000, 4000], [800]]}]

Project Data df

When collecting the protocol information, the protocol name was stored in the protocol_name variable. Now we can use the name to access the dataframe by the protocol name from the df dictionary. In the example, there is only one dataframe inside the df dictionary.

Example: Get a dataframe and it’s information
## Get Protocol's dataframe with its information
data = df[protocol_name]
print(data.info('verbose'))
Output: Information about the selected dataframe
<class 'pandas.core.frame.DataFrame'>
Int64Index: 399 entries, 0 to 398
Data columns (total 14 columns):
#   Column       Non-Null Count  Dtype 
---  ------       --------------  ----- 
0   datum_id     399 non-null    object
1   time         399 non-null    object
2   user_id      399 non-null    object
3   device_id    399 non-null    object
4   status       399 non-null    object
5   notes        399 non-null    object
6   longitude    399 non-null    object
7   latitude     399 non-null    object
8   Plant?       399 non-null    object
9   Replicate #  399 non-null    object
10  set_repeats  399 non-null    object
11  v_arrays     399 non-null    object
12  ri           399 non-null    object
13  set          399 non-null    object
dtypes: object(14)
memory usage: 46.8+ KB

Note

Most of the time, there is only one dataframe inside the df dictionary. But Projects can have multiple Protocols as well as data that was added later on (“Custom Data”), which would be stored in a separate dataframe. You can use the code below to quickly check if there are multiple dataframes in your df dictionary.

print( df.keys() )

Complete Example

To summarize, this is the full example to download MultispeQ data from a Project, view the Project’s information, get the Protocol’s name and code and access the protocols dataframe.

examples/python/project-data.py
"""
Download Project Data from PhotosynQ, Inc.

A local copy of the data frames and the Project Information
gets saved in the same directory as the file executed by default.
"""

import jii_multispeq.project as project
import jii_multispeq.protocol as protocol

email = "your-email@domain.com"
projectId = 29652

## Get the project data and information
df, info = project.get(email, projectId)

## Print the project information
project.print_info(info)

## Get Protocol Name
protocol_name =  protocol.get_protocol_name(info)
print(protocol_name)

## Get Protocol Code
protocol_code = protocol.get_protocol(info)
print(protocol_code)

## Get Protocol's dataframe with its information
data = df[protocol_name]
print(data.info('verbose'))

Download: python script [.py] Jupyter Notebook [.ipynb]