diff --git a/AppRelated/CampaignQuestionFolder/CampaignQuestionNotebookAshton.Rmd b/AppRelated/CampaignQuestionFolder/CampaignQuestionNotebookAshton.Rmd index 2ff1620..3b6aa08 100644 --- a/AppRelated/CampaignQuestionFolder/CampaignQuestionNotebookAshton.Rmd +++ b/AppRelated/CampaignQuestionFolder/CampaignQuestionNotebookAshton.Rmd @@ -3,39 +3,41 @@ title: "DAR F24 How do Campaigns Compare?" author: "Ashton Compton" date: "`r Sys.Date()`" output: - html_document: - toc: yes pdf_document: toc: yes + html_document: + toc: yes subtitle: "DAR Project Name: Mars" --- Note - This notebook is meant as a draft for a page in the Mars Mission Minder 2D app addressing the topic of campaigns. +Note - Below code contains code for generating the pictures below and creates more updated plots. + Question - "What is the difference between samples from the two campaigns Delta Front and Crater Floor?" Every sample from the Perseverance Rover is assigned a campaign. For this analysis, the two accessible campaigns were Delta Front and Crater Floor. Crater Floor is where Perseverance landed, and is a flat open plain. Next the rover traveled to a Delta Fan structure and began climbing it. Samples taken at the beginning of this journey belong to Delta Front. -Title: Map of Samples Annotating the Two Campaigns +Title: Total Mineral Occurrence with Samples grouped by Campaign -![campaigns Map](~/DAR-Mars-F24/AppRelated/CampaignQuestionFolder/Pics/marsmap.png) +![Lithology Count](~/DAR-Mars-F24/AppRelated/CampaignQuestionFolder/Pics/sherlocCount.png) -Description: Map showing the first 16 Perserverance Samples with the Crater Floor and Delta Front regions annotated. +Description: From the SHERLOC dataset, samples were grouped by campaign. Then the total count of each mineral occurrence was graphed using the grouped data. +Title: Sample Compound Distributions, Samples grouped by Campaign -Title: Counting Mineral Occurrence across Samples separated by Campaign +![pixl distribution](~/DAR-Mars-F24/AppRelated/CampaignQuestionFolder/Pics/pixlDis.png) +Description: From PIXL dataset, samples were grouped by campaign. Then the distribution of each compound measured in PIXL was graphed using the grouped data. -![Lithology Count](~/DAR-Mars-F24/AppRelated/CampaignQuestionFolder/Pics/sherlocCount.png) -Description: Sherloc was grouped by campaign and the total value of each feature across all samples was summed up and displayed in the above plot. If a feature had a value of zero for every sample, it was not included in the plot. +Title: Sample Compound Distributions, Samples grouped by Campaign -Title: Pixl Feature Distribution by Campaign +![Libs](~/DAR-Mars-F24/AppRelated/CampaignQuestionFolder/Pics/libs.png) -![pixl distribution](~/DAR-Mars-F24/AppRelated/CampaignQuestionFolder/Pics/pixlDis.png) -Description: Box plots showing the distribution of each feature in Pixl, seperated by Campaign. Note: Sort low to high +Description: LIBS points within 7 meters of a sample were selected and then grouped by their campaign. The distributions of each compound measured in LIBS were plotted using the filtered and grouped data. -Title: Libs clustering with Pixl data seperated by campaign on Ternairy Diagram +Title: Cation Compositions of LIBS and PIXL points ![LibsandPixl](~/DAR-Mars-F24/AppRelated/CampaignQuestionFolder/Pics/tern.png) -Description: Libs data was clustered and ternairy plotted along with Pixl data separated by campaign. The Pixl data points are labelled by name as well. Note-Use the common clusters and use the non-aggregate plot +Description: Cation compositions of each point in LIBS and each sample in PIXL were calculated, then plotted with LIBS points grouped by clusters and PIXL samples grouped by campaign. Conclusions: @@ -57,6 +59,8 @@ There are 20 minerals that are exclusively in either Crater Floor or Delta Front The pixl graph reveals some big differences between Crater Floor and Delta Front. Namely in Al2O3, CaO, Cr2O3, MgO, P2O5, SO3, & SiO2 +Ternary graph captures trend from Igneous to Sedimentary rock following decrease in Silicon + Aluminum + CODE: Load libaries Set up dataframes/matrices @@ -171,6 +175,8 @@ pixl.df$campaign <- meta.df$Campaign # # Make the matrix of just mineral percentage measurements # pixl.matrix <- pixl.df[,2:14] +#Do Libs +libs.df <- readRDS("~/DAR-Mars-F24/StudentData/v1_libs_to_sample.Rds") ### # Read in data as provided. sherloc_abrasion_raw <- readRDS("/academics/MATP-4910-F24/DAR-Mars-F24/Data/abrasions_sherloc_samples.Rds") @@ -220,14 +226,6 @@ wssplot <- function(data, nc = 15, seed =10, title="Quality of k-means by Cluste seed <- 14 set.seed ``` -Used as base for map picture -```{r} -#Produce sample map with campaign differences -# pixl_pos.df$Campaign <- meta.df$Campaign -# ggplot(pixl_pos.df, aes(x= Lat, y= Lon, color=Campaign, size=1)) + -# geom_point() + -# theme_classic() -``` Make interactive plotly plot for Lithology ```{r, result02_data} # Include all data processing code (if necessary), clearly commented @@ -250,49 +248,46 @@ p <- ggplot(lithology.df.sorted, aes(x=factor(Feature, levels = (Feature %>% uni geom_col(position=position_dodge(preserve="total"), width=0.6) + theme(panel.grid.major.x=element_blank(), axis.text.x = element_text(angle = 60, vjust = 1.0, hjust=1, size = 12)) + labs(x="", y="Count") + - ggtitle("Sherloc Dataset, Total Mineral Occurance across Samples") + + ggtitle("SHERLOC Dataset, Total Mineral Occurances, Samples grouped by Campaign") + scale_fill_manual(values=c('#d6001c','#54585a')) ggplotly(p, tooltip = c("campaign",'x', "n")) -#Commented out to knit to pdf, picture at top of report -``` -Create similar plot for Sherloc -```{r} -# #Repeat for sherloc -# #Group by campaign & remove metadata -# sherloc.df.sorted <- sherloc.df %>% group_by(Campaign) %>% select(-c(Sample)) -# -# #Turn into long form and only keep positive cases -# sherloc.df.sorted <- sherloc.df.sorted %>% pivot_longer(2:ncol(sherloc.df.sorted),names_to = "Feature", values_to="Factor") %>% filter(Factor == 1) -# -# #Count # of identical cases -# sherloc.df.sorted <- sherloc.df.sorted %>% count(Feature) -# -# #Sort, Crater Floor is High to low & Delta Front is added back in low to high -# sherloc.df.sorted <- sherloc.df.sorted %>% filter(campaign == "Crater Floor") %>% arrange(desc(n)) %>% ungroup() %>% add_row(sherloc.df.sorted %>% filter(campaign == "Delta Front") %>% arrange(n)) -# -# p <- ggplot(sherloc.df.sorted, aes(x=factor(Feature, levels = (Feature %>% unique())), y = n, fill = campaign)) + -# geom_col(position=position_dodge(preserve="total"), width=0.6) + -# theme(panel.grid.major.x=element_blank(), axis.text.x = element_text(angle = 60, vjust = 1.0, hjust=1, size = 12)) + -# labs(x="", y="Count") + -# ggtitle("Sherloc Features Count by Campaign") + -# scale_fill_paletteer_d(palette = "fishualize::Cephalopholis_argus") -# -# ggplotly(p, tooltip = c("campaign",'x', "n")) -# #Commented out to knit to pdf, picture at top of report +#Commented out to knit to pdf, picture at top of report <--------- ``` -Make box plots for pixl and sherloc +Make box plots for pixl ```{R} -#Make box plots +#Make box plot pixl.lf <- pixl.df %>% select(-c(Sample)) %>% pivot_longer(1:13) colnames(pixl.lf)<- c("campaign", "feature", "value") ggplot(data = pixl.lf, aes(x=factor(feature, levels = (feature %>% unique())), y=value, color = campaign)) + geom_boxplot() + scale_y_log10() + - ggtitle("pixl, Compound Distribution by Campaign") + + ggtitle("PIXL, Compound Distribution by Campaign") + labs(x="", y="log10 scale from percent composition") + scale_colour_manual(values=c('#d6001c','#54585a')) ``` + +```{R} +#Make box plot +libs.lf <- libs.df %>% filter(Distance <= 7) %>% select(8:18) %>% select(-c("Lat.pixl","Lon.pixl")) + +colnames(libs.lf)[2:9] <- colnames(pixl.df)[2:9] +colnames(libs.lf)[1] <- "campaign" + +libs.lf <- libs.lf %>% pivot_longer(2:9) +colnames(libs.lf)<- c("campaign", "feature", "value") +ggplot(data = libs.lf, aes(x=factor(feature, levels = (feature %>% unique())), y=value, color = campaign)) + + geom_boxplot() + + scale_y_log10() + + ggtitle("LIBS, Compound Distribution by Campaign") + + labs(x="", y="log10 scale from percent composition") + + scale_colour_manual(values=c('#d6001c','#54585a')) + + +``` +Description: Libs points under 7 meters from a sample. Distribution of compounds with points separated by campaign. + + Code for ternairy plot ```{r} #take the sums of the specific elements diff --git a/AppRelated/CampaignQuestionFolder/CampaignQuestionNotebookAshton.html b/AppRelated/CampaignQuestionFolder/CampaignQuestionNotebookAshton.html index 7b21d70..b6fe87b 100644 --- a/AppRelated/CampaignQuestionFolder/CampaignQuestionNotebookAshton.html +++ b/AppRelated/CampaignQuestionFolder/CampaignQuestionNotebookAshton.html @@ -11,7 +11,7 @@ - + DAR F24 How do Campaigns Compare? @@ -2296,13 +2296,15 @@

