Skip to content
Merged
Show file tree
Hide file tree
Changes from 150 commits
Commits
Show all changes
177 commits
Select commit Hold shift + click to select a range
e3a1b5c
Update read_cropreporter.py
HaleySchuhl Mar 2, 2021
cced615
Update read_cropreporter.py
HaleySchuhl Mar 9, 2021
ed108bb
Update read_cropreporter.py
HaleySchuhl Mar 9, 2021
0263a40
Update read_cropreporter.py
HaleySchuhl Mar 10, 2021
4920e71
MUCH BETTER x and y's match up now
HaleySchuhl Mar 10, 2021
c55974c
Update read_cropreporter.py
HaleySchuhl Mar 16, 2021
afff374
Update read_cropreporter.py
HaleySchuhl Mar 30, 2021
7ffed73
Update read_cropreporter.py
HaleySchuhl Mar 31, 2021
91f6945
Update read_cropreporter.py
HaleySchuhl Apr 13, 2021
ac4e54d
Update read_cropreporter.py
HaleySchuhl Apr 13, 2021
2111ead
Update read_cropreporter.py
HaleySchuhl Apr 13, 2021
68ff55c
Update read_cropreporter.py
HaleySchuhl Apr 13, 2021
d3504b1
Merge branch 'master' into update-crop_reporter
HaleySchuhl Apr 13, 2021
afecd87
Update read_cropreporter.py
HaleySchuhl Apr 13, 2021
6d81f60
Update analyze_fvfm.py
HaleySchuhl Apr 13, 2021
b5e4f2d
Update read_cropreporter.py
HaleySchuhl Apr 13, 2021
eafc68f
Update __init__.py
HaleySchuhl Apr 13, 2021
59eb3b9
Create analyze_npq.py
HaleySchuhl Apr 13, 2021
2440b25
Update analyze_fvfm.py
HaleySchuhl Apr 13, 2021
a869644
Update analyze_npq.py
HaleySchuhl Apr 13, 2021
bcfcdfe
Update analyze_fvfm.py
HaleySchuhl Apr 13, 2021
712e298
Update analyze_npq.py
HaleySchuhl Apr 13, 2021
77217dd
Update analyze_fvfm.py
HaleySchuhl Apr 13, 2021
9f6da7c
Update analyze_npq.py
HaleySchuhl Apr 13, 2021
c7ffdba
Update read_cropreporter.py
HaleySchuhl Apr 13, 2021
81ec11b
Update tests.py
HaleySchuhl Apr 13, 2021
c0311ea
Update requirements.txt
HaleySchuhl Apr 14, 2021
05622e5
Update read_cropreporter.py
HaleySchuhl Apr 14, 2021
3c2cac0
Update tests.py
HaleySchuhl Apr 15, 2021
a737642
Update tests.py
HaleySchuhl Apr 15, 2021
aa5bad8
Update tests.py
HaleySchuhl Apr 15, 2021
5ffb45b
Update analyze_fvfm.py
HaleySchuhl Apr 15, 2021
1a40df0
Update tests.py
HaleySchuhl Apr 15, 2021
8361fa4
Update tests.py
HaleySchuhl Apr 15, 2021
afd9cb1
Update photosynthesis_analyze_fvfm.md
HaleySchuhl Apr 16, 2021
989e8dc
Update photosynthesis_read_cropreporter.md
HaleySchuhl Apr 16, 2021
1ef93c6
Update updating.md
HaleySchuhl Apr 16, 2021
c876054
Update updating.md
HaleySchuhl Apr 16, 2021
91db1d9
Create photosyntthesis_analyze_npq.md
HaleySchuhl Apr 16, 2021
4d35e00
Update tests.py
HaleySchuhl Apr 16, 2021
43a390f
Update tests.py
HaleySchuhl Apr 16, 2021
6e28241
Update analyze_fvfm.py
HaleySchuhl Apr 16, 2021
66c645f
Update analyze_fvfm.py
HaleySchuhl Apr 20, 2021
83b7249
Update tests.py
HaleySchuhl Apr 20, 2021
d901629
Update tests.py
HaleySchuhl Apr 20, 2021
8ffe410
Update tests.py
HaleySchuhl Apr 23, 2021
9d6816f
trying to get tests to pass, add print statement
HaleySchuhl Apr 23, 2021
9857566
NPQ
HaleySchuhl Apr 23, 2021
afc9fd2
update mask size
HaleySchuhl Apr 23, 2021
631159b
update mask
HaleySchuhl Apr 27, 2021
60000f0
Update tests.py
HaleySchuhl Apr 27, 2021
788f891
temp print statements
HaleySchuhl Apr 27, 2021
b3f4180
Update tests.py
HaleySchuhl Apr 27, 2021
0b1de7d
Update analyze_npq.py
HaleySchuhl Apr 27, 2021
cf93f7d
Update tests.py
HaleySchuhl Apr 27, 2021
aff63b0
Update read_cropreporter.py
HaleySchuhl Apr 27, 2021
cd07419
Update tests.py
HaleySchuhl Apr 27, 2021
b60c355
Update tests.py
HaleySchuhl Apr 27, 2021
06a84ca
Merge branch 'master' into march21-update-crop_reporter
HaleySchuhl Apr 27, 2021
38a4209
found my problem finallyyy
HaleySchuhl Apr 27, 2021
4c393ca
Update read_cropreporter.py
HaleySchuhl Apr 27, 2021
40b6e10
Update tests.py
HaleySchuhl Apr 27, 2021
3699562
move to xarray calculated method
HaleySchuhl Apr 27, 2021
66b7b18
Update tests.py
HaleySchuhl Apr 27, 2021
7315211
Update analyze_npq.py
HaleySchuhl Apr 29, 2021
44a5ce0
Update analyze_fvfm.py
HaleySchuhl Apr 29, 2021
cd3e7f8
Update __init__.py
HaleySchuhl Apr 29, 2021
265b4fc
change back to calculating frames with numpy arrays
HaleySchuhl Apr 29, 2021
27b0a92
Update __init__.py
HaleySchuhl Apr 29, 2021
816ca5f
Update analyze_npq.py
HaleySchuhl Apr 29, 2021
a13b11c
Merge branch 'master' into march21-update-crop_reporter
nfahlgren May 11, 2021
f7a2101
Minor updates
nfahlgren May 11, 2021
6c3bf92
Code style updates
nfahlgren May 11, 2021
5c26b87
Refactor read INF file metadata
nfahlgren May 11, 2021
c8c25e6
Refactor to parse INF filename once
nfahlgren May 11, 2021
58e509a
Remove print/plot from test
nfahlgren May 11, 2021
f62a420
Update docstring
nfahlgren May 12, 2021
d12c6b6
Change DataArray from da to ps
nfahlgren May 12, 2021
d719863
Label all photosynthesis frames
nfahlgren May 13, 2021
22bc9e2
Use debug for each measurement set
nfahlgren May 13, 2021
3a107a2
Assert shape matches
nfahlgren May 13, 2021
c1ebfe3
Change function signature
nfahlgren May 13, 2021
e480563
Remove device counter
nfahlgren May 13, 2021
5cb240b
Analyze dark and light adapted protocols
nfahlgren May 13, 2021
24f6314
Remove other labels
nfahlgren May 13, 2021
3dd8856
Update cropreporter docs
nfahlgren May 13, 2021
c8befba
Update fvfm tests
nfahlgren May 13, 2021
6ff0f5c
Update fvfm docs
nfahlgren May 13, 2021
25b4397
Update function signatures
nfahlgren May 14, 2021
deae117
Change keyword from data to ps
nfahlgren May 14, 2021
30ab0cf
Remove device counter
nfahlgren May 14, 2021
f08363a
Use attributes to select Fm and Fmp frames
nfahlgren May 14, 2021
d8e046e
Remove fdark QC
nfahlgren May 14, 2021
bd17ff5
First PSL frame is white light
nfahlgren May 14, 2021
e73d078
Add attribute for F'
nfahlgren May 14, 2021
a53afee
Add F0 attribute
nfahlgren May 14, 2021
e7c04b8
Refactor fvfm to yii
nfahlgren May 14, 2021
c2df563
Update docs for analyze_yii
nfahlgren May 14, 2021
e7c1941
Update analyze_npq
nfahlgren May 14, 2021
2de647b
Use full dataset for test
nfahlgren May 14, 2021
1266c32
NPQ calculation maintains image shape
nfahlgren May 14, 2021
108078d
Update NPQ scaling
nfahlgren May 14, 2021
7fa1a81
Update NPQ docs
nfahlgren May 14, 2021
07cb0c8
Update npq function signature
nfahlgren May 14, 2021
5bebdae
New PSII tutorial
nfahlgren May 14, 2021
33a08cc
Add npq to output measurements
nfahlgren May 15, 2021
2e7d56a
Update updating.md
HaleySchuhl May 21, 2021
85fe74c
create psII_data class and update read_cropreporter with new data format
Jun 17, 2021
375ddc6
add plot method for xarray types to plot_image and error if type is u…
Jun 17, 2021
ef54e88
switch to isinstance and formatting
Jun 17, 2021
f1b564e
formatting
Jun 17, 2021
d52ee55
isinstance and formatting
Jun 17, 2021
67ac563
analyze_yii for new data format
Jun 18, 2021
e361678
copy analyze_yii to analyze_npq
Jun 18, 2021
af8edf1
add input and update private function to compute npq
Jun 18, 2021
9be392b
add frame_nums to lightadapted
Jun 21, 2021
4b838ac
doc updates
Jun 21, 2021
0f183bb
rename outputs to match other analyze scripts
Jun 21, 2021
665790d
whitespace
Jun 21, 2021
9b2654a
update tests
Jun 30, 2021
171b9c3
formatting
Jun 30, 2021
162dc94
pretty print string PSII_data()
Jun 30, 2021
52b7297
Merge branch 'master' into march21-update-crop_reporter-multiplemeasu…
dschneiderch Jun 30, 2021
1a96953
doc updates
Jun 30, 2021
d70aa7b
PSII_data update __repr__
Jun 30, 2021
8cf6968
simplify test analyze_yii
Jun 30, 2021
872a4de
Merge branch 'march21-update-crop_reporter-multiplemeasurements' of h…
Jun 30, 2021
ee259ee
cover PSII_data repr
Jun 30, 2021
b94278d
mix missing chl read
Jun 30, 2021
cd6c0a6
plot and print for PSII and xarray data
Jun 30, 2021
b714b21
formatting
Jun 30, 2021
1c5ea42
doc updates
Jun 30, 2021
a08307b
formatting
Jun 30, 2021
934ac82
fix test for psii_data class
Jun 30, 2021
37b0b0b
check inputs to analyze_* and tests
Jun 30, 2021
88af287
add debug for yii and npq images
Jun 30, 2021
bb8936b
swap outputs
Jun 30, 2021
dddf2ca
reassign_frame_labels and tests
Jun 30, 2021
fbb1db6
fix debug plots and drop frame coords robustly for different # measur…
Jul 1, 2021
74408ab
correct order of outputs in docs
Jul 1, 2021
633b3b1
add walz data to tests to catch issues with dropped dims
Jul 1, 2021
a481242
Merge branch 'master' into march21-update-crop_reporter-multiplemeasu…
dschneiderch Jul 1, 2021
01080b4
Merge branch 'master' into march21-update-crop_reporter-multiplemeasu…
nfahlgren Jul 14, 2021
7b286d4
Merge branch '4.x' into march21-update-crop_reporter-multiplemeasurem…
nfahlgren Jul 14, 2021
ea0f3f3
Refactor imgpath and inf_filename as attributes
nfahlgren Jul 14, 2021
96a2ebc
Remove unused variable
nfahlgren Jul 14, 2021
22d71ab
Use lowercase var names
nfahlgren Jul 14, 2021
2c1f0da
Relabel chlorophyll dataset
nfahlgren Jul 14, 2021
ecd4fda
Refactor read_cropreporter into modules
nfahlgren Jul 15, 2021
2ee7182
Add test for SPC only dataset
nfahlgren Jul 15, 2021
5f5cbd8
Update read_cropreporter docs
nfahlgren Jul 15, 2021
4337d3b
update debug to show frames in read_cropreporter
Jul 15, 2021
89cfe13
Merge branch 'march21-update-crop_reporter-multiplemeasurements' of h…
nfahlgren Jul 15, 2021
52e7060
Add missing debug to process spectral function
nfahlgren Jul 15, 2021
1410d0a
add dpi support to facetGrid print_image
Jul 15, 2021
96e4761
Merge branch 'march21-update-crop_reporter-multiplemeasurements' of h…
nfahlgren Jul 15, 2021
22449c0
Split strings into multiple lines
nfahlgren Jul 15, 2021
7301e8c
Refactored debug plotting
nfahlgren Jul 15, 2021
3567df4
Fix input type
nfahlgren Jul 15, 2021
5b37bf9
Fix xarray plot test
nfahlgren Jul 15, 2021
5981f8f
adapt debug images to work for data arrays with varying length dims
Jul 16, 2021
11f99e3
avoid circular import of _show_dataarray
Jul 16, 2021
19c085e
add col arg to print_image test so a facetgrid is created isntead of …
Jul 16, 2021
ba09d10
limit xr dataarray plots to pcolormesh
Jul 19, 2021
c2556c6
Update function to keep frame labels
nfahlgren Jul 19, 2021
fb36075
Add xarray to conda environment
nfahlgren Jul 21, 2021
a6f84c9
Remove unused vars
nfahlgren Jul 21, 2021
1a6817b
Fix minor formatting/var name issues
nfahlgren Jul 21, 2021
6977c58
Minor code formatting/var name updates
nfahlgren Jul 21, 2021
e73dfb9
Minor PEP8 updates
nfahlgren Jul 21, 2021
86d5b97
PEP8 updates
nfahlgren Jul 21, 2021
181b910
Update function changelog
nfahlgren Jul 21, 2021
5de1903
Fix function var typo
nfahlgren Jul 21, 2021
48ada02
Add debug plot images to docs
nfahlgren Jul 21, 2021
0d7478b
Minor updates
nfahlgren Jul 21, 2021
2d6d53a
Add docs for reassign_frame_label
nfahlgren Jul 21, 2021
ed73875
Update psII tutorial
nfahlgren Jul 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/analysis_approach.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ These are the general categories of object analysis that are available in PlantC
* Object shape parameters: see the [analyze shape](analyze_shape.md) and [analyze bound](analyze_bound_horizontal.md) functions.
* Object color or other signal intensity values: see the [analyze color](analyze_color.md),
[analyze NIR](analyze_NIR_intensity.md), [analyze thermal](analyze_thermal_values.md),
and [analyze FvFm](photosynthesis_analyze_fvfm.md) functions.
and [analyze FvFm](photosynthesis_analyze_yii.md) functions.
* Object classification (For example, classification of disease symptoms, identification of organ structures
[naive-bayesian multiclass mode](naive_bayes_multiclass.md)).
* Object hyperspectral parameters: see the [analyze spectral](analyze_spectral.md) and [analyze index](analyze_index.md) functions.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/img/documentation_images/fluor_fvfm/fdark.jpg
Binary file not shown.
Binary file removed docs/img/documentation_images/fluor_fvfm/fmax.jpg
Binary file not shown.
Binary file removed docs/img/documentation_images/fluor_fvfm/fmin.jpg
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/img/tutorial_images/psII/eroded_plant_mask.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/tutorial_images/psII/f0_img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/tutorial_images/psII/f0_otsu_mask.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/img/tutorial_images/psII/fdark2.png
Binary file not shown.
Binary file removed docs/img/tutorial_images/psII/filled_plant_mask2.png
Binary file not shown.
Binary file removed docs/img/tutorial_images/psII/fmax2.png
Binary file not shown.
Binary file removed docs/img/tutorial_images/psII/fmax_rescaled2.png
Binary file not shown.
Binary file removed docs/img/tutorial_images/psII/fmin2.png
Binary file not shown.
Binary file removed docs/img/tutorial_images/psII/fvfm_hist2.png
Binary file not shown.
Binary file removed docs/img/tutorial_images/psII/id_obj2.png
Diff not rendered.
Binary file removed docs/img/tutorial_images/psII/objcomp2.png
Diff not rendered.
Binary file removed docs/img/tutorial_images/psII/plant_mask2.png
Diff not rendered.
Binary file removed docs/img/tutorial_images/psII/pseudocolored.png
Diff not rendered.
Binary file removed docs/img/tutorial_images/psII/shapes2.png
Diff not rendered.
25 changes: 16 additions & 9 deletions docs/output_measurements.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,22 @@ suggestions for additional metadata we should track that would be useful to you,

