Skip to content

Final Campaign Tab Update from Ashton #203

Merged
merged 1 commit into from Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -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:

Expand All @@ -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
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down