DAR F24 How do Campaigns Compare?

DAR Project Name: Mars

Ashton Compton

-

2024-12-10

+

2024-12-15

Note - This notebook is meant as a draft for a page in the Mars Mission Minder 2D app addressing the topic of campaigns.

+

Note - Below code contains code for generating the pictures below and +creates more updated plots.

Question - “What is the difference between samples from the two campaigns Delta Front and Crater Floor?”

Every sample from the Perseverance Rover is assigned a campaign. For @@ -2311,29 +2313,30 @@

2024-12-10

plain. Next the rover traveled to a Delta Fan structure and began climbing it. Samples taken at the beginning of this journey belong to Delta Front.

-

Title: Map of Samples Annotating the Two Campaigns

+

Title: Total Mineral Occurrence with Samples grouped by Campaign

-campaigns Map -
campaigns Map
+Lithology Count +
Lithology Count
-

Description: Map showing the first 16 Perserverance Samples with the -Crater Floor and Delta Front regions annotated.

-

Title: Counting Mineral Occurrence across Samples separated by -Campaign

-

Lithology Count Description: Sherloc was grouped by campaign -and the total value of each feature across all samples was summed up and -displayed in the above plot. If a feature had a value of zero for every -sample, it was not included in the plot.

-

Title: Pixl Feature Distribution by Campaign

