DOI: 10.5061/dryad.rv15dv4f7
title: Data and original code for: Polarization and reflectance are linked to climate, size and mechanistic constraints in a group of scarab beetles

description: Beetles exhibit an extraordinary diversity of brilliant and colourful
 appearances and optical effects invisible to humans. Their underlying
 mechanisms have received some attention, but we know little about the
 ecological variables driving their evolution. Here we investigated
 environmental correlates of reflectivity and circular polarization in a
 group of optically diverse beetles (Scarabaeidae–Rutelinae). We quantified
 the optical properties of 261 specimens representing 46 species using
 spectrophotometry and calibrated photographs. Then, we examined
 associations between these properties and environmental variables such as
 temperature, humidity, and vegetation cover, controlling for body size and
 phylogenetic relatedness. Our results showed larger beetles have higher
 visible reflectivity in drier environments. Unexpectedly, near-infrared
 (NIR) reflectivity was not correlated with ecological variables. However,
 we found a correlation between humidity and polarization (chiral
 nanostructures). We identified trade-offs between optical properties:
 beetles without polarization-associated nanostructures had higher NIR
 reflectivity. By contrast, visible reflectivity was negatively correlated
 with the accumulation of pigments such as melanin. Our study highlights
 the value of a macroecological approach for testing alternative hypotheses
 to explain the diversity of optical effects in beetles and to understand
 the link between structure and function.
description: This data set was collected from 261 specimens of Australian scarabs representing
 53 morphs of 46 species and 9 genera of the subfamily Rutelinae and one
 species of the subfamily Melolonthinae. 
 Reflectivity and
 transmissivity were collected with spectroscopy methods. Absorptivity was
 calculated based on these two variables
 Circular polarization was
 studied using calibrated photographs of the beetle specimens in three
 filters, visible light, left-handed polarized visible light, and
 right-handed polarized visible light.
 The length of the beetles was
 calculated from the calibrated photographs and used as an indication of
 size.  Climate data was extracted from ALA and BioClim.
 The original code is attached.  Phylogenetic data was reconstructed from
 published COI data and additional sequences available in
 NCBI Processing: 
 The linearization and
 equalization of the photographs were done with a custom-made protocol in
 MatLab. Most of the processing of the data was done in R
 Statistical Software [v4.1.2]. All the packages used are detailed in the
 annotated code.
