tutorials:analyse-structure
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorials:analyse-structure [2025/06/30 11:40] – [Import: FASTRAK] t | tutorials:analyse-structure [2025/06/30 16:51] (current) – t | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
- | There exists the rare case that you might want to conduct some statistical analysis on the structure of your simulated or measured plant outside of XL and GroIMP. GroIMP' | + | Sometimes, |
Here, we present an example on how to export structures from GroIMP and how to analyze them in R. There, the rTwig library allows for convenient analysis of QSM-like structures, which we will export from GroIMP. | Here, we present an example on how to export structures from GroIMP and how to analyze them in R. There, the rTwig library allows for convenient analysis of QSM-like structures, which we will export from GroIMP. | ||
Line 103: | Line 103: | ||
tree_metrics() provides some useful aggregations that are similar to GroIMP queries, like for example the aggregation of individual cylinder segments into branches. | tree_metrics() provides some useful aggregations that are similar to GroIMP queries, like for example the aggregation of individual cylinder segments into branches. | ||
- | The actual analysis to perform will however heavily depend on the type of your data source and how the data was collected (e.g. biologically meaningful shoot-based data vs. pure geometry acquisitions) | + | The actual analysis to perform will however heavily depend on the type of your data source and how the data was collected (e.g. biologically meaningful shoot-based data vs. pure geometry acquisitions). Supposing you have Fastrak data where every cylinder segment represents a yearly shoot, you could e.g. analyze the yearly apical growth of the stem on several spruce trees like this, just using the raw QSM data: |
+ | <code sas> | ||
+ | library(dplyr) | ||
+ | library(ggplot2) | ||
+ | |||
+ | folder_path <- " | ||
+ | file_list <- list.files(path = folder_path, | ||
+ | qsm_list <- list() | ||
+ | for (file in file_list) { | ||
+ | cyl_data <- read.csv(file) | ||
+ | tree_id <- tools:: | ||
+ | qsm <- reconstruct_qsm( | ||
+ | cylinder = cyl_data, | ||
+ | id = " | ||
+ | branch_order = " | ||
+ | start_x = " | ||
+ | end_x = " | ||
+ | mutate(tree_id = tree_id) | ||
+ | qsm_list[[tree_id]] <- qsm | ||
+ | } | ||
+ | |||
+ | stem_list <- lapply(qsm_list, | ||
+ | qsm %> | ||
+ | filter(branch_order == 0) %>% | ||
+ | arrange(base_distance) %> | ||
+ | mutate(year = 1: | ||
+ | |||
+ | all_stems <- bind_rows(stem_list) | ||
+ | all_years <- sort(unique(all_stems$year)) | ||
+ | all_stems %> | ||
+ | ggplot(., aes(x = year, y=length)) + | ||
+ | geom_point(aes(color = tree_id)) + | ||
+ | geom_smooth(method = " | ||
+ | ggtitle(" | ||
+ | xlab(" | ||
+ | scale_x_continuous(breaks = all_years) + | ||
+ | theme_minimal() | ||
+ | </ | ||
+ | {{: | ||
tutorials/analyse-structure.1751276422.txt.gz · Last modified: 2025/06/30 11:40 by t