-

pixl distribution Description: Box plots showing the -distribution of each feature in Pixl, seperated by Campaign. Note: Sort -low to high

-

Title: Libs clustering with Pixl data seperated by campaign on -Ternairy Diagram

-

LibsandPixl Description: Libs data was clustered and ternairy -plotted along with Pixl data separated by campaign. The Pixl data points -are labelled by name as well. Note-Use the common clusters and use the -non-aggregate plot

+

Description: From the SHERLOC dataset, samples were grouped by +campaign. Then the total count of each mineral occurrence was graphed +using the grouped data.

+

Title: Sample Compound Distributions, Samples grouped by Campaign

+

pixl distribution Description: From PIXL dataset, samples were +grouped by campaign. Then the distribution of each compound measured in +PIXL was graphed using the grouped data.

+

Title: Sample Compound Distributions, Samples grouped by Campaign

+
+Libs +
Libs
+
+

Description: LIBS points within 7 meters of a sample were selected +and then grouped by their campaign. The distributions of each compound +measured in LIBS were plotted using the filtered and grouped data.

+

Title: Cation Compositions of LIBS and PIXL points

+

LibsandPixl Description: Cation compositions of each point in +LIBS and each sample in PIXL were calculated, then plotted with LIBS +points grouped by clusters and PIXL samples grouped by campaign.