description: # Data and original code for: Explaining the diversity of optical effects
 in Christmas beetles: climate, history, and mechanisms
 [https://doi.org/10.5061/dryad.rv15dv4f7](https://doi.org/10.5061/dryad.rv15dv4f7) This data set contains all the original files used in our manuscript. Despite the increasing number of studies on natural photonic structures, we seldom know the biological relevance or ecological drivers of these structures. In this study, we used a macroecological approach to look for potential ecological drivers of unique optical effects in 261 specimens representing 46 species of Australian scarabs, known as Christmas beetles (Scarabaeidae: Rutelinae). This set contains the raw values of reflectance and transmittance measured with spectrometry techniques. As well as the correspondent reflectivity, transmissivity, and absorptivity (integrated across the wavelength range of the solar irradiance). In addition, it contains the raw RGB values extracted from calibrated photographs and used to calculate polarization parameters, as well as the standardization parameters needed to linearize and equalize these RGB values making them comparable across all photographs. These two sets correspond to the characterization of the optical properties of the beetle elytra. This set also contains the Climate and vegetation data collected from Atlas of Living Australia and the Australian Gridded Climate Data (AGCD)/AWAP database (Australian Bureau of Meteorology official dataset for monthly gridded rainfall analysis). These were extracted for the precise locations of our specimens and the months corresponding to the activity period of each species. We also collected the length of each species as a proxy of size. Finally, to explore the correlations between the optical properties and climate while controlling by phylogenetic relatedness, we also assembled a phylogenetic tree with published COI data and NCBI sequences. The results of the phylogenetic reconstruction are also included in this data set. This ReadMe file was generated on 2023-11-10 by Laura Bibiana Ospina-Rozo. Data was collected between 2019 to 2022 in Melbourne Australia. ## Description of the data and file structure ### File List: * ParametersMatLab - 15 text files obtained by our MATLAB linearization and equalization tool. Since they all have the same format, we describe one example below. Their name follows the format: "StandardParamsF01LCP", StandardParams + three characters ( in this case F01) referring to the camera configuration + three characters (LCP) referring to the filter, i.e., visible, left-handed polarized or right-handed polarized * 1_Reflectance_HRBatch.csv - Raw reflectance profile of the subset of individuals from the Pretty Cool Beetles manuscript * 2_Reflectance_FirstBatch.csv - Raw reflectance profile from the rest of the individuals * 3_Transmittance_HRBatch.csv - Raw transmittance profile of the subset of individuals from the Pretty Cool Beetles manuscript * 4_SunIrradiance.csv - Spectral profile correspondent to the sun irradiance * 5_Locations.csv - Includes location data from each beetle specimen and their activity periods * 6_VegetationVariables.csv - Vegetation variables extracted by our code from Atlas of Living Australia * 7_ClimateVariables.csv - Climate variables extracted from continent-wide 0.05° grids of interpolated weather data from the Australian Gridded Climate Data (AGCD)/AWAP database (Australian Bureau of Meteorology official dataset for monthly gridded rainfall analysis) * 8_Size.csv - Sice of each specimen in cm * 9_CodesAndSpecies.csv - Species names for each of the code names used in the other files * 10_Polarization.csv - RGB values extracted from the calibrated photographs under three different filters: VIS, LCP (left polarized) and RCP (right polarized) * 12_knownGreyStdReflectance.csv - Reflectance of the grey standard under each filter provided by the fabricant. We used the same value for the three of them since all photographs were taken with the lens in the visible spectral range * 13_SuppTransmittancvsAbsorbance.csv - Transmitivity and absorptivity in visible light for the subset of beetles studied in "Pretty Cool Beetles" * ConsReflEcolSpp.csv - Consolidated file with the reflectivity values for each spectral band, the PC components (summarizing ecological variables), and size * SupplementaryBeetleDataBase.csv - Table including the species names and ANIC references for the samples used, when available. This is also available in the interactive version of the code * SupplementaryBeetleDataBase.xlsx - same as the previous file in .xlsx format * XMAS_mat2b_bst2e.xml - The BEAST xml file for generating phylogenetic trees from the Christmas beetle supermatrix data. Includes the sequence data, partition evolution model, and various prior topological and dating age constraints. * xmas_mat2b_bst2ef_set23nn2_pinct_med.tre - Maximum clade credibility consensus of the tree set, made by TreeAnnotator. Includes node posterior support, age confidence interval, and branch rate information. * XMAS_mat2b_bst2ef_set23nn2_pinct.nwk - The set of 2000 trees randomly drawn from the BEAST posterior sample, is used for comparative analysis. These have been pruned back to the focal taxa, had tip increment added and labels revised to match the trait dataset. ### Specific information by file (includes variable names and abbreviations) #### Parameters MatLab\StandardParamsF01LCP.txt (only one example since they are all in the same format) Number of columns: 9 Number of cases/rows: 5 Variable List: * a, b, c, and d are the parameters needed in the linearization/equalization equations. adjR2 is the correlation coefficient for each fitting done by MatLab. These values should always be around 0.99 seq is just a list of numbers * Channel is the channel of the photograph, red, green, blue, and gray average value. * The photograph contains the code of the photograph used for this standardization #### 1\_Reflectance\_HRBatch.csv Number of cols: 57 Number of cases/rows: 1302 Variable List: * The first column (wl) is the wavelength and all the other columns are the reflectance (% in comparison to a white standard) for each beetle species Missing data codes: no Specialized formats or other abbreviations used: All the species abbreviations are detailed in the file 9_CodesAndSpecies.csv #### 2\_Reflectance\_FirstBatch Number of variables: 237 Number of cases/rows: 901 Variable List: * The first column (wl) is the wavelength and all the other columns are the reflectance (% in comparison to a white standard) for each beetle species Missing data codes: no Specialized formats or other abbreviations used: All the species abbreviations are detailed in the file 9_CodesAndSpecies.csv #### 3\_Transmittance\_HRBatch Number of variables: 57 Number of cases/rows: 701 Variable List: * The first column (wl) is the wavelength and all the other columns are the transmittance (% in comparison to the full beam of light captured by the detector) for each beetle species Missing data codes: no Specialized formats or other abbreviations used: All the species abbreviations are detailed in the file 9_CodesAndSpecies.csv #### 4\_SunIrradiance Number of variables: 2 Number of cases/rows: 852 Variable List: * The first column (wl) is the wavelength and column 2 is the sun irradiance #### 5\_Locations Number of variables: 9 Number of cases/rows: 277 Variable List: * Spp - Specimen code * Reg - ANIC reference if available, otherwise the code of the polarization photo for ID purposes. * Latitude - location * Longitude - location * MonthMaxALA - month with maximum ALA records for each species * MonthCollectionLabel - the month when each specimen was collected * MonthsActivityALA - For each species, we calculated the percentage of records for each month relative to the total, and only considered the months with several records equivalent to &gt;10% of total records for the species. * Batch - HR means this beetle was also studied in the manuscript "Pretty cool beetles". Beetles labeled "original" in this column were studied only in this manuscript. * NameinHR - for specimens studied in "Pretty Cool Beetles" the codes used in that manuscript are provided for ID purposes. Missing data codes: no Specialized formats or other abbreviations used: All the species abbreviations are detailed in the file 9_CodesAndSpecies.csv #### 6\_VegetationVariables Number of columns: 18 Number of cases/rows: 277 Variable List: * spp - beetle specimen code * reg - ANIC reference if available, otherwise the code of the polarization photo for ID purposes. * Latitude - location * Longitude - location * ALA.month - Month in ALA with most records * picode - Polarization Photo number for ID purposes * colection.month - the month when each specimen was collected * Batch - HR means this beetle was also studied in the manuscript "Pretty cool beetles". beetles labeled "original" in this column were studied only in this manuscript. * NameinHR - for specimens studied in "Pretty Cool Beetles" the codes used in that manuscript are provided for ID purposes. * NameinTree - species name as it appears in the phylogenetic tree The following are the ecological variables related to vegetation cover recovered from ALA: * NPPMean - Mean annual net primary productivity (tonnes/ha/yr) * fractionalCoverBareSoil20120305 - Fraction of bare soil * leafAreaIndexLAI20120305 - leaf area index * fractionOfPhotosyntheticallyActiveRadiationFPAR - the fraction of photosynthetically active radiation * aridityIndexAnnualMean - mean annual aridity index (here multiplied by -1 to facilitate its interpretation since it is originally calculated as the monthly ratio of precipitation to potential evaporation) * growthIndexC3MacrothermPlantsAnnualMean - growth index of C3Macrotherm * growthIndexC3MesothermPlantsAnnualMean - growth index of C3 Mesotherm * growthIndexC4MegathermPlantsAnnualMean - growth index of C4 plants #### 7\_ClimateVariables Number of columns: 19 Number of cases/rows: 276 Variable List: * species - beetle specimen code * reg - ANIC reference if available, otherwise the code of the polarization photo for ID purposes. * lat - Location latitude * lon - Location longitude The following correspond to climatic variables from continent-wide 0.05° grids of interpolated weather data from the Australian Gridded Climate Data (AGCD)/AWAP database (Australian Bureau of Meteorology official dataset for monthly gridded rainfall analysis) averaged over 10 years (2010 - 2020) considering only the interval of the activity peak for each species. * avg_temp_over_35 - the number of extreme temperature days (maximum temperature &gt; 35°C) * avg_max_temp - daily measurements averaged per month of the average maximum temperature (°C) * avg_min_temp - average minimum temperature(°C) * avg_sol - average solar radiation (kJ × m<sup>-2</sup> × day<sup>-1</sup>) * avg_year_sol - average solar radiation per year * avg_year_vpr - average vapor pressure per year * cloud_cover - yearly mean of Cloud coverage (%) calculated from the ratio of observed integrated daily solar radiation to that of a cloudless day * avg_rr - rainfall (mm/day) * avg_vpr - monthly mean of the vapor pressure (hPa) * avg_temp_over_35_Coll * avg_max_temp_Coll * avg_min_temp_Coll * avg_sol_Coll * avg_rr_Coll * avg_vpr_Coll Missing data codes: no Specialized formats or other abbreviations used: The suffix \_Coll means data that was extracted only for the month that the beetle was collected. However, the data used in our analysis is the data for the whole activity period, which can comprise various months depending on the species and it is indicated here by the absence of the \_Coll suffix. #### 8\_Size Number of columns: 2 Number of cases/rows: 276 Variable List: * ind - beetle specimen code * size - the length of the beetle in cm. #### 9\_CodesAndSpecies Number of columns: 2 Number of cases/rows: 276 Variable List: * ind - beetle specimen code * phylogeny_name - species name as it is in the phylogenetic tree Missing data codes: no Specialized formats or other abbreviations used: none #### 10\_Polarization Number of columns: 14 Number of cases/rows: 4942 Variable List: * ind - beetle specimen code * SpeciesName - species name as it is in the phylogenetic tree * ANIC - ANIC code * Pic_code - Number of the calibrated photograph * Filter - VIS == visible, LCP == left-handed polarized, RCP == right-handed polarized * tr - region sampled in the photograph. Either the elytron, pronotum, or gray standard. * label - channel R == red, G == green, B == blue. * area - sampled area (units are not needed since the photo was not calibrated for size. We selected a small area sample where there is no glare or artifacts) * mean - mean intensity value - intensity values vary between 0 (absence of light) and 255 (maximum intensity) * min - min intensity value - intensity values vary between 0 (absence of light) and 255 (maximum intensity) * max - max intensity value - intensity values vary between 0 (absence of light) and 255 (maximum intensity) * camera_cat - configuration of the camera. This parameter is necessary because the photos were taken on different days, so there is one set of calibration parameters per day. Each photograph is calibrated according to its corresponding parameters. * location - RoI == sampled in the region of interest, grey == sampled in the greay standard. * patch_ID - ID of the patch #### 12\_knownGreyStdReflectance Number of columns: 2 Number of cases/rows: 3 Variable List: * 0.38446 is the reflectance of the grey standard included in each photograph. This value is given by the manufacturer. We used the same value for the three filters since the reflectance of the standards varies mostly according to spectral range and all images were taken in visible light. #### 13\_SuppTransmittancvsAbsorbance Number of columns: 3 Number of cases/rows: 57 Variable List: * Beetle - beetle specimen code * Td_VIS - transmissivity (%) * Ab_VIS - absorptivity (%) * Original data in "Pretty Cool Beetles" #### ConsReflEcolSpp Number of columns: 8 Number of cases/rows: 48 Variable List: * the first row is the species name, but it does not contain a header since this is the format required in R for the analysis, i.e., the species name has the be the row label and therefore can not have a header. * TOT - total reflectivity (broadband 400 to 1700 nm) * VIS - visible reflectivity (400 to 700 nm) * NIR - near infrared reflectivity (700 to 1700 nm) * Res - residuals from the regression between VIS and NIR reflectivity * PC1 - first principal component summarizing ecological variables * PC2 - second principal component summarizing ecological variables * Size - length in cm #### SupplementaryBeetleDataBase Number of columns: 7 Number of cases/rows: 262 Variable List: * Species_name - species name as it is in the phylogenetic tree * Code - beetle specimen code * ANIC reference - ANIC code if available, NA values otherwise. * Latitude - location for each specimen * Longitude - location for each specimen * Batch - HR means this beetle was also studied in the manuscript "Pretty cool beetles". Beetles labeled "original" in this column were studied only in this manuscript. * NameinHR - for specimens studied in "Pretty Cool Beetles" the codes used in that manuscript are provided for ID purposes. NA values were assigned to species that were not studied in the previous manuscript "Pretty cool beetles". Missing data codes: NA values in the column ANIC reference if the code is not available. Also, NA values in the column NameinHR for all beetles are labeled "original" in the column "Batch". Specialized formats or other abbreviations used: NA #### Phylogeny Data Notes from the contents of folder phylogeny (outside of the Data folder, but still part of the R project) [https://github.com/lospinarozo/PhotonicRebelsCode/tree/main/Phylogeny](https://github.com/lospinarozo/PhotonicRebelsCode/tree/main/Phylogeny) * Note that the names of the files are the same as in this data set. ##### XMAS\_mat2b\_bst2e.xml: * The BEAST xml file for generating phylogenetic trees from the Christmas beetle supermatrix data. * Includes the sequence data, partition evolution model, and various prior topological and dating age constraints. ##### XMAS\_mat2b\_bst2ef\_set23nn2\_pinct.nwk: * The set of 2000 trees randomly drawn from the BEAST posterior sample, was used for comparative analysis. * These have been pruned back to the focal taxa, had tip increment added and labels revised to match the trait dataset. ##### xmas\_mat2b\_bst2ef\_set23nn2\_pinct\_med.tre: * Maximum clade credibility consensus of the tree set, made by TreeAnnotator. * Includes node posterior support, age confidence interval, and branch rate information. ## Sharing/Access information * This data is used in the publication: "Photonic rebels: reflectivity and polarization of Christmas beetles are not explained by climate" and should be cited using the correspondent Dryad DOI. In this experiment, we also used data from our previous publication: "Laura Ospina-Rozo, Jegadesan Subbiah, Ainsley Seago, Devi Stuart-Fox, Pretty Cool Beetles: Can Manipulation of Visible and Near-Infrared Sunlight Prevent Overheating?, *Integrative Organismal Biology*, Volume 4, Issue 1, 2022, obac036, [https://doi.org/10.1093/iob/obac036](https://doi.org/10.1093/iob/obac036)" The files have been attached to this set again and we have added notes to indicate when the same beetle specimen was used for both publications. * Links to other publicly accessible locations of the data: Interactive code: [https://lospinarozo.github.io/PhotonicRebelsCode/](https://lospinarozo.github.io/PhotonicRebelsCode/) Original code and data with version control: [https://github.com/lospinarozo/PhotonicRebelsCode](https://github.com/lospinarozo/PhotonicRebelsCode) Original data and code from Pretty Cool Beetles: [https://github.com/lospinarozo/PrettyCoolBeetlesCodeAndData](https://github.com/lospinarozo/PrettyCoolBeetlesCodeAndData) ## Code/Software Our code is divided in mainly two sections: * Phylogenetic reconstruction: The text file called PAT_script_v5.sh contains various scripts of bash and R code for assisting in the assembling and checking of genetic sequence data super matrices. The scripts include comment lines detailing use. Some code requires software MAFFT and IQTree. * Statistical analysis: All our models were run in R Statistical Software v4.1.2 87. To run PGLS models we used the packages ape, caper, picante, and phytools. To run the PGLS model on multiple trees, we used loop functions programmed in R. Given the extent of our statistical analysis, the scripts are separated by topic, and the index script explains the purpose of each of them and how they correlate.