## Output Observations

Functions that automatically store data to the [`Outputs` class](outputs.md) are [acute_vertex](acute_vertex.md), [analyze_color](analyze_color.md),
[analyze_bound_horizontal](analyze_bound_horizontal.md), [analyze_bound_vertical](analyze_bound_vertical.md), [analyze_nir_intensity](analyze_NIR_intensity),
[analyze_object](analyze_shape.md), [analyze_thermal_values](analyze_thermal_values.md), [photosynthesis.analyze_fvfm](photosynthesis_analyze_fvfm.md), [hyperspectral.analyze_spectral](analyze_spectral.md),
[hyperspectral.analyze_index](analyze_index.md), [landmark_reference_pt_dist](landmark_reference_pt_dist.md), [morphology.check_cycles](check_cycles.md),
[morphology.fill_segments](fill_segments.md), [morphology.find_tips](find_tips.md), [morphology.find_branch_pts](find_branch_pts.md), [morphology.segment_angle](segment_angle.md),
[morphology.segment_curvature](segment_curvature.md), [morphology.segment_euclidean_length](segment_euclidean_length.md),
[morphology.segment_insertion_angle](segment_insertion_angle.md), [morphology.segment_path_length](segment_pathlength.md),
[morphology.segment_tangent_angle](segment_tangent_angle.md), [report_size_marker_area](report_size_marker.md), [watershed_segmentation](watershed.md),
[within_frame](within_frame.md), [x_axis_pseudolandmarks](x_axis_pseudolandmarks.md), and [y_axis_pseudolandmarks](y_axis_pseudolandmarks.md). All of these functions include an optional `label` parameter
Functions that automatically store data to the [`Outputs` class](outputs.md) are [acute_vertex](acute_vertex.md),
[analyze_color](analyze_color.md), [analyze_bound_horizontal](analyze_bound_horizontal.md),
[analyze_bound_vertical](analyze_bound_vertical.md), [analyze_nir_intensity](analyze_NIR_intensity),
[analyze_object](analyze_shape.md), [analyze_thermal_values](analyze_thermal_values.md),
[photosynthesis.analyze_fvfm](photosynthesis_analyze_yii.md),
[photosynthesis.analyze_npq](photosynthesis_analyze_npq.md), [hyperspectral.analyze_spectral](analyze_spectral.md),
[hyperspectral.analyze_index](analyze_index.md), [landmark_reference_pt_dist](landmark_reference_pt_dist.md),
[morphology.check_cycles](check_cycles.md), [morphology.fill_segments](fill_segments.md),
[morphology.find_tips](find_tips.md), [morphology.find_branch_pts](find_branch_pts.md),
[morphology.segment_angle](segment_angle.md), [morphology.segment_curvature](segment_curvature.md),
[morphology.segment_euclidean_length](segment_euclidean_length.md),
[morphology.segment_insertion_angle](segment_insertion_angle.md),
[morphology.segment_path_length](segment_pathlength.md), [morphology.segment_tangent_angle](segment_tangent_angle.md),
[report_size_marker_area](report_size_marker.md), [watershed_segmentation](watershed.md),
[within_frame](within_frame.md), [x_axis_pseudolandmarks](x_axis_pseudolandmarks.md), and
[y_axis_pseudolandmarks](y_axis_pseudolandmarks.md). All of these functions include an optional `label` parameter
that allows users to append custom prefixes to the unique variable identifier.