Conclusions:

In Sherloc, certain minerals are abundant in both campaigns, especially Crater Floor. -Carbonate is common in both campaigns -Organic @@ -2351,6 +2354,8 @@

2024-12-10

sample, which is absent in this analysis.

The pixl graph reveals some big differences between Crater Floor and Delta Front. Namely in Al2O3, CaO, Cr2O3, MgO, P2O5, SO3, & SiO2

+

Ternary graph captures trend from Igneous to Sedimentary rock +following decrease in Silicon + Aluminum

CODE: Load libaries Set up dataframes/matrices

Prepare data

#Load in data
@@ -2397,6 +2402,8 @@ 

2024-12-10

# # Make the matrix of just mineral percentage measurements # pixl.matrix <- pixl.df[,2:14] +#Do Libs +libs.df <- readRDS("~/DAR-Mars-F24/StudentData/v1_libs_to_sample.Rds") ### # Read in data as provided. sherloc_abrasion_raw <- readRDS("/academics/MATP-4910-F24/DAR-Mars-F24/Data/abrasions_sherloc_samples.Rds") @@ -2492,14 +2499,8 @@

2024-12-10

## } ## .Internal(set.seed(seed, i.knd, normal.kind, sample.kind)) ## } -## <bytecode: 0x558e691d4380> +## <bytecode: 0x559738316f08> ## <environment: namespace:base>
-

Used as base for map picture

-
#Produce sample map with campaign differences
-# pixl_pos.df$Campaign <- meta.df$Campaign
-# ggplot(pixl_pos.df, aes(x= Lat, y= Lon, color=Campaign, size=1)) +
-#   geom_point() +
-#   theme_classic()

Make interactive plotly plot for Lithology

# Include all data processing code (if necessary), clearly commented
 #Start with lithology
@@ -2521,51 +2522,48 @@ 

2024-12-10

geom_col(position=position_dodge(preserve="total"), width=0.6) + theme(panel.grid.major.x=element_blank(), axis.text.x = element_text(angle = 60, vjust = 1.0, hjust=1, size = 12)) + labs(x="", y="Count") + - ggtitle("Sherloc Dataset, Total Mineral Occurance across Samples") + + ggtitle("SHERLOC Dataset, Total Mineral Occurances, Samples grouped by Campaign") + scale_fill_manual(values=c('#d6001c','#54585a')) ggplotly(p, tooltip = c("campaign",'x', "n"))
-
- +
+
#Commented out to knit to pdf, picture at top of report
-

Create similar plot for Sherloc

-
# #Repeat for sherloc
-# #Group by campaign & remove metadata
-# sherloc.df.sorted <- sherloc.df %>% group_by(Campaign) %>% select(-c(Sample))
-# 
-# #Turn into long form and only keep positive cases
-# sherloc.df.sorted <- sherloc.df.sorted %>% pivot_longer(2:ncol(sherloc.df.sorted),names_to = "Feature", values_to="Factor") %>% filter(Factor == 1)
-# 
-# #Count # of identical cases
-# sherloc.df.sorted <- sherloc.df.sorted %>% count(Feature)
-# 
-# #Sort, Crater Floor is High to low & Delta Front is added back in low to high
-# sherloc.df.sorted <- sherloc.df.sorted %>% filter(campaign == "Crater Floor") %>% arrange(desc(n)) %>% ungroup() %>% add_row(sherloc.df.sorted %>% filter(campaign == "Delta Front") %>% arrange(n))
-# 
-# p <- ggplot(sherloc.df.sorted, aes(x=factor(Feature, levels = (Feature %>% unique())), y = n, fill = campaign)) + 
-#   geom_col(position=position_dodge(preserve="total"), width=0.6) +
-#   theme(panel.grid.major.x=element_blank(), axis.text.x = element_text(angle = 60, vjust = 1.0, hjust=1, size = 12)) +
-#   labs(x="", y="Count") +
-#   ggtitle("Sherloc Features Count by Campaign") +
-#   scale_fill_paletteer_d(palette = "fishualize::Cephalopholis_argus")
-# 
-# ggplotly(p, tooltip = c("campaign",'x', "n"))
-# #Commented out to knit to pdf, picture at top of report
-

Make box plots for pixl and sherloc

-
#Make box plots
+

Make box plots for pixl

+
#Make box plot
 pixl.lf <- pixl.df %>% select(-c(Sample)) %>% pivot_longer(1:13)
 colnames(pixl.lf)<- c("campaign", "feature", "value")
 ggplot(data = pixl.lf, aes(x=factor(feature, levels = (feature %>% unique())), y=value, color = campaign)) +
   geom_boxplot() +
   scale_y_log10() +
-  ggtitle("pixl, Compound Distribution by Campaign") +
+  ggtitle("PIXL, Compound Distribution by Campaign") +
   labs(x="", y="log10 scale from percent composition") +
   scale_colour_manual(values=c('#d6001c','#54585a'))
## Warning in scale_y_log10(): log-10 transformation introduced infinite values.
## Warning: Removed 5 rows containing non-finite outside the scale range
 ## (`stat_boxplot()`).
-

-Code for ternairy plot

+

+
#Make box plot
+libs.lf <- libs.df %>% filter(Distance <= 7) %>% select(8:18) %>% select(-c("Lat.pixl","Lon.pixl"))
+
+colnames(libs.lf)[2:9] <- colnames(pixl.df)[2:9]
+colnames(libs.lf)[1] <- "campaign"
+
+libs.lf <- libs.lf %>% pivot_longer(2:9)
+colnames(libs.lf)<- c("campaign", "feature", "value")
+ggplot(data = libs.lf, aes(x=factor(feature, levels = (feature %>% unique())), y=value, color = campaign)) +
+  geom_boxplot() +
+  scale_y_log10() +
+  ggtitle("LIBS, Compound Distribution by Campaign") +
+  labs(x="", y="log10 scale from percent composition") +
+  scale_colour_manual(values=c('#d6001c','#54585a'))
+
## Warning in scale_y_log10(): log-10 transformation introduced infinite values.
+
## Warning: Removed 118 rows containing non-finite outside the scale range
+## (`stat_boxplot()`).
+

+Description: Libs points under 7 meters from a sample. Distribution of +compounds with points separated by campaign.

+

Code for ternairy plot

#take the sums of the specific elements
 pixl_ternary <- pixl.df %>%
   mutate(x=(SiO2+Al2O3)/100,y=(FeOT+MgO)/100,z=(CaO+Na2O+K2O)/100) %>%
diff --git a/AppRelated/CampaignQuestionFolder/CampaignQuestionNotebookAshton.pdf b/AppRelated/CampaignQuestionFolder/CampaignQuestionNotebookAshton.pdf
index 985e965..147e3ce 100644
Binary files a/AppRelated/CampaignQuestionFolder/CampaignQuestionNotebookAshton.pdf and b/AppRelated/CampaignQuestionFolder/CampaignQuestionNotebookAshton.pdf differ
diff --git a/AppRelated/CampaignQuestionFolder/Pics/libs.png b/AppRelated/CampaignQuestionFolder/Pics/libs.png
new file mode 100644
index 0000000..4cbd02d
Binary files /dev/null and b/AppRelated/CampaignQuestionFolder/Pics/libs.png differ