For more detail about the traits measured by each function see the [Observation Traits Summary Table](https://docs.google.com/spreadsheets/d/1gk5VocBA-63gyF_vA6yPNvWreZ1R7-_z4vOfm37YBl8/edit?usp=sharing).
70 changes: 0 additions & 70 deletions docs/photosynthesis_analyze_fvfm.md

This file was deleted.

58 changes: 58 additions & 0 deletions docs/photosynthesis_analyze_npq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
## Analyze Nonphotochemical Quenching of Photosystem II

Extract estimates of the nonphotochemical quenching (NPQ) of Photosystem II (PSII).
Calculates (Fm/Fm') - 1 data from a masked region. The photosynthesis subpackage is dependent on a PSII_Data instance file structure as created by photosynthesis.read_* files.

**plantcv.photosynthesis.analyze_npq**(*ps_da_light, ps_da_dark, mask, bins=256, measurement_labels = None, label="default"*)

**returns** Histogram of NPQ values and an NPQ image

- **Parameters:**
- ps_da_light - photosynthesis xarray DataArray for which to compute npq
- ps_da_dark - photosynthesis xarray DataArray that contains frame_label `Fm`
- mask - binary mask of selected contours
- bins - number of grayscale bins (0-256 for 8-bit images and 0 to 65,536), if you would like to bin data, you
would alter this number (default bins=256)
- measurement_labels - list of label(s) for each measurement in `ps_da_light`, modifies the variable name of observations recorded
- label - Optional label parameter, modifies the entity name of observations recorded. (default `label="default"`)
- **Context:**
- Used to extract NPQ per identified plant pixel.
- Generates histogram of NPQ values.
- Generates an NPQ image.
- **Example use:**
- [Use In PSII Tutorial](psII_tutorial.md)
- **Output data stored:** Data ('npq_hist_{measurement_label}', 'npq_max_{measurement_label}', 'npq_median_{measurement_label}') are automatically stored to the
[`Outputs` class](outputs.md) when this function is run. These data can be accessed during a workflow (example below). `{measurement_label}` is automatically created when importing the dataset, e.g. with `read_cropreporter()` but can be overwritten with `measurement_labels` argument.
[Summary of Output Observations](output_measurements.md#summary-of-output-observations)

```python
from plantcv import plantcv as pcv

# Set global debug behavior to None (default), "print" (to file),
# or "plot" (Jupyter Notebooks or X11)
pcv.params.debug = "print"

# Analyze NPQ
npq, npq_hist = pcv.photosynthesis.analyze_npq(ps_da_light=ps.lightadapted, ps_da_dark=ps.darkadapted, mask=kept_mask, bins=256, label="fluor")

# Access data stored out from fluor_NPQ
# the default measurement label for cropreporter data is t1
npq_median = pcv.outputs.observations['fluor']['npq_median_t1']['value']

# Pseudocolor the NPQ image
pseudo_img = pcv.visualize.pseudocolor(gray_img=npq, mask=kept_mask, min_value=0, max_value=1, title="NPQ")

```

**Histogram of NPQ values**

![Screenshot](img/documentation_images/analyze_npq/npq_histogram.png)

**Pseudocolored output image based on NPQ**

![Screenshot](img/documentation_images/analyze_npq/npq_colormap.png)

The grayscale NPQ image can be used with the [pcv.visualize.pseudocolor](visualize_pseudocolor.md) function
which allows the user to pick a colormap for plotting.

**Source Code:** [Here](https://github.com/danforthcenter/plantcv/blob/master/plantcv/plantcv/photosynthesis/analyze_npq.py)
105 changes: 105 additions & 0 deletions docs/photosynthesis_analyze_yii.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
## Analyze the efficiency of Photosystem II

Extract estimates of the efficiency (YII) of Photosystem II (PSII). The photosynthesis subpackage is dependent on a PSII_Data instance file structure as created by photosynthesis.read_* files.

**plantcv.photosynthesis.analyze_yii**(*ps_da, mask, bins=256, measurement_labels=None, label="default"*)

**returns** YII histogram, and YII image

- **Parameters:**
- ps_da - photosynthesis xarray DataArray for which to compute yii. Can either have a pair of frames F0,Fm or pair(s) of Fp,Fmp
- mask - binary mask of plant
- bins - number of grayscale bins (0-256 for 8-bit images and 0 to 65,536), if you would like to bin data, you would alter this number (default bins=256)
- measurement_labels - list of label(s) for each measurement, modifies the default variable names of observations. must have same length as number of measurements in ps_da
- label - Optional label parameter, modifies the entity name of observations recorded. (default `label="default"`)
- **Context:**
- Used to extract Fv/Fm, Fv'/Fm' or Fq'/Fm' per identified plant pixel.
- Generates histogram of Fv/Fm, Fv'/Fm' or Fq'/Fm' data.
- Generates an Fv/Fm, Fv'/Fm' or Fq'/Fm' image.
- **Example use:**
- [Use In PSII Tutorial](psII_tutorial.md)
- **Output data stored:** Data ('yii_hist_{measurement_label}', 'yii_max_{measurement_label}', 'yii_median_{measurement_label}' automatically gets stored to the
[`Outputs` class](outputs.md) when this function is run. These data can always get accessed during a workflow
(example below). [Summary of Output Observations](output_measurements.md#summary-of-output-observations)

**Fluorescence images**

![Screenshot](img/documentation_images/fluor_fvfm/fvfm_images.jpg)

From top-left to bottom-right: Dark-adapted (Fdark, F0, Fm) and Light-adapted (Flight', F', and Fm')

**Analyze Fv/Fm**

```python
from plantcv import plantcv as pcv

# Set global debug behavior to None (default), "print" (to file),
# or "plot" (Jupyter Notebooks or X11)
pcv.params.debug = "print"

# photosynthesis read functions will read fluroescence data into predefined data format that includes at least attribute 'darkadapted'
ps = pcv.photosynthesis.read_cropreporter(filename = "mydata.inf")

# Analyze Fv/Fm
fvfm, fvfm_hist = pcv.photosynthesis.analyze_yii(ps_da=ps.darkadapted,
mask=kept_mask,
measurement_labels=["Fv/Fm"],
bins=256,
label="fluor")

# Access data stored out from fluor_fvfm
fvfm_median = pcv.outputs.observations['fluor']['yii_median_Fv/Fm']['value']

# Pseudocolor the Fv/Fm image
fvfm_cmap= pcv.visualize.pseudocolor(gray_img=fvfm, mask=kept_mask, min_value=0, max_value=1, title="Fv/Fm")

# or you can use xarray builtin plot methods (output not shown):
fvfm.plot()
```

**Histogram of Fv/Fm values**

![Screenshot](img/documentation_images/fluor_fvfm/fvfm_histogram.png)

**Pseudocolored output image based on Fv/Fm**

![Screenshot](img/documentation_images/fluor_fvfm/fvfm_colormap.png)

**Analyze Fq'/Fm' (lightadapted mesaurements)**

```python
from plantcv import plantcv as pcv

# Set global debug behavior to None (default), "print" (to file),
# or "plot" (Jupyter Notebooks or X11)
pcv.params.debug = "print"

# Analyze Fq'/Fm'
fqfm, fqfm_hist = pcv.photosynthesis.analyze_yii(ps=ps.lightadapted, mask=kept_mask,
bins=256,
measurement_labels=["Fq'/Fm'"],
label="fluor")

# Access data stored out from fluor_fvfm
fqfm_median = pcv.outputs.observations['fluor']["yii_median_Fq'/Fm'"]['value']

fqfm_cmap= pcv.visualize.pseudocolor(gray_img=fqfm, mask=kept_mask, min_value=0, max_value=1, title="Fq'/Fm'")

# or xarray plot method (output not shown)
fqfm.plot(row = 'measurement', col_wrap = 3)
# or
fqfm.plot(col_wrap='measurement')
```

**Histogram of Fq'/Fm' values**

![Screenshot](img/documentation_images/fluor_fvfm/fqfm_histogram.png)

**Pseudocolored output image based on Fq'/Fm'**

![Screenshot](img/documentation_images/fluor_fvfm/fqfm_colormap.png)

The grayscale YII images can be used with the [pcv.visualize.pseudocolor](visualize_pseudocolor.md) function
which allows the user to pick a colormap for plotting.

**Source Code:** [Here](https://github.com/danforthcenter/plantcv/blob/master/plantcv/plantcv/photosynthesis/analyze_yii.py)
24 changes: 15 additions & 9 deletions docs/photosynthesis_read_cropreporter.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
## Read CropReporter Fluorescence Image Files

Reads .DAT image data into numpy ndarray and reshapes the frames into a datacube before identifying and extracting `fdark`, `fmin`, and `fmax` as separate numpy ndarrays.
Reads .INF/.DAT image data into a PSII_data instance containing xarray DataArrays with labeled frames.

**plantcv.photosynthesis.read_cropreporter**(*filename*)

**returns** fdark, fmin, fmax
**returns** ps

- **Parameters:**
- filename - image file to be read (possibly including a path)
- filename - INF metadata file to be read (possibly including a path). DAT files are automatically detected.

- **Context:**
- Reads in file to be processed and does so using the metadata contained within a corresponding .INF file
- Reads in binary image files to be processed and does so using the metadata contained within a corresponding .INF file. Measurements from dark-adapted plant state are stored in the attribute `darkadapted`. Frames F0 and Fm are labeled according to the metadata in .inf. The default measurement label is 't0'. Measurements from light-adapted plant state are stored in the attribute `lightadapted`. Frames Fp and Fmp are labeled according to the metadata in .inf. The default measurement label is 't1'.
- **Notes:**
- This function assumes a specific pattern between .DAT image files and their corresponding .INF file.
We assume that for every image file `xx_PSD_xxx.DAT` there will be a corresponding metadata file with the same path
named `xx_HDR_xxx.INF`
- This function assumes a specific pattern between .INF metadata file and their corresponding .DAT binary image filenames.
We assume that for every metadata file `xx_HDR_xxx.INF` there will be a corresponding image files with the same path
named `xx_XXX_xxx.DAT` where XXX is the analysis protocol (e.g. PSD, PSL, etc.). Some crop reporter imaging protocols will results in multiple binary image .DAT files per .INF metadata file.
- **Example use:**
- [Use In PSII Tutorial](psII_tutorial.md)

Expand All @@ -27,8 +27,14 @@ from plantcv import plantcv as pcv
pcv.params.debug = "print"

#read in image
fdark, fmin, fmax = pcv.photosynthesis.read_cropreporter(filename="PSII_PSD_20200826_22_rep6.DAT")
ps = pcv.photosynthesis.read_cropreporter(filename="PSII_HDR_20200826_22_rep6.INF")

# you can check which variables were imported at the prompt with:
ps

# to see the frames you imported use xarray plot methods e.g.
ps.darkadapted.plot(col='frame_label', col_wrap=4)

```

**Source Code:** [Here](https://github.com/danforthcenter/plantcv/blob/master/plantcv/plantcv/photosynthesis/read_dat.py)
**Source Code:** [Here](https://github.com/danforthcenter/plantcv/blob/master/plantcv/plantcv/photosynthesis/read_cropreporter.py)
2 changes: 1 addition & 1 deletion docs/print_image.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Write image to the file specified. This is a wrapper for the OpenCV function [im
for numpy arrays (like the images that get returned by most PlantCV functions), and can handle matplotlib Figures (like the one returned by [pcv.visualize.pseudocolor](visualize_pseudocolor.md))
and plotnine ggplots (like the histograms returned in [pcv.analyze_nir_intensity](analyze_NIR_intensity.md),
[pcv.analyze_color](analyze_color.md), [pcv.visualize.histogram](visualize_histogram.md),
and [pcv.photosynthesis.analyze_fvfm](photosynthesis_analyze_fvfm.md)).
and [pcv.photosynthesis.analyze_yii](photosynthesis_analyze_yii.md)).

**plantcv.print_image**(*img, filename*)

Expand Down
Loading