egrace479 commited on
Commit
6ef14cc
1 Parent(s): 38a17b3

Deduplicate Dataset (#3)

Browse files

- Add deduplicated Master file. (20ac450ed2abab34093fb60441b3fc8f930da367)
- Add deduplicated Heliconius and dorsal master files. (bb27758632dc14a3687cb50b500de4d52142faf0)
- Add notebook performing deduplication of the master files (ba3ca2d853729fd8c578b1c57773dec11dbb4f49)
- Update README stats following deduplication (e570b24364ea206a44452f6c2d3542ca8e7def4b)
- Rename data generation notebooks to reflect their order of operation. (57250d31eb33674a86351ddca62050668d65cd8b)
- Rename deduplication notebook to reflect its order of operation (c3c671dd46ed0ad097e3cc1f8436bbb6ec5d329c)
- Update description to align with renaming for workflow order (7fa480b9236503c832e7fdb28ca8fd7c5005b037)
- Update download script with better logging and retry loop (5253c8cbefe3884261b8439551272095ac375f3a)
- Update license file to reflect updated metadata, also more human-readable (1e9e3039693d2259ee1687ab815d368d45ba8ccf)
- Add notebook that generates patch file for deduplication (328796a1e26d4409eafc91f2aaf64996151583ad)
- Add large CSVs to LFS tracking (c15b558fa1090b647d508f8c1c0a64226501d19e)
- Add files relating to the deduplication process (afe2302952e0130d0a53f72d274e115fbf2b96f5)
- Add original Zenodo master file for record (282eed14617709e3c655d96bba14703f45eac320)
- Add links for new files and description of final curation process. (ff1996f41ce125cae54aebb8abb3e909683361f9)
- Update master files entries labeled only to genus level. (3e4f1f2bd0021905761d5ae9a6e74908548b7c08)
- Add bib file for all incldued records (9bb99e162e3c5c7d54fdcb80a461f99ae9aac5be)
- Update read location for initial file (c3bf57ed7524e3f98afcfba8f695a0d3353857d6)
- Small clarity fixes in Dataset Card (9ae0c5ddd8aba594e3577bdc1a28cd6fb8ce2bdf)
- Move deduplication related files (EDA & docs) into appropriate root folders or subfolders. (b5dfeddec2e75bb576305e25e1b8c6fd53bb61be)
- Adjust links and filepaths according to re-organization in b5dfedde (cbd69490da91b78c7bb16df9d7199cf1c54a8f4d)

.gitattributes CHANGED
@@ -54,5 +54,9 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
54
  *.jpeg filter=lfs diff=lfs merge=lfs -text
55
  *.webp filter=lfs diff=lfs merge=lfs -text
56
 
 
57
  Jiggins_Zenodo_Img_Master.csv filter=lfs diff=lfs merge=lfs -text
58
  Jiggins_Heliconius_Master.csv filter=lfs diff=lfs merge=lfs -text
 
 
 
 
54
  *.jpeg filter=lfs diff=lfs merge=lfs -text
55
  *.webp filter=lfs diff=lfs merge=lfs -text
56
 
57
+ # Large CSVs
58
  Jiggins_Zenodo_Img_Master.csv filter=lfs diff=lfs merge=lfs -text
59
  Jiggins_Heliconius_Master.csv filter=lfs diff=lfs merge=lfs -text
60
+ metadata/Jiggins_Zenodo_Master.csv filter=lfs diff=lfs merge=lfs -text
61
+ deduplication_process/Jiggins_Zenodo_Img_Master_3477891Patch.csv filter=lfs diff=lfs merge=lfs -text
62
+ deduplication_process/metadata/Jiggins_Zenodo_Img_Master_3477891Patch_downloaded.csv filter=lfs diff=lfs merge=lfs -text
Jiggins_Heliconius_Master.csv CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:c694500af92fb2f19a8a78a5a370686fcf94bb5bcbbc095da1d8d94da9312ad7
3
- size 12124839
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d7116b8aa211d770eb64787fe8c605f926db493bd47e8ea9957177efa18aa75e
3
+ size 13499313
Jiggins_Zenodo_Img_Master.csv CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:fe79fdb62909be50eff6f7016f02301c56ce09c9c0b164dce680810ec4149b2a
3
- size 15528648
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a43867adb30f411fcaf663ba8a43e15e2b13a458a8602b9bcd29b5f7e4149b21
3
+ size 16448423
Jiggins_Zenodo_dorsal_Img_Master.csv CHANGED
The diff for this file is too large to render. See raw diff
 
README-supplemental.md ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Summary of Deduplication of Jiggins Data
2
+
3
+ We explored our downloaded images in `notebooks/EDA-DL-0-3.ipynb`, and established the following causes of duplication along with remedies:
4
+ 1. The "patch" record (record 3477891) which required alignment in `notebooks/Data-gen-1-1.ipynb`, resulting in `metadata/Jiggins_Zenodo_Img_Master_3477891Patch.csv` used for download, is a duplication of all listed records. Additionally, it introduced extra copies of 4 images with incorrect labels for their views (i.e., dorsal vs ventral).
5
+ - Solution: This record will be removed.
6
+ 2. The remaining duplication (430 images x2) comes from 5 records: [4291095](https://zenodo.org/records/4291095), [2813153](https://zenodo.org/records/2813153), [5526257](https://zenodo.org/records/5526257), [2553977](https://zenodo.org/records/2553977), and [2552371](https://zenodo.org/records/2552371).
7
+ - Though there is nothing in their descriptions on Zenodo to indicate this overlap occurred, record 4291095 duplicated 415 images from record 2813153. 104 of these images had their view/side labels (dorsal vs ventral) updated to reflect an earlier mislabeling in record 2813153; these were all RAW copies of the images. All other metadata was consistent across records.
8
+ - Solution: Copies of these images and their metadata will be retained from the newer record, record 4291095.
9
+ - Record 5526257 has 10 images that were added twice. All their metadata is consistent, so we will just keep the first instance of each image.
10
+ - Records 2553977 and 2552371 are both "Miscellaneous Heliconius wing photographs (2001-2019)" Parts 3 & 1, respectively. Record 2553977 has duplicated images with matching metadata, though 3 of the 4 images have different filenames (`Image_name`). It seems to have resulted from typos or not indicating `cut`, as they are all close-up crops of a single wing. From this perspective, the view labels (dorsal) don't seem appropriate when we have more fine-grained indicators such as "forewing dorsal".
11
+ - Suggestion that the entries in this record with `cut` in the filename not be used for general classification unless this variety is desired. These also appear to be all the `tif` images, which are often ignored.
12
+ - Record 2552371 has one image duplicated with two different `CAMID`s assigned (different views as well). These will both be removed as the image has no indicator of the specimen ID in it. Note that these also were labeled `Heliconius sp.`.
13
+ 3. Looking at images that were not duplicates, there are clearly still multiple images of the same specimen from the same perspective (eg., two dorsal images) that are also of the same file type (eg., both jpgs). Duplication was checked at the pixel level, so there is no guarantee that they are truly different images, but due to the scope of this collection (over 20 years), it does not seem unlikely that multiple images could have been taken of the same specimen.
14
+ - Suggestion/Solution: When determining splits using this data, follow these steps:
15
+ 1. Ensure you are looking at only **_one_** view (eg., dorsal or ventral).
16
+ 2. Ensure you are only looking one file type (`raw`, `jpg`, or `tif`).
17
+ 3. Reduce to only unique `CAMID`s.
18
+ 4. Generate splits as desired.
19
+ 5. Add images to splits based on matched `CAMID`s if multiple views are desired (i.e., if a `CAMID` is present in the dorsal training, add the matching ventral image to the training set).
20
+ 6. Be sure to check only desired categories are included, such as excluding hybrids or cross types, or specimens not labeled to the level of classification.
21
+
22
+
23
+ Final deduplication following this process was completed in `notebooks/Data-gen-1-2.ipynb`.
24
+
25
+ # Other Notes on Using this Data
26
+
27
+ Not all images are labeled with the same detail. For instance, there are images labeled to the subspecies and species levels, while some images are not labeled past genus (eg., `Heliconius sp.`, `Heliconius hybrid`). If classifying to the subspecies level, be sure to only include images that have labels in the subspecies column, similarly, when doing species classification, don't include those not labeled past genus (exclude species labels `<Genus> sp.` and `Heliconius hybrid`).
28
+
29
+ The `Taxonomic_Name` column has been standardized to `<Genus> <species> ssp. <subspecies>` (where species and subspecies are available). If species label is unavailable, `Taxonomic_Name` and `species` columns are labeled `<Genus> sp.` or `Heliconius hybrid`.
30
+
31
+ Cross type specimens (those mixed in a lab to generate hybrids or back-crosses) are indicated by a non-null value in the `Cross_Type` column. Their subspecies column is written out in full indicating parentage (eg., `(plesseni x malleti) x malleti`), unlike in the `Taxonomic_Name` column, where they're standardized to match the formatting of other hybrids. Use the following code to filter back crosses and F2 hybrids if just F1s are desired:
32
+
33
+ ```
34
+ import pandas as pd
35
+
36
+ df = pd.read_csv(MASTER_FILE_PATH, low_memory = False)
37
+
38
+ cross_types_rm = []
39
+ for ssp in list(df.loc[df["Cross_Type"].notna(), "subspecies"].unique()):
40
+ if " x " in ssp:
41
+ split_x = ssp.split(" x ")
42
+ if len(split_x) > 2:
43
+ cross_types_rm.append(ssp)
44
+
45
+ print(len(cross_types_rm))
46
+
47
+ non_bcross = df.loc[~df["subspecies"].isin(cross_types_rm)]
48
+ ```
49
+
README.md CHANGED
@@ -51,11 +51,11 @@ configs:
51
  ### Dataset Summary
52
 
53
  Subset of the collection records from Chris Jiggins' research group at the University of Cambridge, collection covers nearly 20 years of field studies.
54
- This subset contains approximately 44,809 RGB images of 11,991 specimens (34,265 images of 10,109 specimens across all Heliconius). Many records have both images and locality data.
55
 
56
  Most images were photographed with a DSLR camera with a 100 mm macro-lens in standardized conditions.
57
  More information can be found at the individual Zenodo record pages.
58
- Images and full records with data are stored in the [EarthCape database](https://heliconius.ecdb.io/default.aspx) and on [Zenodo](https://zenodo.org/communities/butterfly?q=&l=list&p=1&s=10&sort=newest) (across 31 records from the Butterfly Genetics Group).
59
 
60
  Both dorsal and ventral images available. Contains both whole butterfly, and 4 wings separate. Large variation in image content.
61
 
@@ -73,37 +73,38 @@ English, Latin
73
 
74
  ## Dataset Structure
75
 
76
- * **Jiggins_Zenodo_Img_Master.csv:** Information for the approximately 45,0000 unprocessed image files included in the Jiggins Heliconius Collection. Image types are `jpg`, `raw` (.CR2) and `tif`. `genus`, `species`, and `subspecies` are included columns.
77
 
78
- * **Jiggins_Zenodo_dorsal_Img_Master.csv:** Subset of 22,175 images from `Jiggins_Zenodo_Img_Master.csv` with a dorsal view of the butterflies (note that some have both dorsal and ventral). This subset includes 12,296 unique specimens. Image types and columns are the same as for the Master file.
79
 
80
- * **Jiggins_Heliconius_Master.csv:** The 34,265-image subset of all Heliconius images from `Jiggins_Zenodo_Img_Master.csv`. This subset includes 10,109 unique specimens. IImage types and columns are the same as for the Master file.
81
 
82
 
83
  **Notes:**
84
- - The notebooks that generated these files and stats are included in the `notebooks` folder.
85
- - The original Jiggins Zenodo Master file was compiled from the CSVs provided with the included Zenodo records from the Butterfly Genetics Group. Christopher Lawrence selected which of these provided columns to include. Further processing and standardization (all documented in the Jupyter Notebooks) was performed by Elizabeth Campolongo.
86
  - Taxonomic information for records [5526257](https://zenodo.org/record/5526257), [2554218](https://zenodo.org/record/2554218), and [2555086](https://zenodo.org/record/2555086) was recovered from information on their Zenodo pages, as the provided CSVs did not contain that information.
87
  - Be advised that there may be overlap between images in [record 2548678](https://zenodo.org/records/2548678) and [record 3082688](https://zenodo.org/records/3082688).
88
- - The `scripts` folder has a download and checksum script.
89
  - Images are downloaded to the provided images directory with subfolders labeled by the `Taxonomic_Name`, with filenames `<X>_<Image_name>`.
90
- - The checksum script is called by `download_jiggins_subset.py` to generate an MD5 for all download images and creates a CSV with `filepath`, `filename`, and `md5` columns in the same folder as the source CSV (named `<source CSV>_checksums.csv`). This helps to ensure FAIR and Reproducible results, though this will _**not**_ distinguish between the raw and jpg versions of the same image.
91
  - A log of the download is also generated in the same folder as the source CSV (named `<source CSV>_log.json`).
92
- - `metadata/Missing_taxa_Jiggins_Zenodo_Master.csv` contains a record of the images that did not have easily reconcilable taxonomic information (see `notebooks/standardize_datasets.ipynb` for more information on this data). There are 1,630 such images distributed across 18 records.
 
93
 
94
  ### Data Instances
95
 
96
  `Jiggins_Heliconius_Master.csv` contains multiple species of Heliconius (including erato and melpomene), most are labeled down to the subspecies level. The `Jiggins_Zenodo_Img_Master.csv` also contains species from other genera, with just over half labeled to the subspecies level (these are predominantly Heliconius subspecies).
97
 
98
- Detached wings in four quadrants (generally).
99
  Some subspecies may be photographed differently, needs segmentation preprocessing.
100
 
101
- * **Type:** JPG/jpg/tif(very few)
102
  * **Size (x pixels by y pixels):** Unknown yet
103
  * **Background (color or none):** multiple (needs to be normalized, often grey or lime green)
104
- * **Fit in frame:**
105
  * **Ruler or Scale:** Some with Ruler
106
- * **Color (ColorChecker, white-balance, None):** None
107
 
108
  #### Preprocessing steps (to be done):
109
  1. Hybrid separation - some images labeled as _H. erato_ and _H. melpomene_ without subspecies names are hybrids and need to be determined what subspecies they are.
@@ -119,9 +120,9 @@ CSV Columns are as follows:
119
 
120
  - `CAMID`: Unique identifier for each specimen that was photographed. Each `CAMID` corresponds to multiple images (based on factors such as `View` and `file_type`).
121
  - `X`: Unique identifier for each line in the master CSV.
122
- - `Image_name`: Filename of image (not unique, often `CAM<CAMID>_<v or d>`).
123
- - `View`: View of the butterfly in the image: `dorsal`, `ventral`, `forewing dorsal`, `hindwing dorsal`, `forewing ventral`, `hindwing ventral`, `dorsal and ventral`.
124
- - `zenodo_name`: Name of the CSV file with metadata used to populate this file from the associated Zenodo record.
125
  - `zenodo_link`: URL for the Zenodo record of the image.
126
  - `Sequence`: Mostly numeric IDs, not unique, please see the associated Zenodo record for more information on the meaning of these designations.
127
  - `Taxonomic_Name`: Indication of the Genus, species, and possibly, subspecies, of the specimen. For Cross Types, the hybrid names are reduced to just the two subspecies (from the `Cross_Type` column) and non-specified crosses are labeled `<Genus> <species> cross hybrid`.
@@ -133,24 +134,27 @@ CSV Columns are as follows:
133
  - `Dataset`: Overall collection the images belong to: `Heliconiine Butterfly Collection Records from University of Cambridge` (largely, but not entirely Heliconius), `Patricio Salazar`, `Nadeau Sheffield`, `Bogota Collection (Camilo Salazar)`, `Cambridge Collection`, `Mallet`, `Merril_Gamboa`, `STRI Collection (Owen)`. Please see the associated Zenodo record for more information on the meaning of these designations.
134
  - `Store`: Storage location for specimen (`Box ###`).
135
  - `Brood`: Likely indicator of batch of butterflies. Please see the associated Zenodo record for more information on the meaning of these designations.
136
- - `Death_Date`: Date of specimen death. Only noted for 318 images.
137
- - `Cross_Type`: Laboratory cross breeding information. There is a mix of F1 (subspecies x subspecies), F2 (F1 x F1), and backcross (F1 x subspecies) hybrids. Generally, the order of the subspecies listed in the cross corresponds to the sexes of the parents (Maternal x Paternal). There are approximately 5,000 such images; on average, there are both raw and jpg images of the specimens for each view, so this covers 820 unique specimens.
138
- - `Stage`: Life stage of the specimen. Only 15 specimens have a non-null value for this feature, and they are all labeled as `Adult`.
139
- - `Sex`: Sex of the specimen: `Male`, `Female`, or `Unknown`.
140
  - `Unit_Type`: Type of the specimen: `wild`, `reared`, `Mutant`, `Wild`, `e11`, or `e12`. Please see the associated Zenodo record for more information on the meaning of these designations.
141
  - `file_type`: Image type: `jpg`, `raw` (.CR2), or `tif`.
142
  - `record_number`: The number associated with the Zenodo record that the image came from.
143
- - `species`: Species of the specimen. There are 246 species represented in the full collection, 37 of these are species of Heliconius.
144
  - `subspecies`: Subspecies of the specimen (where available, mostly labeled for Heliconius). There are 155 subspecies represented in the full collection, 110 of which are Heliconius subspecies.
145
- - `genus`: Genus of the specimen. There are 94 unique genera represented in the full collection.
146
  - `file_url`: URL to download image from Zenodo: `zenodo_link + "/files/" + Image_name`. Allows for sample image display in [data dashboard](https://huggingface.co/spaces/imageomics/dashboard-prototype).
147
  - `hybrid_stat`: Hybrid status of the sample: `hybrid`, `non-hybrid`, or `None`. Hybrids are determined by an ` x ` or `hybrid` in the `Taxonomic_Name` column, all other images classified to the _subspecies_ level are labeled as `non-hybrid`, and the parent species of the one species-level hybrid is labeled as `non-hybrid` (only one of them is present in the dataset).
 
 
 
148
 
149
  **Note:**
150
- - `Jiggins_Zenodo_dorsal_Img_Master.csv` also has a column `CAM_dupe` indicating whether the `CAMID` has multiple images within this subset.
151
- - We do not leave the first instance as a non-duplicate, so to have a clear assessment of all duplication (eg., is it just across a couple records, file types, etc).
152
- - `CAMID`s are necessarily duplicated for the images that are of just a dorsal forewing or hindwing, so we label those as `single_wing`.
153
- - There are multiple jpg images & multiple raw images of the same specimen. Note that this does not necessarily mean these are duplicates of the same images. There are also jpg copies provided alongside raw images.
154
 
155
  <!--
156
  ### Data Splits
@@ -162,7 +166,7 @@ CSV Columns are as follows:
162
 
163
  ### Curation Rationale
164
 
165
- The Butterfly Genetics Group has a large collection of butterfly images distributed across 31 Zenodo records. They do not all have the same information, and it is sometimes only provided in the record, but not the metadata. With this collection, we combine the provided information (metadata) into a shared format that is easily ingested into ML pipelines. We also add some other labels of interest (based on identification determined by the Butterfly Genetics Group), and endeavor to remove duplication, noting potential points of duplication and providing some assessment tools to help prevent data leakage.
166
 
167
  Additionally, these datasets are prepared in a format that allows for easy integration with the Imageomics Institute's [Data Dashboard](https://huggingface.co/spaces/imageomics/dashboard-prototype) for distribution statistics and easy sampling of images by taxonomic information and view.
168
 
@@ -172,6 +176,8 @@ These images are a subset of the [Butterfly Genetics Group's Cambridge butterfly
172
 
173
  Data is pulled from the Zenodo Records in [`licenses.json`](https://huggingface.co/datasets/imageomics/Jiggins_Heliconius_Collection/blob/main/metadata/licenses.json). This file also contains full citation information for all records.
174
 
 
 
175
 
176
  #### Initial Data Collection and Annotation
177
 
@@ -187,9 +193,13 @@ None
187
  ### Discussion of Biases and Other Known Limitations
188
 
189
  - This dataset is imbalanced. Even among the Heliconius subset, some subspecies are more heavily represented than others.
190
- - There are a mix of valid subspecies and hybrids that are labeled as such, but there are also images of butterflies classified only to the genus or species level, for which such a designation may not be clearly made (there are also instances of "_Heliconius <species> hybrid_", where the parent subspecies are not indicated.
 
191
  - There may be overlap between images in [record 2548678](https://zenodo.org/records/2548678) and [record 3082688](https://zenodo.org/records/3082688).
192
- - There are multiple images of the same specimen for many specimens; sometimes this is due to different views (eg., dorsal or ventral side), sometimes it is due to JPG copies of the RAW photos, though it is also sometimes that new photos were taken of the same specimen at a different times.
 
 
 
193
 
194
 
195
  ## Additional Information
@@ -199,19 +209,19 @@ None
199
  * Christopher Lawrence (Princeton University) - ORCID: 0000-0002-3846-5968
200
  * Chris Jiggins (University of Cambridge) - ORCID: 0000-0002-7809-062X
201
  * Butterfly Genetics Group (University of Cambridge)
202
- * Elizabeth G. Campolongo - ORCID: 0000-0003-0846-2413
203
 
204
  ### Licensing Information
205
 
206
  The data (images and text) are all licensed under [Creative Commons Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0/). Each image and text in this dataset is provided under the least restrictive terms allowed by its licensing requirements as provided to us (i.e, we impose no additional restrictions past those specified by this license on the original source files). Modified images are only restricted by this original license.
207
 
208
- Images can be matched to their source record through the `zenodo_link` column in the Master CSVs to the `url` in the licenses.json file.
209
 
210
  ### Citation Information
211
 
212
- Christopher Lawrence, Chris Jiggins, Butterfly Genetics Group (University of Cambridge), Elizabeth Campolongo. (2024). Jiggins Heliconius Collection. Hugging Face. https://huggingface.co/datasets/imageomics/Jiggins_Heliconius_Collection.
213
 
214
- If you use this dataset, please cite the original datasets (citations for all 31 Zenodo records are in licenses.json) as well as this curated subset.
215
 
216
  ### Contributions
217
 
 
51
  ### Dataset Summary
52
 
53
  Subset of the collection records from Chris Jiggins' research group at the University of Cambridge, collection covers nearly 20 years of field studies.
54
+ This subset contains approximately 36,189 RGB images of 11,962 specimens (29,134 images of 10,086 specimens across all Heliconius). Many records have both images and locality data.
55
 
56
  Most images were photographed with a DSLR camera with a 100 mm macro-lens in standardized conditions.
57
  More information can be found at the individual Zenodo record pages.
58
+ Images and full records with data are stored in the [EarthCape database](https://heliconius.ecdb.io/default.aspx) and on [Zenodo](https://zenodo.org/communities/butterfly?q=&l=list&p=1&s=10&sort=newest) (across 29 records from the Butterfly Genetics Group).
59
 
60
  Both dorsal and ventral images available. Contains both whole butterfly, and 4 wings separate. Large variation in image content.
61
 
 
73
 
74
  ## Dataset Structure
75
 
76
+ * **Jiggins_Zenodo_Img_Master.csv:** Information for the approximately 36,000 unprocessed image files included in the Jiggins Heliconius Collection. Image types are `jpg`, `raw` (.CR2) and `tif`. `genus`, `species`, and `subspecies` are included columns.
77
 
78
+ * **Jiggins_Zenodo_dorsal_Img_Master.csv:** Subset of 17,748 images from `Jiggins_Zenodo_Img_Master.csv` with a dorsal view of the butterflies (note that some have both dorsal and ventral). This subset includes 11,746 unique specimens. Image types and columns are the same as for the Master file.
79
 
80
+ * **Jiggins_Heliconius_Master.csv:** The 29,134-image subset of all Heliconius images from `Jiggins_Zenodo_Img_Master.csv`. This subset includes 10,086 unique specimens. Image types and columns are the same as for the Master file.
81
 
82
 
83
  **Notes:**
84
+ - The notebooks that generated these files and stats are included in the `notebooks` folder, their only requirement is `pandas`.
85
+ - The [original Jiggins Zenodo Master file](https://huggingface.co/datasets/imageomics/Jiggins_Heliconius_Collection/blob/main/metadata/Jiggins_Zenodo_Master.csv) was compiled from the CSVs provided with the included Zenodo records from the Butterfly Genetics Group. Christopher Lawrence selected which of these provided columns to include. Further processing and standardization (all documented in the Jupyter Notebooks) was performed by Elizabeth Campolongo.
86
  - Taxonomic information for records [5526257](https://zenodo.org/record/5526257), [2554218](https://zenodo.org/record/2554218), and [2555086](https://zenodo.org/record/2555086) was recovered from information on their Zenodo pages, as the provided CSVs did not contain that information.
87
  - Be advised that there may be overlap between images in [record 2548678](https://zenodo.org/records/2548678) and [record 3082688](https://zenodo.org/records/3082688).
88
+ - The `scripts` folder has a download and checksum script, their only requirement is `pandas`.
89
  - Images are downloaded to the provided images directory with subfolders labeled by the `Taxonomic_Name`, with filenames `<X>_<Image_name>`.
90
+ - The checksum script is called by `download_jiggins_subset.py` to generate an MD5 for all downloaded images and creates a CSV with `filepath`, `filename`, and `md5` columns in the same folder as the source CSV (named `<source CSV>_checksums.csv`). This helps to ensure FAIR and Reproducible results, though this will _**not**_ distinguish between RAW and JPG versions of the same image.
91
  - A log of the download is also generated in the same folder as the source CSV (named `<source CSV>_log.json`).
92
+ - `metadata/Missing_taxa_Jiggins_Zenodo_Master.csv` contains a record of the images that did not have easily reconcilable taxonomic information (see `notebooks/Data-gen-0-3.ipynb` for more information on this data). There are 1,630 such images distributed across 18 records.
93
+ - `metadata/Missing_taxa_download.csv` contains the 22 entries that had `Unknown` or `Stratiomyidae` (not a butterfly) as their `Taxonomic_Name`. Their specimen IDs did not appear elsewhere in the record, so this information was not easily reconcilable (see `notebooks/Data-gen-1-2.ipynb` for more information).
94
 
95
  ### Data Instances
96
 
97
  `Jiggins_Heliconius_Master.csv` contains multiple species of Heliconius (including erato and melpomene), most are labeled down to the subspecies level. The `Jiggins_Zenodo_Img_Master.csv` also contains species from other genera, with just over half labeled to the subspecies level (these are predominantly Heliconius subspecies).
98
 
99
+ Detached wings in four quadrants (generally). Many include a label indicating the specimen ID (`CAMID`). There is variation in formatting both across and within records, but overall setup is relatively consistent.
100
  Some subspecies may be photographed differently, needs segmentation preprocessing.
101
 
102
+ * **Type:** RAW (`.CR2`), JPG, and TIFF (very few)
103
  * **Size (x pixels by y pixels):** Unknown yet
104
  * **Background (color or none):** multiple (needs to be normalized, often grey or lime green)
105
+ * **Fit in frame:** varies
106
  * **Ruler or Scale:** Some with Ruler
107
+ * **Color (ColorChecker, white-balance, None):** some with ColorChecker, many with white reflectance standard in the bottom right corner.
108
 
109
  #### Preprocessing steps (to be done):
110
  1. Hybrid separation - some images labeled as _H. erato_ and _H. melpomene_ without subspecies names are hybrids and need to be determined what subspecies they are.
 
120
 
121
  - `CAMID`: Unique identifier for each specimen that was photographed. Each `CAMID` corresponds to multiple images (based on factors such as `View` and `file_type`).
122
  - `X`: Unique identifier for each line in the master CSV.
123
+ - `Image_name`: Filename of image (unique, often `CAM<CAMID>_<v or d>`).
124
+ - `View`: View of the butterfly in the image: `dorsal`, `ventral`, `forewing dorsal`, `hindwing dorsal`, `forewing ventral`, `hindwing ventral`, or `dorsal and ventral`.
125
+ - `zenodo_name`: Name of the CSV file with metadata from the associated Zenodo record used to populate the information about this image.
126
  - `zenodo_link`: URL for the Zenodo record of the image.
127
  - `Sequence`: Mostly numeric IDs, not unique, please see the associated Zenodo record for more information on the meaning of these designations.
128
  - `Taxonomic_Name`: Indication of the Genus, species, and possibly, subspecies, of the specimen. For Cross Types, the hybrid names are reduced to just the two subspecies (from the `Cross_Type` column) and non-specified crosses are labeled `<Genus> <species> cross hybrid`.
 
134
  - `Dataset`: Overall collection the images belong to: `Heliconiine Butterfly Collection Records from University of Cambridge` (largely, but not entirely Heliconius), `Patricio Salazar`, `Nadeau Sheffield`, `Bogota Collection (Camilo Salazar)`, `Cambridge Collection`, `Mallet`, `Merril_Gamboa`, `STRI Collection (Owen)`. Please see the associated Zenodo record for more information on the meaning of these designations.
135
  - `Store`: Storage location for specimen (`Box ###`).
136
  - `Brood`: Likely indicator of batch of butterflies. Please see the associated Zenodo record for more information on the meaning of these designations.
137
+ - `Death_Date`: Date of specimen death. Only noted for 269 images.
138
+ - `Cross_Type`: Laboratory cross breeding information. There is a mix of F1 (subspecies x subspecies), F2 (F1 x F1), and backcross (F1 x subspecies) hybrids; these are all crosses of _Heliconius erato_ and _Heliconius melpomene_ subspecies. Generally, the order of the subspecies listed in the cross corresponds to the sexes of the parents (Maternal x Paternal). There are approximately 4,400 such images; on average, there are both raw and jpg images of the specimens for each view, so this covers 820 unique specimens.
139
+ - `Stage`: Life stage of the specimen. Only 6 images (3 specimens) have a non-null value for this feature, and they are all labeled as `Adult`.
140
+ - `Sex`: Sex of the specimen: `Male`, `Female`, or `Unknown`; there are also null values.
141
  - `Unit_Type`: Type of the specimen: `wild`, `reared`, `Mutant`, `Wild`, `e11`, or `e12`. Please see the associated Zenodo record for more information on the meaning of these designations.
142
  - `file_type`: Image type: `jpg`, `raw` (.CR2), or `tif`.
143
  - `record_number`: The number associated with the Zenodo record that the image came from.
144
+ - `species`: Species of the specimen. There are 242 species represented in the full collection, 36 of these are species of Heliconius. Note that 25 of these are `<Genus> sp.` indicating that they are a species of the designated genus, but have not been classified at the species level, this includes `Heliconius sp.` and `Heliconius hybrid` designations.
145
  - `subspecies`: Subspecies of the specimen (where available, mostly labeled for Heliconius). There are 155 subspecies represented in the full collection, 110 of which are Heliconius subspecies.
146
+ - `genus`: Genus of the specimen. There are 92 unique genera represented in the full collection.
147
  - `file_url`: URL to download image from Zenodo: `zenodo_link + "/files/" + Image_name`. Allows for sample image display in [data dashboard](https://huggingface.co/spaces/imageomics/dashboard-prototype).
148
  - `hybrid_stat`: Hybrid status of the sample: `hybrid`, `non-hybrid`, or `None`. Hybrids are determined by an ` x ` or `hybrid` in the `Taxonomic_Name` column, all other images classified to the _subspecies_ level are labeled as `non-hybrid`, and the parent species of the one species-level hybrid is labeled as `non-hybrid` (only one of them is present in the dataset).
149
+ - `filename`: Unique filename assigned to image at download (`<X>_<Image_name>.<jpg/tif/CR2>`) using `scripts/download_jiggins_subset.py`.
150
+ - `filepath`: Filepath of the downloaded image (`<image_folder>/<Taxonomic_Name>/<filename>`) using `scripts/download_jiggins_subset.py`.
151
+ - `md5`: MD5 of the downloaded image. This was used as the measure of uniqueness (at the pixel level) to address duplication of images across Zenodo records.
152
 
153
  **Note:**
154
+ - `Jiggins_Zenodo_dorsal_Img_Master.csv` also has a column `CAM_dupe` indicating whether the `CAMID` has multiple images of the same file type within this subset. Most (11,446) specimens have only one dorsal image per file type.
155
+ - `CAMID`s are necessarily duplicated for the images that are of just a dorsal forewing or hindwing, so we label those as `single_wing`. There are one RAW and one JPG image for each single wing. None of these are Heliconius butterflies.
156
+ - Instances of both dorsal and ventral wings in the same image are labeled `both-wings`; there are 18 such images, all of Heliconius butterflies.
157
+ - There are multiple JPG images with the same `CAMID`. Note that this does not necessarily mean these are duplicates of the same images; check the views to confirm. There are also JPG copies provided alongside RAW images. Generally, RAW images will be unique up to `View`, as there is only one CAMID with two RAW images that aren't of just a single wing.
158
 
159
  <!--
160
  ### Data Splits
 
166
 
167
  ### Curation Rationale
168
 
169
+ The Butterfly Genetics Group has a large collection of butterfly images distributed across 31 Zenodo records. They do not all have the same information, and it is sometimes only provided in the record, but not the metadata. With this collection, we combine the provided information (metadata) into a shared format that is easily ingested into ML pipelines. We also add some other labels of interest (based on identification determined by the Butterfly Genetics Group), and endeavor to remove duplication, noting potential points of duplication and providing some assessment tools to help prevent data leakage. This de-duplication effort reduced the overall dataset to covering only 29 of these records, and it is documented in the `deduplication_process` directory.
170
 
171
  Additionally, these datasets are prepared in a format that allows for easy integration with the Imageomics Institute's [Data Dashboard](https://huggingface.co/spaces/imageomics/dashboard-prototype) for distribution statistics and easy sampling of images by taxonomic information and view.
172
 
 
176
 
177
  Data is pulled from the Zenodo Records in [`licenses.json`](https://huggingface.co/datasets/imageomics/Jiggins_Heliconius_Collection/blob/main/metadata/licenses.json). This file also contains full citation information for all records.
178
 
179
+ The [original Master file](https://huggingface.co/datasets/imageomics/Jiggins_Heliconius_Collection/blob/main/metadata/Jiggins_Zenodo_Master.csv), created by Christopher Lawrence, was fed into notebook Data-gen-0-1, and further processed in Data-gen-0-2 and Data-gen-0-3. The next data generation step (deduplication by MD5) involved downloading all images in `metadata/Jiggins_Zenodo_Img_Master_3477891Patch.csv` (created in Data-gen-1-1). MD5s of all downloaded images were taken and the results were explored in the EDA-DL series of notebooks; information and conclusions from this EDA are documented in [`README-supplemental`](https://huggingface.co/datasets/imageomics/Jiggins_Heliconius_Collection/blob/main/README-supplemental.md). The outline described there was then implemented in the [Data-gen-1-2 notebook](https://huggingface.co/datasets/imageomics/Jiggins_Heliconius_Collection/blob/main/notebooks/Data-gen-1-2.ipynb), regenerating all current datasets. This notebook also has another round of taxonomic standardization so that all entries labeled only to the genus level are labeled as `<Genus> sp.` in both `Taxonomic_Name` and `species` columns, 4 entries with a non-butterfly genus name were noted and removed, as were 18 entries with `Unknown` as their taxonomic label.
180
+
181
 
182
  #### Initial Data Collection and Annotation
183
 
 
193
  ### Discussion of Biases and Other Known Limitations
194
 
195
  - This dataset is imbalanced. Even among the Heliconius subset, some subspecies are more heavily represented than others.
196
+ - Not all images are labeled with the same detail. There are a mix of valid subspecies and hybrids that are labeled as such, but there are also images of butterflies classified only to the genus or species level, for which such a designation may not be clearly made. These images are limited to classification tasks only down to the level of their label. There are also instances of "_Heliconius <species> hybrid_", where the parent subspecies are not indicated because it was labeled only as a hybrid of that species.
197
+ - All entries labeled only to the genus level can be recognized by ` sp.` following the genus in the `Taxonomic_Name` and `species` columns or are labeled as `Heliconius hybrid` in those columns.
198
  - There may be overlap between images in [record 2548678](https://zenodo.org/records/2548678) and [record 3082688](https://zenodo.org/records/3082688).
199
+ - There are multiple images of the same specimen for many specimens; sometimes this is due to different views (eg., dorsal or ventral side), sometimes it is due to JPG copies of the RAW photos, though it seems it is also sometimes that new photos were taken of the same specimen at a different times.
200
+ - The master files contain only images that were determined to be unique (at the pixel level) through MD5 checksum. This does _**not**_ guarantee that there are not images that are cropped copies of other photos. For instance, [record 2553977](https://zenodo.org/records/2553977) has a number of images with `_cut_` in their name, some of which are close-up crops of the butterfly wings (though not all, some are just close-ups of the full butterfly).
201
+
202
+ Please see [`README-supplemental.md`](https://huggingface.co/datasets/imageomics/Jiggins_Heliconius_Collection/blob/main/README-supplemental.md) for more details on the deduplication process and recommendations on how to split this data effectively without data leakage.
203
 
204
 
205
  ## Additional Information
 
209
  * Christopher Lawrence (Princeton University) - ORCID: 0000-0002-3846-5968
210
  * Chris Jiggins (University of Cambridge) - ORCID: 0000-0002-7809-062X
211
  * Butterfly Genetics Group (University of Cambridge)
212
+ * Elizabeth G. Campolongo (Imageomics Institute, The Ohio State University) - ORCID: 0000-0003-0846-2413
213
 
214
  ### Licensing Information
215
 
216
  The data (images and text) are all licensed under [Creative Commons Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0/). Each image and text in this dataset is provided under the least restrictive terms allowed by its licensing requirements as provided to us (i.e, we impose no additional restrictions past those specified by this license on the original source files). Modified images are only restricted by this original license.
217
 
218
+ Images can be matched to their source record through the `zenodo_link` or `record_number` column in the Master CSVs to the `url` or `record_number` in the [`licenses.json`](https://huggingface.co/datasets/imageomics/Jiggins_Heliconius_Collection/blob/main/metadata/licenses.json) file, respectively.
219
 
220
  ### Citation Information
221
 
222
+ Christopher Lawrence, Chris Jiggins, Butterfly Genetics Group (University of Cambridge), Elizabeth G. Campolongo. (2024). Jiggins Heliconius Collection. Hugging Face. https://huggingface.co/datasets/imageomics/Jiggins_Heliconius_Collection.
223
 
224
+ If you use this dataset, please cite the original datasets (bibtex citations for all 29 included Zenodo records are in [`jiggins.bib`](https://huggingface.co/datasets/imageomics/Jiggins_Heliconius_Collection/blob/main/metadata/jiggins.bib)) as well as this curated subset.
225
 
226
  ### Contributions
227
 
metadata/Jiggins_Zenodo_Img_Master_3477891Patch.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f4637db343cfed4e3be1f393485410dcc32a72bd1ccb648968f854f3a9045180
3
+ size 15528648
metadata/Jiggins_Zenodo_Master.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9df9c0adc7fb1a6c6456e36575644d925c3c3227eabbcbfbecaacf1fb15e85cb
3
+ size 14027841
metadata/Missing_taxa_download.csv ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ,CAMID,X,Image_name,View,zenodo_name,zenodo_link,Sequence,Taxonomic_Name,Locality,Sample_accession,Collected_by,Other_ID,Date,Dataset,Store,Brood,Death_Date,Cross_Type,Stage,Sex,Unit_Type,file_type,record_number,species,subspecies,genus,file_url,hybrid_stat,filename,filepath,md5
2
+ 20877,CAM021011,11461,CAM021011_v.JPG,ventral,CAM.coll.images.batch7.csv,https://zenodo.org/record/2702457,"21,011",Unknown,"Bakhuis-Nickerie Rd, Sipaliwini, Suriname",,,,21/02/2014,Heliconiine Butterfly Collection Records from University of Cambridge,Box 169,,,,,,wild,jpg,2702457,Unknown,,Unknown,https://zenodo.org/record/2702457/files/CAM021011_v.JPG,,11461_CAM021011_v.JPG,images/Unknown/11461_CAM021011_v.JPG,cb6d7f91d2f83ed52cfd07fceedc009e
3
+ 20878,CAM021011,11460,CAM021011_d.JPG,dorsal,CAM.coll.images.batch7.csv,https://zenodo.org/record/2702457,"21,011",Unknown,"Bakhuis-Nickerie Rd, Sipaliwini, Suriname",,,,21/02/2014,Heliconiine Butterfly Collection Records from University of Cambridge,Box 169,,,,,,wild,jpg,2702457,Unknown,,Unknown,https://zenodo.org/record/2702457/files/CAM021011_d.JPG,,11460_CAM021011_d.JPG,images/Unknown/11460_CAM021011_d.JPG,1da7bda432a4280f7de31929c91da9c0
4
+ 21877,CAM036326,41866,CAM036326_d.CR2,dorsal,Filelist.csv,https://zenodo.org/record/5561246,"36,326",Stratiomyidae,Reserva Serra Bonita - BSF02,,,,10/01/2021,,,,,,,Female,,raw,5561246,Stratiomyidae,,Stratiomyidae,https://zenodo.org/record/5561246/files/CAM036326_d.CR2,,41866_CAM036326_d.CR2,images/Stratiomyidae/41866_CAM036326_d.CR2,4d823bf9308f967d8c1b2ea9325dac1d
5
+ 21878,CAM036326,41867,CAM036326_d.JPG,dorsal,Filelist.csv,https://zenodo.org/record/5561246,"36,326",Stratiomyidae,Reserva Serra Bonita - BSF02,,,,10/01/2021,,,,,,,Female,,jpg,5561246,Stratiomyidae,,Stratiomyidae,https://zenodo.org/record/5561246/files/CAM036326_d.JPG,,41867_CAM036326_d.JPG,images/Stratiomyidae/41867_CAM036326_d.JPG,23d2d33583c31c83b3e36563418204b8
6
+ 21879,CAM036326,41868,CAM036326_v.CR2,ventral,Filelist.csv,https://zenodo.org/record/5561246,"36,326",Stratiomyidae,Reserva Serra Bonita - BSF02,,,,10/01/2021,,,,,,,Female,,raw,5561246,Stratiomyidae,,Stratiomyidae,https://zenodo.org/record/5561246/files/CAM036326_v.CR2,,41868_CAM036326_v.CR2,images/Stratiomyidae/41868_CAM036326_v.CR2,d4a628aa306aa7deafa93d2b913ba4de
7
+ 21880,CAM036326,41869,CAM036326_v.JPG,ventral,Filelist.csv,https://zenodo.org/record/5561246,"36,326",Stratiomyidae,Reserva Serra Bonita - BSF02,,,,10/01/2021,,,,,,,Female,,jpg,5561246,Stratiomyidae,,Stratiomyidae,https://zenodo.org/record/5561246/files/CAM036326_v.JPG,,41869_CAM036326_v.JPG,images/Stratiomyidae/41869_CAM036326_v.JPG,0a8ed38b8ad9755831bb796febaa624e
8
+ 21901,CAM036333,41891,CAM036333_d.JPG,dorsal,Filelist.csv,https://zenodo.org/record/5561246,"36,333",Unknown,Serra Bonita - SB15,,,,10/01/2021,,,,,,,,,jpg,5561246,Unknown,,Unknown,https://zenodo.org/record/5561246/files/CAM036333_d.JPG,,41891_CAM036333_d.JPG,images/Unknown/41891_CAM036333_d.JPG,5b7af8631a3e0525c9dd16a27be663be
9
+ 21902,CAM036333,41890,CAM036333_d.CR2,dorsal,Filelist.csv,https://zenodo.org/record/5561246,"36,333",Unknown,Serra Bonita - SB15,,,,10/01/2021,,,,,,,,,raw,5561246,Unknown,,Unknown,https://zenodo.org/record/5561246/files/CAM036333_d.CR2,,41890_CAM036333_d.CR2,images/Unknown/41890_CAM036333_d.CR2,2fdeaa8768deeab64a844bf3770e47b4
10
+ 21903,CAM036333,41892,CAM036333_v.CR2,ventral,Filelist.csv,https://zenodo.org/record/5561246,"36,333",Unknown,Serra Bonita - SB15,,,,10/01/2021,,,,,,,,,raw,5561246,Unknown,,Unknown,https://zenodo.org/record/5561246/files/CAM036333_v.CR2,,41892_CAM036333_v.CR2,images/Unknown/41892_CAM036333_v.CR2,820ba6c62e0a1ae0db1e254250a7f0db
11
+ 21904,CAM036333,41893,CAM036333_v.JPG,ventral,Filelist.csv,https://zenodo.org/record/5561246,"36,333",Unknown,Serra Bonita - SB15,,,,10/01/2021,,,,,,,,,jpg,5561246,Unknown,,Unknown,https://zenodo.org/record/5561246/files/CAM036333_v.JPG,,41893_CAM036333_v.JPG,images/Unknown/41893_CAM036333_v.JPG,fd16a59e931b8378694926e59357142d
12
+ 22179,CAM036462,42170,CAM036462_d.CR2,dorsal,Filelist.csv,https://zenodo.org/record/5561246,"36,462",Unknown,Itatiaia - PNI02,,,,19/01/2021,,,,,,,,,raw,5561246,Unknown,,Unknown,https://zenodo.org/record/5561246/files/CAM036462_d.CR2,,42170_CAM036462_d.CR2,images/Unknown/42170_CAM036462_d.CR2,cab7a0582ec986a14108af9c1180d3c0
13
+ 22180,CAM036462,42173,CAM036462_v.JPG,ventral,Filelist.csv,https://zenodo.org/record/5561246,"36,462",Unknown,Itatiaia - PNI02,,,,19/01/2021,,,,,,,,,jpg,5561246,Unknown,,Unknown,https://zenodo.org/record/5561246/files/CAM036462_v.JPG,,42173_CAM036462_v.JPG,images/Unknown/42173_CAM036462_v.JPG,5050b5da4e5e67039072311a28434827
14
+ 22181,CAM036462,42171,CAM036462_d.JPG,dorsal,Filelist.csv,https://zenodo.org/record/5561246,"36,462",Unknown,Itatiaia - PNI02,,,,19/01/2021,,,,,,,,,jpg,5561246,Unknown,,Unknown,https://zenodo.org/record/5561246/files/CAM036462_d.JPG,,42171_CAM036462_d.JPG,images/Unknown/42171_CAM036462_d.JPG,338ad84ff7b581ac05f769bcc3ca5dd1
15
+ 22182,CAM036462,42172,CAM036462_v.CR2,ventral,Filelist.csv,https://zenodo.org/record/5561246,"36,462",Unknown,Itatiaia - PNI02,,,,19/01/2021,,,,,,,,,raw,5561246,Unknown,,Unknown,https://zenodo.org/record/5561246/files/CAM036462_v.CR2,,42172_CAM036462_v.CR2,images/Unknown/42172_CAM036462_v.CR2,eb599df8f47280d3fac068ca078c5e49
16
+ 22183,CAM036463,42174,CAM036463_d.CR2,dorsal,Filelist.csv,https://zenodo.org/record/5561246,"36,463",Unknown,Itatiaia - PNI02,,,,19/01/2021,,,,,,,,,raw,5561246,Unknown,,Unknown,https://zenodo.org/record/5561246/files/CAM036463_d.CR2,,42174_CAM036463_d.CR2,images/Unknown/42174_CAM036463_d.CR2,c1bf2cb572385f2d5cf9183cb0a4c5e6
17
+ 22184,CAM036463,42177,CAM036463_v.JPG,ventral,Filelist.csv,https://zenodo.org/record/5561246,"36,463",Unknown,Itatiaia - PNI02,,,,19/01/2021,,,,,,,,,jpg,5561246,Unknown,,Unknown,https://zenodo.org/record/5561246/files/CAM036463_v.JPG,,42177_CAM036463_v.JPG,images/Unknown/42177_CAM036463_v.JPG,cc47f50ddd9c85c448ca45450d0aaae4
18
+ 22185,CAM036463,42175,CAM036463_d.JPG,dorsal,Filelist.csv,https://zenodo.org/record/5561246,"36,463",Unknown,Itatiaia - PNI02,,,,19/01/2021,,,,,,,,,jpg,5561246,Unknown,,Unknown,https://zenodo.org/record/5561246/files/CAM036463_d.JPG,,42175_CAM036463_d.JPG,images/Unknown/42175_CAM036463_d.JPG,877e0254a8570d45ad478a38af73c7dd
19
+ 22186,CAM036463,42176,CAM036463_v.CR2,ventral,Filelist.csv,https://zenodo.org/record/5561246,"36,463",Unknown,Itatiaia - PNI02,,,,19/01/2021,,,,,,,,,raw,5561246,Unknown,,Unknown,https://zenodo.org/record/5561246/files/CAM036463_v.CR2,,42176_CAM036463_v.CR2,images/Unknown/42176_CAM036463_v.CR2,a5cf90554748323ff20e75dee149f2d9
20
+ 26538,CAM041688,39719,CAM041688_d.JPG,dorsal,0.gmk.broods.all.csv,https://zenodo.org/record/4291095,"41,688",Unknown,Ikiam Road 1,,,69,,,Box 205,,,,,,,jpg,4291095,Unknown,,Unknown,https://zenodo.org/record/4291095/files/CAM041688_d.JPG,,39719_CAM041688_d.JPG,images/Unknown/39719_CAM041688_d.JPG,e896c5dd99a7d71d5507e319c1ddea48
21
+ 26539,CAM041688,39721,CAM041688_v.JPG,ventral,0.gmk.broods.all.csv,https://zenodo.org/record/4291095,"41,688",Unknown,Ikiam Road 1,,,69,,,Box 205,,,,,,,jpg,4291095,Unknown,,Unknown,https://zenodo.org/record/4291095/files/CAM041688_v.JPG,,39721_CAM041688_v.JPG,images/Unknown/39721_CAM041688_v.JPG,047221dfc524f435fe46fad83f17bfd2
22
+ 26540,CAM041688,39718,CAM041688_d.CR2,dorsal,0.gmk.broods.all.csv,https://zenodo.org/record/4291095,"41,688",Unknown,Ikiam Road 1,,,69,,,Box 205,,,,,,,raw,4291095,Unknown,,Unknown,https://zenodo.org/record/4291095/files/CAM041688_d.CR2,,39718_CAM041688_d.CR2,images/Unknown/39718_CAM041688_d.CR2,0fe53cb80d6c6bd91b75d7ba9eb2fa7c
23
+ 26541,CAM041688,39720,CAM041688_v.CR2,ventral,0.gmk.broods.all.csv,https://zenodo.org/record/4291095,"41,688",Unknown,Ikiam Road 1,,,69,,,Box 205,,,,,,,raw,4291095,Unknown,,Unknown,https://zenodo.org/record/4291095/files/CAM041688_v.CR2,,39720_CAM041688_v.CR2,images/Unknown/39720_CAM041688_v.CR2,c314f8c58aa414cc04f04b8ab03f43ce
metadata/deduplication/Jiggins_Zenodo_Img_Master_3477891Patch_checksums.csv ADDED
The diff for this file is too large to render. See raw diff
 
metadata/deduplication/Jiggins_Zenodo_Img_Master_3477891Patch_downloaded.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f072f8db4287853ef187075b9e5f6b120a75e08cce0892ce289b1de56b086dbe
3
+ size 19388136
metadata/deduplication/Jiggins_Zenodo_Img_Master_3477891Patch_error_log.csv ADDED
The diff for this file is too large to render. See raw diff
 
metadata/deduplication/Jiggins_Zenodo_Img_Master_3477891Patch_error_log_(readable).json ADDED
The diff for this file is too large to render. See raw diff
 
metadata/deduplication/Jiggins_Zenodo_Img_Master_3477891Patch_log_(readable).json ADDED
The diff for this file is too large to render. See raw diff
 
metadata/jiggins.bib ADDED
@@ -0,0 +1,292 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @misc{gabriela_montejo_kovacevich_2020_4289223,
2
+ author = {Gabriela Montejo-Kovacevich and Eva van der Heijden and Nicola Nadeau and Chris Jiggins},
3
+ title = {Cambridge butterfly wing collection batch 10},
4
+ month = nov,
5
+ year = 2020,
6
+ publisher = {Zenodo},
7
+ doi = {10.5281/zenodo.4289223},
8
+ url = {https://doi.org/10.5281/zenodo.4289223}
9
+ }
10
+
11
+ @misc{patricio_a_salazar_2020_4288311,
12
+ author = {Patricio A. Salazar and Nicola Nadeau and Gabriela Montejo-Kovacevich and Chris Jiggins},
13
+ title = {{Sheffield butterfly wing collection - Patricio Salazar, Nicola Nadeau, Ikiam broods batch 1 and 2}},
14
+ month = nov,
15
+ year = 2020,
16
+ publisher = {Zenodo},
17
+ doi = {10.5281/zenodo.4288311},
18
+ url = {https://doi.org/10.5281/zenodo.4288311}
19
+ }
20
+
21
+ @misc{montejo_kovacevich_2019_2677821,
22
+ author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian},
23
+ title = {Cambridge butterfly wing collection batch 2},
24
+ month = may,
25
+ year = 2019,
26
+ publisher = {Zenodo},
27
+ doi = {10.5281/zenodo.2677821},
28
+ url = {https://doi.org/10.5281/zenodo.2677821}
29
+ }
30
+
31
+ @misc{jiggins_2019_2682458,
32
+ author = {Jiggins, Chris and Montejo-Kovacevich, Gabriela and Warren, Ian and Wiltshire, Eva},
33
+ title = {Cambridge butterfly wing collection batch 3},
34
+ month = may,
35
+ year = 2019,
36
+ publisher = {Zenodo},
37
+ doi = {10.5281/zenodo.2682458},
38
+ url = {https://doi.org/10.5281/zenodo.2682458}
39
+ }
40
+
41
+ @misc{montejo_kovacevich_2019_2682669,
42
+ author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian},
43
+ title = {Cambridge butterfly wing collection batch 4},
44
+ month = may,
45
+ year = 2019,
46
+ publisher = {Zenodo},
47
+ doi = {10.5281/zenodo.2682669},
48
+ url = {https://doi.org/10.5281/zenodo.2682669}
49
+ }
50
+
51
+ @misc{montejo_kovacevich_2019_2684906,
52
+ author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian and Wiltshire, Eva},
53
+ title = {Cambridge butterfly wing collection batch 5},
54
+ month = may,
55
+ year = 2019,
56
+ publisher = {Zenodo},
57
+ doi = {10.5281/zenodo.2684906},
58
+ url = {https://doi.org/10.5281/zenodo.2684906}
59
+ }
60
+
61
+ @misc{warren_2019_2552371,
62
+ author = {Warren, Ian and Jiggins, Chris},
63
+ title = {{Miscellaneous Heliconius wing photographs (2001-2019) Part 1}},
64
+ month = feb,
65
+ year = 2019,
66
+ publisher = {Zenodo},
67
+ doi = {10.5281/zenodo.2552371},
68
+ url = {https://doi.org/10.5281/zenodo.2552371}
69
+ }
70
+
71
+ @misc{warren_2019_2553977,
72
+ author = {Warren, Ian and Jiggins, Chris},
73
+ title = {{Miscellaneous Heliconius wing photographs (2001-2019) Part 3}},
74
+ month = feb,
75
+ year = 2019,
76
+ publisher = {Zenodo},
77
+ doi = {10.5281/zenodo.2553977},
78
+ url = {https://doi.org/10.5281/zenodo.2553977}
79
+ }
80
+
81
+ @misc{montejo_kovacevich_2019_2686762,
82
+ author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian and Wiltshire, Eva},
83
+ title = {Cambridge butterfly wing collection batch 6},
84
+ month = may,
85
+ year = 2019,
86
+ publisher = {Zenodo},
87
+ doi = {10.5281/zenodo.2686762},
88
+ url = {https://doi.org/10.5281/zenodo.2686762}
89
+ }
90
+
91
+ @misc{jiggins_2019_2549524,
92
+ author = {Jiggins, Chris and Warren, Ian},
93
+ title = {{Cambridge butterfly wing collection - Chris Jiggins 2001/2 broods batch 1}},
94
+ month = jan,
95
+ year = 2019,
96
+ publisher = {Zenodo},
97
+ version = 1,
98
+ doi = {10.5281/zenodo.2549524},
99
+ url = {https://doi.org/10.5281/zenodo.2549524}
100
+ }
101
+
102
+ @misc{jiggins_2019_2550097,
103
+ author = {Jiggins, Chris and Warren, Ian},
104
+ title = {{Cambridge butterfly wing collection - Chris Jiggins 2001/2 broods batch 2}},
105
+ month = jan,
106
+ year = 2019,
107
+ publisher = {Zenodo},
108
+ version = 1,
109
+ doi = {10.5281/zenodo.2550097},
110
+ url = {https://doi.org/10.5281/zenodo.2550097}
111
+ }
112
+
113
+ @misc{joana_i_meier_2020_4153502,
114
+ author = {Joana I. Meier and Patricio Salazar and Gabriela Montejo-Kovacevich and Ian Warren and Chris Jggins},
115
+ title = {{Cambridge butterfly wing collection - Patricio Salazar PhD wild specimens batch 3}},
116
+ month = oct,
117
+ year = 2020,
118
+ publisher = {Zenodo},
119
+ doi = {10.5281/zenodo.4153502},
120
+ url = {https://doi.org/10.5281/zenodo.4153502}
121
+ }
122
+
123
+ @misc{montejo_kovacevich_2019_3082688,
124
+ author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian},
125
+ title = {{Cambridge butterfly wing collection batch 1- version 2}},
126
+ month = may,
127
+ year = 2019,
128
+ publisher = {Zenodo},
129
+ doi = {10.5281/zenodo.3082688},
130
+ url = {https://doi.org/10.5281/zenodo.3082688}
131
+ }
132
+
133
+ @misc{montejo_kovacevich_2019_2813153,
134
+ author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian and Salazar, Camilo and Elias, Marianne and Gavins, Imogen and Wiltshire, Eva and Montgomery, Stephen and McMillan, Owen},
135
+ title = {{Cambridge and collaborators butterfly wing collection batch 10}},
136
+ month = may,
137
+ year = 2019,
138
+ publisher = {Zenodo},
139
+ doi = {10.5281/zenodo.2813153},
140
+ url = {https://doi.org/10.5281/zenodo.2813153}
141
+ }
142
+
143
+ @misc{salazar_2018_1748277,
144
+ author = {Salazar, Patricio and Montejo-Kovacevich, Gabriela and Warren, Ian and Jiggins, Chris},
145
+ title = {{Cambridge butterfly wing collection - Patricio Salazar PhD wild and bred specimens batch 1}},
146
+ month = dec,
147
+ year = 2018,
148
+ publisher = {Zenodo},
149
+ doi = {10.5281/zenodo.1748277},
150
+ url = {https://doi.org/10.5281/zenodo.1748277}
151
+ }
152
+
153
+ @misc{montejo_kovacevich_2019_2702457,
154
+ author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian and Wiltshire, Eva},
155
+ title = {Cambridge butterfly wing collection batch 7},
156
+ month = may,
157
+ year = 2019,
158
+ publisher = {Zenodo},
159
+ doi = {10.5281/zenodo.2702457},
160
+ url = {https://doi.org/10.5281/zenodo.2702457}
161
+ }
162
+
163
+ @misc{salazar_2019_2548678,
164
+ author = {Salazar, Patricio and Montejo-Kovacevich, Gabriela and Warren, Ian and Jiggins, Chris},
165
+ title = {{Cambridge butterfly wing collection - Patricio Salazar PhD wild and bred specimens batch 2}},
166
+ month = jan,
167
+ year = 2019,
168
+ publisher = {Zenodo},
169
+ doi = {10.5281/zenodo.2548678},
170
+ url = {https://doi.org/10.5281/zenodo.2548678}
171
+ }
172
+
173
+ @misc{pinheiro_de_castro_2022_5561246,
174
+ author = {Pinheiro de Castro, Erika and Jiggins, Christopher and Lucas da Silva-Brand\u00e3o, Karina and Victor Lucci Freitas, Andre and Zikan Cardoso, Marcio and Van Der Heijden, Eva and Meier, Joana and Warren, Ian},
175
+ title = {{Brazilian Butterflies Collected December 2020 to January 2021}},
176
+ month = feb,
177
+ year = 2022,
178
+ publisher = {Zenodo},
179
+ doi = {10.5281/zenodo.5561246},
180
+ url = {https://doi.org/10.5281/zenodo.5561246}
181
+ }
182
+
183
+ @misc{montejo_kovacevich_2019_2707828,
184
+ author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian and Wiltshire, Eva},
185
+ title = {Cambridge butterfly wing collection batch 8},
186
+ month = may,
187
+ year = 2019,
188
+ publisher = {Zenodo},
189
+ doi = {10.5281/zenodo.2707828},
190
+ url = {https://doi.org/10.5281/zenodo.2707828}
191
+ }
192
+
193
+ @misc{montejo_kovacevich_2019_2714333,
194
+ author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian and Wiltshire, Eva and Gavins, Imogen},
195
+ title = {Cambridge butterfly wing collection batch 9},
196
+ month = may,
197
+ year = 2019,
198
+ publisher = {Zenodo},
199
+ doi = {10.5281/zenodo.2714333},
200
+ url = {https://doi.org/10.5281/zenodo.2714333}
201
+ }
202
+
203
+ @misc{gabriela_montejo_kovacevich_2020_4291095,
204
+ author = {Gabriela Montejo-Kovacevich and Eva van der Heijden and Chris Jiggins},
205
+ title = {{Cambridge butterfly collection - GMK Broods Ikiam 2018}},
206
+ month = nov,
207
+ year = 2020,
208
+ publisher = {Zenodo},
209
+ doi = {10.5281/zenodo.4291095},
210
+ url = {https://doi.org/10.5281/zenodo.4291095}
211
+ }
212
+
213
+ @misc{gabriela_montejo_kovacevich_2019_3569598,
214
+ author = {Gabriela Montejo-Kovacevich and Letitia Cookson and Eva van der Heijden and Ian Warren and David P. Edwards and Chris Jiggins},
215
+ title = {Cambridge butterfly collection - Loreto, Peru 2018},
216
+ month = dec,
217
+ year = 2019,
218
+ publisher = {Zenodo},
219
+ version = {1.0.0},
220
+ doi = {10.5281/zenodo.3569598},
221
+ url = {https://doi.org/10.5281/zenodo.3569598}
222
+ }
223
+
224
+ @misc{gabriela_montejo_kovacevich_2020_4287444,
225
+ author = {Gabriela Montejo-Kovacevich and Letitia Cookson and Eva van der Heijden and Ian Warren and David P. Edwards and Chris Jiggins},
226
+ title = {{Cambridge butterfly collection - Loreto, Peru 2018 batch2}},
227
+ month = nov,
228
+ year = 2020,
229
+ publisher = {Zenodo},
230
+ doi = {10.5281/zenodo.4287444},
231
+ url = {https://doi.org/10.5281/zenodo.4287444}
232
+ }
233
+
234
+ @misc{gabriela_montejo_kovacevich_2020_4288250,
235
+ author = {Gabriela Montejo-Kovacevich and Letitia Cookson and Eva van der Heijden and Ian Warren and David P. Edwards and Chris Jiggins},
236
+ title = {{Cambridge butterfly collection - Loreto, Peru 2018 batch3}},
237
+ month = nov,
238
+ year = 2020,
239
+ publisher = {Zenodo},
240
+ doi = {10.5281/zenodo.4288250},
241
+ url = {https://doi.org/10.5281/zenodo.4288250}
242
+ }
243
+
244
+ @misc{montejo_kovacevich_2021_5526257,
245
+ author = {Montejo-Kovacevich, Gabriela and Paynter, Quentin and Ghane, Amin},
246
+ title = {{Heliconius erato cyrbia, Cook Islands (New Zealand) 2016, 2019, 2021}},
247
+ month = sep,
248
+ year = 2021,
249
+ publisher = {Zenodo},
250
+ doi = {10.5281/zenodo.5526257},
251
+ url = {https://doi.org/10.5281/zenodo.5526257}
252
+ }
253
+
254
+ @misc{warren_2019_2553501,
255
+ author = {Warren, Ian and Jiggins, Chris},
256
+ title = {{Miscellaneous Heliconius wing photographs (2001-2019) Part 2}},
257
+ month = feb,
258
+ year = 2019,
259
+ publisher = {Zenodo},
260
+ doi = {10.5281/zenodo.2553501},
261
+ url = {https://doi.org/10.5281/zenodo.2553501}
262
+ }
263
+
264
+ @misc{salazar_2019_2735056,
265
+ author = {Salazar, Camilo and Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian and Gavins, Imogen},
266
+ title = {{Camilo Salazar and Cambridge butterfly wing collection batch 1}},
267
+ month = may,
268
+ year = 2019,
269
+ publisher = {Zenodo},
270
+ doi = {10.5281/zenodo.2735056},
271
+ url = {https://doi.org/10.5281/zenodo.2735056}
272
+ }
273
+
274
+ @misc{mattila_2019_2554218,
275
+ author = {Mattila, Anniina and Jiggins, Chris and Warren, Ian},
276
+ title = {{University of Helsinki butterfly wing collection - Anniina Mattila field caught specimens}},
277
+ month = feb,
278
+ year = 2019,
279
+ publisher = {Zenodo},
280
+ doi = {10.5281/zenodo.2554218},
281
+ url = {https://doi.org/10.5281/zenodo.2554218}
282
+ }
283
+
284
+ @misc{mattila_2019_2555086,
285
+ author = {Mattila, Anniina and Jiggins, Chris and Warren, Ian},
286
+ title = {{University of Helsinki butterfly collection - Anniina Mattila bred specimens}},
287
+ month = feb,
288
+ year = 2019,
289
+ publisher = {Zenodo},
290
+ doi = {10.5281/zenodo.2555086},
291
+ url = {https://doi.org/10.5281/zenodo.2555086}
292
+ }
metadata/licenses.json CHANGED
@@ -1 +1,205 @@
1
- [{"record_number": "4289223", "url": "https://zenodo.org/record/4289223", "license": "cc-by-4.0", "citation": "Montejo-Kovacevich, G., van der Heijden, E., Nadeau, N., & Jiggins, C. (2020 , November). Cambridge butterfly wing collection batch 10. Zenodo. https://doi.org/10.5281/zenodo.4289223", "bibtex": "@misc{gabriela_montejo_kovacevich_2020_4289223, author = {Gabriela Montejo-Kovacevich and Eva van der Heijden and Nicola Nadeau and Chris Jiggins}, title = {Cambridge butterfly wing collection batch 10}, month = nov, year = 2020, publisher = {Zenodo}, doi = {10.5281/zenodo.4289223}, url = {https://doi.org/10.5281/zenodo.4289223} }"}, {"record_number": "4288311", "url": "https://zenodo.org/record/4288311", "license": "cc-by-4.0", "citation": "Salazar, P. A., Nadeau, N., Montejo-Kovacevich, G., & Jiggins, C. (2020 , November). Sheffield butterfly wing collection - Patricio Salazar, Nicola Nadeau, Ikiam broods batch 1 and 2. Zenodo. https://doi.org/10.5281/zenodo.4288311", "bibtex": "@misc{patricio_a_salazar_2020_4288311, author = {Patricio A. Salazar and Nicola Nadeau and Gabriela Montejo-Kovacevich and Chris Jiggins}, title = {{Sheffield butterfly wing collection - Patricio Salazar, Nicola Nadeau, Ikiam broods batch 1 and 2}}, month = nov, year = 2020, publisher = {Zenodo}, doi = {10.5281/zenodo.4288311}, url = {https://doi.org/10.5281/zenodo.4288311} }"}, {"record_number": "2677821", "url": "https://zenodo.org/record/2677821", "license": "cc-by-4.0", "citation": "Montejo-Kovacevich, G., Jiggins, C., & Warren, I. (2019 , May). Cambridge butterfly wing collection batch 2. Zenodo. https://doi.org/10.5281/zenodo.2677821", "bibtex": "@misc{montejo_kovacevich_2019_2677821, author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian}, title = {Cambridge butterfly wing collection batch 2}, month = may, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2677821}, url = {https://doi.org/10.5281/zenodo.2677821} }"}, {"record_number": "3477891", "url": "https://zenodo.org/record/3477891", "license": "cc-by-4.0", "citation": "Jiggins, C., Montejo-Kovacevich, G., Salazar, P., & Warren, I. (2019 , October). Heliconiine Butterfly Collection Records from University of Cambridge. Zenodo. https://doi.org/10.5281/zenodo.3477891", "bibtex": "@misc{chris_jiggins_2019_3477891, author = {Chris Jiggins and Gabriela Montejo-Kovacevich and Patricio Salazar and Ian Warren}, title = {{Heliconiine Butterfly Collection Records from University of Cambridge}}, month = oct, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.3477891}, url = {https://doi.org/10.5281/zenodo.3477891} }"}, {"record_number": "2682458", "url": "https://zenodo.org/record/2682458", "license": "cc-by-4.0", "citation": "Jiggins, C., Montejo-Kovacevich, G., Warren, I., & Wiltshire, E. (2019 , May). Cambridge butterfly wing collection batch 3. Zenodo. https://doi.org/10.5281/zenodo.2682458", "bibtex": "@misc{jiggins_2019_2682458, author = {Jiggins, Chris and Montejo-Kovacevich, Gabriela and Warren, Ian and Wiltshire, Eva}, title = {Cambridge butterfly wing collection batch 3}, month = may, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2682458}, url = {https://doi.org/10.5281/zenodo.2682458} }"}, {"record_number": "2682669", "url": "https://zenodo.org/record/2682669", "license": "cc-by-4.0", "citation": "Montejo-Kovacevich, G., Jiggins, C., & Warren, I. (2019 , May). Cambridge butterfly wing collection batch 4. Zenodo. https://doi.org/10.5281/zenodo.2682669", "bibtex": "@misc{montejo_kovacevich_2019_2682669, author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian}, title = {Cambridge butterfly wing collection batch 4}, month = may, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2682669}, url = {https://doi.org/10.5281/zenodo.2682669} }"}, {"record_number": "2684906", "url": "https://zenodo.org/record/2684906", "license": "cc-by-4.0", "citation": "Montejo-Kovacevich, G., Jiggins, C., Warren, I., & Wiltshire, E. (2019 , May). Cambridge butterfly wing collection batch 5. Zenodo. https://doi.org/10.5281/zenodo.2684906", "bibtex": "@misc{montejo_kovacevich_2019_2684906, author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian and Wiltshire, Eva}, title = {Cambridge butterfly wing collection batch 5}, month = may, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2684906}, url = {https://doi.org/10.5281/zenodo.2684906} }"}, {"record_number": "2552371", "url": "https://zenodo.org/record/2552371", "license": "cc-by-4.0", "citation": "Warren, I. & Jiggins, C. (2019 , February). Miscellaneous Heliconius wing photographs (2001-2019) Part 1. Zenodo. https://doi.org/10.5281/zenodo.2552371", "bibtex": "@misc{warren_2019_2552371, author = {Warren, Ian and Jiggins, Chris}, title = {{Miscellaneous Heliconius wing photographs (2001-2019) Part 1}}, month = feb, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2552371}, url = {https://doi.org/10.5281/zenodo.2552371} }"}, {"record_number": "2553977", "url": "https://zenodo.org/record/2553977", "license": "cc-by-4.0", "citation": "Warren, I. & Jiggins, C. (2019 , February). Miscellaneous Heliconius wing photographs (2001-2019) Part 3. Zenodo. https://doi.org/10.5281/zenodo.2553977", "bibtex": "@misc{warren_2019_2553977, author = {Warren, Ian and Jiggins, Chris}, title = {{Miscellaneous Heliconius wing photographs (2001-2019) Part 3}}, month = feb, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2553977}, url = {https://doi.org/10.5281/zenodo.2553977} }"}, {"record_number": "2686762", "url": "https://zenodo.org/record/2686762", "license": "cc-by-4.0", "citation": "Montejo-Kovacevich, G., Jiggins, C., Warren, I., & Wiltshire, E. (2019 , May). Cambridge butterfly wing collection batch 6. Zenodo. https://doi.org/10.5281/zenodo.2686762", "bibtex": "@misc{montejo_kovacevich_2019_2686762, author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian and Wiltshire, Eva}, title = {Cambridge butterfly wing collection batch 6}, month = may, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2686762}, url = {https://doi.org/10.5281/zenodo.2686762} }"}, {"record_number": "2549524", "url": "https://zenodo.org/record/2549524", "license": "cc-by-4.0", "citation": "Jiggins, C. & Warren, I. (2019 , January). Cambridge butterfly wing collection - Chris Jiggins 2001/2 broods batch 1. Zenodo. https://doi.org/10.5281/zenodo.2549524", "bibtex": "@misc{jiggins_2019_2549524, author = {Jiggins, Chris and Warren, Ian}, title = {{Cambridge butterfly wing collection - Chris Jiggins 2001/2 broods batch 1}}, month = jan, year = 2019, publisher = {Zenodo}, version = 1, doi = {10.5281/zenodo.2549524}, url = {https://doi.org/10.5281/zenodo.2549524} }"}, {"record_number": "2550097", "url": "https://zenodo.org/record/2550097", "license": "cc-by-4.0", "citation": "Jiggins, C. & Warren, I. (2019 , January). Cambridge butterfly wing collection - Chris Jiggins 2001/2 broods batch 2. Zenodo. https://doi.org/10.5281/zenodo.2550097", "bibtex": "@misc{jiggins_2019_2550097, author = {Jiggins, Chris and Warren, Ian}, title = {{Cambridge butterfly wing collection - Chris Jiggins 2001/2 broods batch 2}}, month = jan, year = 2019, publisher = {Zenodo}, version = 1, doi = {10.5281/zenodo.2550097}, url = {https://doi.org/10.5281/zenodo.2550097} }"}, {"record_number": "4153502", "url": "https://zenodo.org/record/4153502", "license": "cc-by-4.0", "citation": "Meier, J. I., Salazar, P., Montejo-Kovacevich, G., Warren, I., & Jggins, C. (2020 , October). Cambridge butterfly wing collection - Patricio Salazar PhD wild specimens batch 3. Zenodo. https://doi.org/10.5281/zenodo.4153502", "bibtex": "@misc{joana_i_meier_2020_4153502, author = {Joana I. Meier and Patricio Salazar and Gabriela Montejo-Kovacevich and Ian Warren and Chris Jggins}, title = {{Cambridge butterfly wing collection - Patricio Salazar PhD wild specimens batch 3}}, month = oct, year = 2020, publisher = {Zenodo}, doi = {10.5281/zenodo.4153502}, url = {https://doi.org/10.5281/zenodo.4153502} }"}, {"record_number": "3082688", "url": "https://zenodo.org/record/3082688", "license": "cc-by-4.0", "citation": "Montejo-Kovacevich, G., Jiggins, C., & Warren, I. (2019 , May). Cambridge butterfly wing collection batch 1- version 2. Zenodo. https://doi.org/10.5281/zenodo.3082688", "bibtex": "@misc{montejo_kovacevich_2019_3082688, author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian}, title = {{Cambridge butterfly wing collection batch 1- version 2}}, month = may, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.3082688}, url = {https://doi.org/10.5281/zenodo.3082688} }"}, {"record_number": "2813153", "url": "https://zenodo.org/record/2813153", "license": "cc-by-4.0", "citation": "Montejo-Kovacevich, G., Jiggins, C., Warren, I., Salazar, C., Elias, M., Gavins, I., Wiltshire, E., Montgomery, S., & McMillan, O. (2019 , May). Cambridge and collaborators butterfly wing collection batch 10. Zenodo. https://doi.org/10.5281/zenodo.2813153", "bibtex": "@misc{montejo_kovacevich_2019_2813153, author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian and Salazar, Camilo and Elias, Marianne and Gavins, Imogen and Wiltshire, Eva and Montgomery, Stephen and McMillan, Owen}, title = {{Cambridge and collaborators butterfly wing collection batch 10}}, month = may, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2813153}, url = {https://doi.org/10.5281/zenodo.2813153} }"}, {"record_number": "1748277", "url": "https://zenodo.org/record/1748277", "license": "cc-by-4.0", "citation": "Salazar, P., Montejo-Kovacevich, G., Warren, I., & Jiggins, C. (2018 , December). Cambridge butterfly wing collection - Patricio Salazar PhD wild and bred specimens batch 1. Zenodo. https://doi.org/10.5281/zenodo.1748277", "bibtex": "@misc{salazar_2018_1748277, author = {Salazar, Patricio and Montejo-Kovacevich, Gabriela and Warren, Ian and Jiggins, Chris}, title = {{Cambridge butterfly wing collection - Patricio Salazar PhD wild and bred specimens batch 1}}, month = dec, year = 2018, publisher = {Zenodo}, doi = {10.5281/zenodo.1748277}, url = {https://doi.org/10.5281/zenodo.1748277} }"}, {"record_number": "2702457", "url": "https://zenodo.org/record/2702457", "license": "cc-by-4.0", "citation": "Montejo-Kovacevich, G., Jiggins, C., Warren, I., & Wiltshire, E. (2019 , May). Cambridge butterfly wing collection batch 7. Zenodo. https://doi.org/10.5281/zenodo.2702457", "bibtex": "@misc{montejo_kovacevich_2019_2702457, author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian and Wiltshire, Eva}, title = {Cambridge butterfly wing collection batch 7}, month = may, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2702457}, url = {https://doi.org/10.5281/zenodo.2702457} }"}, {"record_number": "2548678", "url": "https://zenodo.org/record/2548678", "license": "cc-by-4.0", "citation": "Salazar, P., Montejo-Kovacevich, G., Warren, I., & Jiggins, C. (2019 , January). Cambridge butterfly wing collection - Patricio Salazar PhD wild and bred specimens batch 2. Zenodo. https://doi.org/10.5281/zenodo.2548678", "bibtex": "@misc{salazar_2019_2548678, author = {Salazar, Patricio and Montejo-Kovacevich, Gabriela and Warren, Ian and Jiggins, Chris}, title = {{Cambridge butterfly wing collection - Patricio Salazar PhD wild and bred specimens batch 2}}, month = jan, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2548678}, url = {https://doi.org/10.5281/zenodo.2548678} }"}, {"record_number": "5561246", "url": "https://zenodo.org/record/5561246", "license": "cc-by-4.0", "citation": "Pinheiro de Castro, E., Jiggins, C., Lucas da Silva-Brand\u00e3o, K., Victor Lucci Freitas, A., Zikan Cardoso, M., Van Der Heijden, E., Meier, J., & Warren, I. (2022 , February). Brazilian Butterflies Collected December 2020 to January 2021. Zenodo. https://doi.org/10.5281/zenodo.5561246", "bibtex": "@misc{pinheiro_de_castro_2022_5561246, author = {Pinheiro de Castro, Erika and Jiggins, Christopher and Lucas da Silva-Brand\u00e3o, Karina and Victor Lucci Freitas, Andre and Zikan Cardoso, Marcio and Van Der Heijden, Eva and Meier, Joana and Warren, Ian}, title = {{Brazilian Butterflies Collected December 2020 to January 2021}}, month = feb, year = 2022, publisher = {Zenodo}, doi = {10.5281/zenodo.5561246}, url = {https://doi.org/10.5281/zenodo.5561246} }"}, {"record_number": "2707828", "url": "https://zenodo.org/record/2707828", "license": "cc-by-4.0", "citation": "Montejo-Kovacevich, G., Jiggins, C., Warren, I., & Wiltshire, E. (2019 , May). Cambridge butterfly wing collection batch 8. Zenodo. https://doi.org/10.5281/zenodo.2707828", "bibtex": "@misc{montejo_kovacevich_2019_2707828, author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian and Wiltshire, Eva}, title = {Cambridge butterfly wing collection batch 8}, month = may, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2707828}, url = {https://doi.org/10.5281/zenodo.2707828} }"}, {"record_number": "2714333", "url": "https://zenodo.org/record/2714333", "license": "cc-by-4.0", "citation": "Montejo-Kovacevich, G., Jiggins, C., Warren, I., Wiltshire, E., & Gavins, I. (2019 , May). Cambridge butterfly wing collection batch 9. Zenodo. https://doi.org/10.5281/zenodo.2714333", "bibtex": "@misc{montejo_kovacevich_2019_2714333, author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian and Wiltshire, Eva and Gavins, Imogen}, title = {Cambridge butterfly wing collection batch 9}, month = may, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2714333}, url = {https://doi.org/10.5281/zenodo.2714333} }"}, {"record_number": "4291095", "url": "https://zenodo.org/record/4291095", "license": "cc-by-4.0", "citation": "Montejo-Kovacevich, G., van der Heijden, E., & Jiggins, C. (2020 , November). Cambridge butterfly collection - GMK Broods Ikiam 2018. Zenodo. https://doi.org/10.5281/zenodo.4291095", "bibtex": "@misc{gabriela_montejo_kovacevich_2020_4291095, author = {Gabriela Montejo-Kovacevich and Eva van der Heijden and Chris Jiggins}, title = {{Cambridge butterfly collection - GMK Broods Ikiam 2018}}, month = nov, year = 2020, publisher = {Zenodo}, doi = {10.5281/zenodo.4291095}, url = {https://doi.org/10.5281/zenodo.4291095} }"}, {"record_number": "5731587", "url": "https://zenodo.org/record/5731587", "license": "cc-by-4.0", "citation": "Meier, J., Barker, A., Jiggins, C., Warren, I., & Blow, R. (2021 , November). Cambridge butterfly wing collection - Ecuador, August 2019. Zenodo. https://doi.org/10.5281/zenodo.5731587", "bibtex": "@misc{joana_meier_2021_5731587, author = {Joana Meier and Annalie Barker and Chris Jiggins and Ian Warren and Rachel Blow}, title = {{Cambridge butterfly wing collection - Ecuador, August 2019}}, month = nov, year = 2021, publisher = {Zenodo}, version = {version 1}, doi = {10.5281/zenodo.5731587}, url = {https://doi.org/10.5281/zenodo.5731587} }"}, {"record_number": "3569598", "url": "https://zenodo.org/record/3569598", "license": "cc-by-4.0", "citation": "Montejo-Kovacevich, G., Cookson, L., van der Heijden, E., Warren, I., Edwards, D. P., & Jiggins, C. (2019 , December). Cambridge butterfly collection - Loreto, Peru 2018. Zenodo. https://doi.org/10.5281/zenodo.3569598", "bibtex": "@misc{gabriela_montejo_kovacevich_2019_3569598, author = {Gabriela Montejo-Kovacevich and Letitia Cookson and Eva van der Heijden and Ian Warren and David P. Edwards and Chris Jiggins}, title = {Cambridge butterfly collection - Loreto, Peru 2018}, month = dec, year = 2019, publisher = {Zenodo}, version = {1.0.0}, doi = {10.5281/zenodo.3569598}, url = {https://doi.org/10.5281/zenodo.3569598} }"}, {"record_number": "4287444", "url": "https://zenodo.org/record/4287444", "license": "cc-by-4.0", "citation": "Montejo-Kovacevich, G., Cookson, L., van der Heijden, E., Warren, I., Edwards, D. P., & Jiggins, C. (2020 , November). Cambridge butterfly collection - Loreto, Peru 2018 batch2. Zenodo. https://doi.org/10.5281/zenodo.4287444", "bibtex": "@misc{gabriela_montejo_kovacevich_2020_4287444, author = {Gabriela Montejo-Kovacevich and Letitia Cookson and Eva van der Heijden and Ian Warren and David P. Edwards and Chris Jiggins}, title = {{Cambridge butterfly collection - Loreto, Peru 2018 batch2}}, month = nov, year = 2020, publisher = {Zenodo}, doi = {10.5281/zenodo.4287444}, url = {https://doi.org/10.5281/zenodo.4287444} }"}, {"record_number": "4288250", "url": "https://zenodo.org/record/4288250", "license": "cc-by-4.0", "citation": "Montejo-Kovacevich, G., Cookson, L., van der Heijden, E., Warren, I., Edwards, D. P., & Jiggins, C. (2020 , November). Cambridge butterfly collection - Loreto, Peru 2018 batch3. Zenodo. https://doi.org/10.5281/zenodo.4288250", "bibtex": "@misc{gabriela_montejo_kovacevich_2020_4288250, author = {Gabriela Montejo-Kovacevich and Letitia Cookson and Eva van der Heijden and Ian Warren and David P. Edwards and Chris Jiggins}, title = {{Cambridge butterfly collection - Loreto, Peru 2018 batch3}}, month = nov, year = 2020, publisher = {Zenodo}, doi = {10.5281/zenodo.4288250}, url = {https://doi.org/10.5281/zenodo.4288250} }"}, {"record_number": "5526257", "url": "https://zenodo.org/record/5526257", "license": "cc-by-4.0", "citation": "Montejo-Kovacevich, G., Paynter, Q., & Ghane, A. (2021 , September). Heliconius erato cyrbia, Cook Islands (New Zealand) 2016, 2019, 2021. Zenodo. https://doi.org/10.5281/zenodo.5526257", "bibtex": "@misc{montejo_kovacevich_2021_5526257, author = {Montejo-Kovacevich, Gabriela and Paynter, Quentin and Ghane, Amin}, title = {{Heliconius erato cyrbia, Cook Islands (New Zealand) 2016, 2019, 2021}}, month = sep, year = 2021, publisher = {Zenodo}, doi = {10.5281/zenodo.5526257}, url = {https://doi.org/10.5281/zenodo.5526257} }"}, {"record_number": "2553501", "url": "https://zenodo.org/record/2553501", "license": "cc-by-4.0", "citation": "Warren, I. & Jiggins, C. (2019 , February). Miscellaneous Heliconius wing photographs (2001-2019) Part 2. Zenodo. https://doi.org/10.5281/zenodo.2553501", "bibtex": "@misc{warren_2019_2553501, author = {Warren, Ian and Jiggins, Chris}, title = {{Miscellaneous Heliconius wing photographs (2001-2019) Part 2}}, month = feb, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2553501}, url = {https://doi.org/10.5281/zenodo.2553501} }"}, {"record_number": "2735056", "url": "https://zenodo.org/record/2735056", "license": "cc-by-4.0", "citation": "Salazar, C., Montejo-Kovacevich, G., Jiggins, C., Warren, I., & Gavins, I. (2019 , May). Camilo Salazar and Cambridge butterfly wing collection batch 1. Zenodo. https://doi.org/10.5281/zenodo.2735056", "bibtex": "@misc{salazar_2019_2735056, author = {Salazar, Camilo and Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian and Gavins, Imogen}, title = {{Camilo Salazar and Cambridge butterfly wing collection batch 1}}, month = may, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2735056}, url = {https://doi.org/10.5281/zenodo.2735056} }"}, {"record_number": "2554218", "url": "https://zenodo.org/record/2554218", "license": "cc-by-4.0", "citation": "Mattila, A., Jiggins, C., & Warren, I. (2019 , February). University of Helsinki butterfly wing collection - Anniina Mattila field caught specimens. Zenodo. https://doi.org/10.5281/zenodo.2554218", "bibtex": "@misc{mattila_2019_2554218, author = {Mattila, Anniina and Jiggins, Chris and Warren, Ian}, title = {{University of Helsinki butterfly wing collection - Anniina Mattila field caught specimens}}, month = feb, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2554218}, url = {https://doi.org/10.5281/zenodo.2554218} }"}, {"record_number": "2555086", "url": "https://zenodo.org/record/2555086", "license": "cc-by-4.0", "citation": "Mattila, A., Jiggins, C., & Warren, I. (2019 , February). University of Helsinki butterfly collection - Anniina Mattila bred specimens. Zenodo. https://doi.org/10.5281/zenodo.2555086", "bibtex": "@misc{mattila_2019_2555086, author = {Mattila, Anniina and Jiggins, Chris and Warren, Ian}, title = {{University of Helsinki butterfly collection - Anniina Mattila bred specimens}}, month = feb, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2555086}, url = {https://doi.org/10.5281/zenodo.2555086} }"}]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "record_number": "4289223",
4
+ "url": "https://zenodo.org/record/4289223",
5
+ "license": "cc-by-4.0",
6
+ "citation": "Montejo-Kovacevich, G., van der Heijden, E., Nadeau, N., & Jiggins, C. (2020 , November). Cambridge butterfly wing collection batch 10. Zenodo. https://doi.org/10.5281/zenodo.4289223",
7
+ "bibtex": "@misc{gabriela_montejo_kovacevich_2020_4289223, author = {Gabriela Montejo-Kovacevich and Eva van der Heijden and Nicola Nadeau and Chris Jiggins}, title = {Cambridge butterfly wing collection batch 10}, month = nov, year = 2020, publisher = {Zenodo}, doi = {10.5281/zenodo.4289223}, url = {https://doi.org/10.5281/zenodo.4289223} }"
8
+ },
9
+ {
10
+ "record_number": "4288311",
11
+ "url": "https://zenodo.org/record/4288311",
12
+ "license": "cc-by-4.0",
13
+ "citation": "Salazar, P. A., Nadeau, N., Montejo-Kovacevich, G., & Jiggins, C. (2020 , November). Sheffield butterfly wing collection - Patricio Salazar, Nicola Nadeau, Ikiam broods batch 1 and 2. Zenodo. https://doi.org/10.5281/zenodo.4288311",
14
+ "bibtex": "@misc{patricio_a_salazar_2020_4288311, author = {Patricio A. Salazar and Nicola Nadeau and Gabriela Montejo-Kovacevich and Chris Jiggins}, title = {{Sheffield butterfly wing collection - Patricio Salazar, Nicola Nadeau, Ikiam broods batch 1 and 2}}, month = nov, year = 2020, publisher = {Zenodo}, doi = {10.5281/zenodo.4288311}, url = {https://doi.org/10.5281/zenodo.4288311} }"
15
+ },
16
+ {
17
+ "record_number": "2677821",
18
+ "url": "https://zenodo.org/record/2677821",
19
+ "license": "cc-by-4.0",
20
+ "citation": "Montejo-Kovacevich, G., Jiggins, C., & Warren, I. (2019 , May). Cambridge butterfly wing collection batch 2. Zenodo. https://doi.org/10.5281/zenodo.2677821",
21
+ "bibtex": "@misc{montejo_kovacevich_2019_2677821, author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian}, title = {Cambridge butterfly wing collection batch 2}, month = may, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2677821}, url = {https://doi.org/10.5281/zenodo.2677821} }"
22
+ },
23
+ {
24
+ "record_number": "2682458",
25
+ "url": "https://zenodo.org/record/2682458",
26
+ "license": "cc-by-4.0",
27
+ "citation": "Jiggins, C., Montejo-Kovacevich, G., Warren, I., & Wiltshire, E. (2019 , May). Cambridge butterfly wing collection batch 3. Zenodo. https://doi.org/10.5281/zenodo.2682458",
28
+ "bibtex": "@misc{jiggins_2019_2682458, author = {Jiggins, Chris and Montejo-Kovacevich, Gabriela and Warren, Ian and Wiltshire, Eva}, title = {Cambridge butterfly wing collection batch 3}, month = may, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2682458}, url = {https://doi.org/10.5281/zenodo.2682458} }"
29
+ },
30
+ {
31
+ "record_number": "2682669",
32
+ "url": "https://zenodo.org/record/2682669",
33
+ "license": "cc-by-4.0",
34
+ "citation": "Montejo-Kovacevich, G., Jiggins, C., & Warren, I. (2019 , May). Cambridge butterfly wing collection batch 4. Zenodo. https://doi.org/10.5281/zenodo.2682669",
35
+ "bibtex": "@misc{montejo_kovacevich_2019_2682669, author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian}, title = {Cambridge butterfly wing collection batch 4}, month = may, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2682669}, url = {https://doi.org/10.5281/zenodo.2682669} }"
36
+ },
37
+ {
38
+ "record_number": "2684906",
39
+ "url": "https://zenodo.org/record/2684906",
40
+ "license": "cc-by-4.0",
41
+ "citation": "Montejo-Kovacevich, G., Jiggins, C., Warren, I., & Wiltshire, E. (2019 , May). Cambridge butterfly wing collection batch 5. Zenodo. https://doi.org/10.5281/zenodo.2684906",
42
+ "bibtex": "@misc{montejo_kovacevich_2019_2684906, author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian and Wiltshire, Eva}, title = {Cambridge butterfly wing collection batch 5}, month = may, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2684906}, url = {https://doi.org/10.5281/zenodo.2684906} }"
43
+ },
44
+ {
45
+ "record_number": "2552371",
46
+ "url": "https://zenodo.org/record/2552371",
47
+ "license": "cc-by-4.0",
48
+ "citation": "Warren, I. & Jiggins, C. (2019 , February). Miscellaneous Heliconius wing photographs (2001-2019) Part 1. Zenodo. https://doi.org/10.5281/zenodo.2552371",
49
+ "bibtex": "@misc{warren_2019_2552371, author = {Warren, Ian and Jiggins, Chris}, title = {{Miscellaneous Heliconius wing photographs (2001-2019) Part 1}}, month = feb, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2552371}, url = {https://doi.org/10.5281/zenodo.2552371} }"
50
+ },
51
+ {
52
+ "record_number": "2553977",
53
+ "url": "https://zenodo.org/record/2553977",
54
+ "license": "cc-by-4.0",
55
+ "citation": "Warren, I. & Jiggins, C. (2019 , February). Miscellaneous Heliconius wing photographs (2001-2019) Part 3. Zenodo. https://doi.org/10.5281/zenodo.2553977",
56
+ "bibtex": "@misc{warren_2019_2553977, author = {Warren, Ian and Jiggins, Chris}, title = {{Miscellaneous Heliconius wing photographs (2001-2019) Part 3}}, month = feb, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2553977}, url = {https://doi.org/10.5281/zenodo.2553977} }"
57
+ },
58
+ {
59
+ "record_number": "2686762",
60
+ "url": "https://zenodo.org/record/2686762",
61
+ "license": "cc-by-4.0",
62
+ "citation": "Montejo-Kovacevich, G., Jiggins, C., Warren, I., & Wiltshire, E. (2019 , May). Cambridge butterfly wing collection batch 6. Zenodo. https://doi.org/10.5281/zenodo.2686762",
63
+ "bibtex": "@misc{montejo_kovacevich_2019_2686762, author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian and Wiltshire, Eva}, title = {Cambridge butterfly wing collection batch 6}, month = may, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2686762}, url = {https://doi.org/10.5281/zenodo.2686762} }"
64
+ },
65
+ {
66
+ "record_number": "2549524",
67
+ "url": "https://zenodo.org/record/2549524",
68
+ "license": "cc-by-4.0",
69
+ "citation": "Jiggins, C. & Warren, I. (2019 , January). Cambridge butterfly wing collection - Chris Jiggins 2001/2 broods batch 1. Zenodo. https://doi.org/10.5281/zenodo.2549524",
70
+ "bibtex": "@misc{jiggins_2019_2549524, author = {Jiggins, Chris and Warren, Ian}, title = {{Cambridge butterfly wing collection - Chris Jiggins 2001/2 broods batch 1}}, month = jan, year = 2019, publisher = {Zenodo}, version = 1, doi = {10.5281/zenodo.2549524}, url = {https://doi.org/10.5281/zenodo.2549524} }"
71
+ },
72
+ {
73
+ "record_number": "2550097",
74
+ "url": "https://zenodo.org/record/2550097",
75
+ "license": "cc-by-4.0",
76
+ "citation": "Jiggins, C. & Warren, I. (2019 , January). Cambridge butterfly wing collection - Chris Jiggins 2001/2 broods batch 2. Zenodo. https://doi.org/10.5281/zenodo.2550097",
77
+ "bibtex": "@misc{jiggins_2019_2550097, author = {Jiggins, Chris and Warren, Ian}, title = {{Cambridge butterfly wing collection - Chris Jiggins 2001/2 broods batch 2}}, month = jan, year = 2019, publisher = {Zenodo}, version = 1, doi = {10.5281/zenodo.2550097}, url = {https://doi.org/10.5281/zenodo.2550097} }"
78
+ },
79
+ {
80
+ "record_number": "4153502",
81
+ "url": "https://zenodo.org/record/4153502",
82
+ "license": "cc-by-4.0",
83
+ "citation": "Meier, J. I., Salazar, P., Montejo-Kovacevich, G., Warren, I., & Jggins, C. (2020 , October). Cambridge butterfly wing collection - Patricio Salazar PhD wild specimens batch 3. Zenodo. https://doi.org/10.5281/zenodo.4153502",
84
+ "bibtex": "@misc{joana_i_meier_2020_4153502, author = {Joana I. Meier and Patricio Salazar and Gabriela Montejo-Kovacevich and Ian Warren and Chris Jggins}, title = {{Cambridge butterfly wing collection - Patricio Salazar PhD wild specimens batch 3}}, month = oct, year = 2020, publisher = {Zenodo}, doi = {10.5281/zenodo.4153502}, url = {https://doi.org/10.5281/zenodo.4153502} }"
85
+ },
86
+ {
87
+ "record_number": "3082688",
88
+ "url": "https://zenodo.org/record/3082688",
89
+ "license": "cc-by-4.0",
90
+ "citation": "Montejo-Kovacevich, G., Jiggins, C., & Warren, I. (2019 , May). Cambridge butterfly wing collection batch 1- version 2. Zenodo. https://doi.org/10.5281/zenodo.3082688",
91
+ "bibtex": "@misc{montejo_kovacevich_2019_3082688, author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian}, title = {{Cambridge butterfly wing collection batch 1- version 2}}, month = may, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.3082688}, url = {https://doi.org/10.5281/zenodo.3082688} }"
92
+ },
93
+ {
94
+ "record_number": "2813153",
95
+ "url": "https://zenodo.org/record/2813153",
96
+ "license": "cc-by-4.0",
97
+ "citation": "Montejo-Kovacevich, G., Jiggins, C., Warren, I., Salazar, C., Elias, M., Gavins, I., Wiltshire, E., Montgomery, S., & McMillan, O. (2019 , May). Cambridge and collaborators butterfly wing collection batch 10. Zenodo. https://doi.org/10.5281/zenodo.2813153",
98
+ "bibtex": "@misc{montejo_kovacevich_2019_2813153, author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian and Salazar, Camilo and Elias, Marianne and Gavins, Imogen and Wiltshire, Eva and Montgomery, Stephen and McMillan, Owen}, title = {{Cambridge and collaborators butterfly wing collection batch 10}}, month = may, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2813153}, url = {https://doi.org/10.5281/zenodo.2813153} }"
99
+ },
100
+ {
101
+ "record_number": "1748277",
102
+ "url": "https://zenodo.org/record/1748277",
103
+ "license": "cc-by-4.0",
104
+ "citation": "Salazar, P., Montejo-Kovacevich, G., Warren, I., & Jiggins, C. (2018 , December). Cambridge butterfly wing collection - Patricio Salazar PhD wild and bred specimens batch 1. Zenodo. https://doi.org/10.5281/zenodo.1748277",
105
+ "bibtex": "@misc{salazar_2018_1748277, author = {Salazar, Patricio and Montejo-Kovacevich, Gabriela and Warren, Ian and Jiggins, Chris}, title = {{Cambridge butterfly wing collection - Patricio Salazar PhD wild and bred specimens batch 1}}, month = dec, year = 2018, publisher = {Zenodo}, doi = {10.5281/zenodo.1748277}, url = {https://doi.org/10.5281/zenodo.1748277} }"
106
+ },
107
+ {
108
+ "record_number": "2702457",
109
+ "url": "https://zenodo.org/record/2702457",
110
+ "license": "cc-by-4.0",
111
+ "citation": "Montejo-Kovacevich, G., Jiggins, C., Warren, I., & Wiltshire, E. (2019 , May). Cambridge butterfly wing collection batch 7. Zenodo. https://doi.org/10.5281/zenodo.2702457",
112
+ "bibtex": "@misc{montejo_kovacevich_2019_2702457, author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian and Wiltshire, Eva}, title = {Cambridge butterfly wing collection batch 7}, month = may, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2702457}, url = {https://doi.org/10.5281/zenodo.2702457} }"
113
+ },
114
+ {
115
+ "record_number": "2548678",
116
+ "url": "https://zenodo.org/record/2548678",
117
+ "license": "cc-by-4.0",
118
+ "citation": "Salazar, P., Montejo-Kovacevich, G., Warren, I., & Jiggins, C. (2019 , January). Cambridge butterfly wing collection - Patricio Salazar PhD wild and bred specimens batch 2. Zenodo. https://doi.org/10.5281/zenodo.2548678",
119
+ "bibtex": "@misc{salazar_2019_2548678, author = {Salazar, Patricio and Montejo-Kovacevich, Gabriela and Warren, Ian and Jiggins, Chris}, title = {{Cambridge butterfly wing collection - Patricio Salazar PhD wild and bred specimens batch 2}}, month = jan, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2548678}, url = {https://doi.org/10.5281/zenodo.2548678} }"
120
+ },
121
+ {
122
+ "record_number": "5561246",
123
+ "url": "https://zenodo.org/record/5561246",
124
+ "license": "cc-by-4.0",
125
+ "citation": "Pinheiro de Castro, E., Jiggins, C., Lucas da Silva-Brand\u00e3o, K., Victor Lucci Freitas, A., Zikan Cardoso, M., Van Der Heijden, E., Meier, J., & Warren, I. (2022 , February). Brazilian Butterflies Collected December 2020 to January 2021. Zenodo. https://doi.org/10.5281/zenodo.5561246",
126
+ "bibtex": "@misc{pinheiro_de_castro_2022_5561246, author = {Pinheiro de Castro, Erika and Jiggins, Christopher and Lucas da Silva-Brand\u00e3o, Karina and Victor Lucci Freitas, Andre and Zikan Cardoso, Marcio and Van Der Heijden, Eva and Meier, Joana and Warren, Ian}, title = {{Brazilian Butterflies Collected December 2020 to January 2021}}, month = feb, year = 2022, publisher = {Zenodo}, doi = {10.5281/zenodo.5561246}, url = {https://doi.org/10.5281/zenodo.5561246} }"
127
+ },
128
+ {
129
+ "record_number": "2707828",
130
+ "url": "https://zenodo.org/record/2707828",
131
+ "license": "cc-by-4.0",
132
+ "citation": "Montejo-Kovacevich, G., Jiggins, C., Warren, I., & Wiltshire, E. (2019 , May). Cambridge butterfly wing collection batch 8. Zenodo. https://doi.org/10.5281/zenodo.2707828",
133
+ "bibtex": "@misc{montejo_kovacevich_2019_2707828, author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian and Wiltshire, Eva}, title = {Cambridge butterfly wing collection batch 8}, month = may, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2707828}, url = {https://doi.org/10.5281/zenodo.2707828} }"
134
+ },
135
+ {
136
+ "record_number": "2714333",
137
+ "url": "https://zenodo.org/record/2714333",
138
+ "license": "cc-by-4.0",
139
+ "citation": "Montejo-Kovacevich, G., Jiggins, C., Warren, I., Wiltshire, E., & Gavins, I. (2019 , May). Cambridge butterfly wing collection batch 9. Zenodo. https://doi.org/10.5281/zenodo.2714333",
140
+ "bibtex": "@misc{montejo_kovacevich_2019_2714333, author = {Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian and Wiltshire, Eva and Gavins, Imogen}, title = {Cambridge butterfly wing collection batch 9}, month = may, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2714333}, url = {https://doi.org/10.5281/zenodo.2714333} }"
141
+ },
142
+ {
143
+ "record_number": "4291095",
144
+ "url": "https://zenodo.org/record/4291095",
145
+ "license": "cc-by-4.0",
146
+ "citation": "Montejo-Kovacevich, G., van der Heijden, E., & Jiggins, C. (2020 , November). Cambridge butterfly collection - GMK Broods Ikiam 2018. Zenodo. https://doi.org/10.5281/zenodo.4291095",
147
+ "bibtex": "@misc{gabriela_montejo_kovacevich_2020_4291095, author = {Gabriela Montejo-Kovacevich and Eva van der Heijden and Chris Jiggins}, title = {{Cambridge butterfly collection - GMK Broods Ikiam 2018}}, month = nov, year = 2020, publisher = {Zenodo}, doi = {10.5281/zenodo.4291095}, url = {https://doi.org/10.5281/zenodo.4291095} }"
148
+ },
149
+ {
150
+ "record_number": "3569598",
151
+ "url": "https://zenodo.org/record/3569598",
152
+ "license": "cc-by-4.0",
153
+ "citation": "Montejo-Kovacevich, G., Cookson, L., van der Heijden, E., Warren, I., Edwards, D. P., & Jiggins, C. (2019 , December). Cambridge butterfly collection - Loreto, Peru 2018. Zenodo. https://doi.org/10.5281/zenodo.3569598",
154
+ "bibtex": "@misc{gabriela_montejo_kovacevich_2019_3569598, author = {Gabriela Montejo-Kovacevich and Letitia Cookson and Eva van der Heijden and Ian Warren and David P. Edwards and Chris Jiggins}, title = {Cambridge butterfly collection - Loreto, Peru 2018}, month = dec, year = 2019, publisher = {Zenodo}, version = {1.0.0}, doi = {10.5281/zenodo.3569598}, url = {https://doi.org/10.5281/zenodo.3569598} }"
155
+ },
156
+ {
157
+ "record_number": "4287444",
158
+ "url": "https://zenodo.org/record/4287444",
159
+ "license": "cc-by-4.0",
160
+ "citation": "Montejo-Kovacevich, G., Cookson, L., van der Heijden, E., Warren, I., Edwards, D. P., & Jiggins, C. (2020 , November). Cambridge butterfly collection - Loreto, Peru 2018 batch2. Zenodo. https://doi.org/10.5281/zenodo.4287444",
161
+ "bibtex": "@misc{gabriela_montejo_kovacevich_2020_4287444, author = {Gabriela Montejo-Kovacevich and Letitia Cookson and Eva van der Heijden and Ian Warren and David P. Edwards and Chris Jiggins}, title = {{Cambridge butterfly collection - Loreto, Peru 2018 batch2}}, month = nov, year = 2020, publisher = {Zenodo}, doi = {10.5281/zenodo.4287444}, url = {https://doi.org/10.5281/zenodo.4287444} }"
162
+ },
163
+ {
164
+ "record_number": "4288250",
165
+ "url": "https://zenodo.org/record/4288250",
166
+ "license": "cc-by-4.0",
167
+ "citation": "Montejo-Kovacevich, G., Cookson, L., van der Heijden, E., Warren, I., Edwards, D. P., & Jiggins, C. (2020 , November). Cambridge butterfly collection - Loreto, Peru 2018 batch3. Zenodo. https://doi.org/10.5281/zenodo.4288250",
168
+ "bibtex": "@misc{gabriela_montejo_kovacevich_2020_4288250, author = {Gabriela Montejo-Kovacevich and Letitia Cookson and Eva van der Heijden and Ian Warren and David P. Edwards and Chris Jiggins}, title = {{Cambridge butterfly collection - Loreto, Peru 2018 batch3}}, month = nov, year = 2020, publisher = {Zenodo}, doi = {10.5281/zenodo.4288250}, url = {https://doi.org/10.5281/zenodo.4288250} }"
169
+ },
170
+ {
171
+ "record_number": "5526257",
172
+ "url": "https://zenodo.org/record/5526257",
173
+ "license": "cc-by-4.0",
174
+ "citation": "Montejo-Kovacevich, G., Paynter, Q., & Ghane, A. (2021 , September). Heliconius erato cyrbia, Cook Islands (New Zealand) 2016, 2019, 2021. Zenodo. https://doi.org/10.5281/zenodo.5526257",
175
+ "bibtex": "@misc{montejo_kovacevich_2021_5526257, author = {Montejo-Kovacevich, Gabriela and Paynter, Quentin and Ghane, Amin}, title = {{Heliconius erato cyrbia, Cook Islands (New Zealand) 2016, 2019, 2021}}, month = sep, year = 2021, publisher = {Zenodo}, doi = {10.5281/zenodo.5526257}, url = {https://doi.org/10.5281/zenodo.5526257} }"
176
+ },
177
+ {
178
+ "record_number": "2553501",
179
+ "url": "https://zenodo.org/record/2553501",
180
+ "license": "cc-by-4.0",
181
+ "citation": "Warren, I. & Jiggins, C. (2019 , February). Miscellaneous Heliconius wing photographs (2001-2019) Part 2. Zenodo. https://doi.org/10.5281/zenodo.2553501",
182
+ "bibtex": "@misc{warren_2019_2553501, author = {Warren, Ian and Jiggins, Chris}, title = {{Miscellaneous Heliconius wing photographs (2001-2019) Part 2}}, month = feb, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2553501}, url = {https://doi.org/10.5281/zenodo.2553501} }"
183
+ },
184
+ {
185
+ "record_number": "2735056",
186
+ "url": "https://zenodo.org/record/2735056",
187
+ "license": "cc-by-4.0",
188
+ "citation": "Salazar, C., Montejo-Kovacevich, G., Jiggins, C., Warren, I., & Gavins, I. (2019 , May). Camilo Salazar and Cambridge butterfly wing collection batch 1. Zenodo. https://doi.org/10.5281/zenodo.2735056",
189
+ "bibtex": "@misc{salazar_2019_2735056, author = {Salazar, Camilo and Montejo-Kovacevich, Gabriela and Jiggins, Chris and Warren, Ian and Gavins, Imogen}, title = {{Camilo Salazar and Cambridge butterfly wing collection batch 1}}, month = may, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2735056}, url = {https://doi.org/10.5281/zenodo.2735056} }"
190
+ },
191
+ {
192
+ "record_number": "2554218",
193
+ "url": "https://zenodo.org/record/2554218",
194
+ "license": "cc-by-4.0",
195
+ "citation": "Mattila, A., Jiggins, C., & Warren, I. (2019 , February). University of Helsinki butterfly wing collection - Anniina Mattila field caught specimens. Zenodo. https://doi.org/10.5281/zenodo.2554218",
196
+ "bibtex": "@misc{mattila_2019_2554218, author = {Mattila, Anniina and Jiggins, Chris and Warren, Ian}, title = {{University of Helsinki butterfly wing collection - Anniina Mattila field caught specimens}}, month = feb, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2554218}, url = {https://doi.org/10.5281/zenodo.2554218} }"
197
+ },
198
+ {
199
+ "record_number": "2555086",
200
+ "url": "https://zenodo.org/record/2555086",
201
+ "license": "cc-by-4.0",
202
+ "citation": "Mattila, A., Jiggins, C., & Warren, I. (2019 , February). University of Helsinki butterfly collection - Anniina Mattila bred specimens. Zenodo. https://doi.org/10.5281/zenodo.2555086",
203
+ "bibtex": "@misc{mattila_2019_2555086, author = {Mattila, Anniina and Jiggins, Chris and Warren, Ian}, title = {{University of Helsinki butterfly collection - Anniina Mattila bred specimens}}, month = feb, year = 2019, publisher = {Zenodo}, doi = {10.5281/zenodo.2555086}, url = {https://doi.org/10.5281/zenodo.2555086} }"
204
+ }
205
+ ]
notebooks/{make_Jiggins_Img_Master.ipynb → Data-gen-0-1.ipynb} RENAMED
@@ -15,7 +15,7 @@
15
  "metadata": {},
16
  "outputs": [],
17
  "source": [
18
- "jiggins = pd.read_csv(\"../Jiggins_Zenodo_Master.csv\", low_memory = False)"
19
  ]
20
  },
21
  {
 
15
  "metadata": {},
16
  "outputs": [],
17
  "source": [
18
+ "jiggins = pd.read_csv(\"../metadata/Jiggins_Zenodo_Master.csv\", low_memory = False)"
19
  ]
20
  },
21
  {
notebooks/{standardize_taxa.ipynb → Data-gen-0-2.ipynb} RENAMED
File without changes
notebooks/{standardize_datasets.ipynb → Data-gen-0-3.ipynb} RENAMED
File without changes
notebooks/Data-gen-1-1.ipynb ADDED
@@ -0,0 +1,1704 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {},
7
+ "outputs": [],
8
+ "source": [
9
+ "import pandas as pd\n",
10
+ "import numpy as np"
11
+ ]
12
+ },
13
+ {
14
+ "cell_type": "code",
15
+ "execution_count": 2,
16
+ "metadata": {},
17
+ "outputs": [
18
+ {
19
+ "name": "stdout",
20
+ "output_type": "stream",
21
+ "text": [
22
+ "<class 'pandas.core.frame.DataFrame'>\n",
23
+ "RangeIndex: 5683 entries, 0 to 5682\n",
24
+ "Data columns (total 4 columns):\n",
25
+ " # Column Non-Null Count Dtype \n",
26
+ "--- ------ -------------- ----- \n",
27
+ " 0 coreid 5683 non-null object \n",
28
+ " 1 type 0 non-null float64\n",
29
+ " 2 identifier 5683 non-null object \n",
30
+ " 3 license 0 non-null float64\n",
31
+ "dtypes: float64(2), object(2)\n",
32
+ "memory usage: 177.7+ KB\n"
33
+ ]
34
+ }
35
+ ],
36
+ "source": [
37
+ "multimedia = pd.read_csv(\"../metadata/deduplication/Zenodo_meta_files/multimedia__(rec_3477891).csv\", low_memory=False)\n",
38
+ "multimedia.info(show_counts=True)"
39
+ ]
40
+ },
41
+ {
42
+ "cell_type": "code",
43
+ "execution_count": 3,
44
+ "metadata": {},
45
+ "outputs": [
46
+ {
47
+ "data": {
48
+ "text/html": [
49
+ "<div>\n",
50
+ "<style scoped>\n",
51
+ " .dataframe tbody tr th:only-of-type {\n",
52
+ " vertical-align: middle;\n",
53
+ " }\n",
54
+ "\n",
55
+ " .dataframe tbody tr th {\n",
56
+ " vertical-align: top;\n",
57
+ " }\n",
58
+ "\n",
59
+ " .dataframe thead th {\n",
60
+ " text-align: right;\n",
61
+ " }\n",
62
+ "</style>\n",
63
+ "<table border=\"1\" class=\"dataframe\">\n",
64
+ " <thead>\n",
65
+ " <tr style=\"text-align: right;\">\n",
66
+ " <th></th>\n",
67
+ " <th>coreid</th>\n",
68
+ " <th>type</th>\n",
69
+ " <th>identifier</th>\n",
70
+ " <th>license</th>\n",
71
+ " </tr>\n",
72
+ " </thead>\n",
73
+ " <tbody>\n",
74
+ " <tr>\n",
75
+ " <th>0</th>\n",
76
+ " <td>275ad2e7-bc7e-4e74-832e-869825f5bf0b</td>\n",
77
+ " <td>NaN</td>\n",
78
+ " <td>https://zenodo.org/record/2684906/files/CAM008...</td>\n",
79
+ " <td>NaN</td>\n",
80
+ " </tr>\n",
81
+ " <tr>\n",
82
+ " <th>1</th>\n",
83
+ " <td>cf02ac3a-6204-417c-b342-6f84eab48931</td>\n",
84
+ " <td>NaN</td>\n",
85
+ " <td>https://zenodo.org/record/2714333/files/CAM041...</td>\n",
86
+ " <td>NaN</td>\n",
87
+ " </tr>\n",
88
+ " <tr>\n",
89
+ " <th>2</th>\n",
90
+ " <td>7be80267-dbe9-4f4b-8f73-c7355447d5e1</td>\n",
91
+ " <td>NaN</td>\n",
92
+ " <td>https://zenodo.org/record/2686762/files/CAM008...</td>\n",
93
+ " <td>NaN</td>\n",
94
+ " </tr>\n",
95
+ " <tr>\n",
96
+ " <th>3</th>\n",
97
+ " <td>b97011cb-c4fd-4ea9-8828-dc920c7b900a</td>\n",
98
+ " <td>NaN</td>\n",
99
+ " <td>https://zenodo.org/record/2684906/files/CAM008...</td>\n",
100
+ " <td>NaN</td>\n",
101
+ " </tr>\n",
102
+ " <tr>\n",
103
+ " <th>4</th>\n",
104
+ " <td>6375bf74-3333-4cb6-a0dc-f95c3794edae</td>\n",
105
+ " <td>NaN</td>\n",
106
+ " <td>https://zenodo.org/record/2714333/files/CAM040...</td>\n",
107
+ " <td>NaN</td>\n",
108
+ " </tr>\n",
109
+ " </tbody>\n",
110
+ "</table>\n",
111
+ "</div>"
112
+ ],
113
+ "text/plain": [
114
+ " coreid type \\\n",
115
+ "0 275ad2e7-bc7e-4e74-832e-869825f5bf0b NaN \n",
116
+ "1 cf02ac3a-6204-417c-b342-6f84eab48931 NaN \n",
117
+ "2 7be80267-dbe9-4f4b-8f73-c7355447d5e1 NaN \n",
118
+ "3 b97011cb-c4fd-4ea9-8828-dc920c7b900a NaN \n",
119
+ "4 6375bf74-3333-4cb6-a0dc-f95c3794edae NaN \n",
120
+ "\n",
121
+ " identifier license \n",
122
+ "0 https://zenodo.org/record/2684906/files/CAM008... NaN \n",
123
+ "1 https://zenodo.org/record/2714333/files/CAM041... NaN \n",
124
+ "2 https://zenodo.org/record/2686762/files/CAM008... NaN \n",
125
+ "3 https://zenodo.org/record/2684906/files/CAM008... NaN \n",
126
+ "4 https://zenodo.org/record/2714333/files/CAM040... NaN "
127
+ ]
128
+ },
129
+ "execution_count": 3,
130
+ "metadata": {},
131
+ "output_type": "execute_result"
132
+ }
133
+ ],
134
+ "source": [
135
+ "multimedia.head()"
136
+ ]
137
+ },
138
+ {
139
+ "cell_type": "code",
140
+ "execution_count": 4,
141
+ "metadata": {},
142
+ "outputs": [
143
+ {
144
+ "data": {
145
+ "text/plain": [
146
+ "'https://zenodo.org/record/2684906/files/CAM008538_d.JPG'"
147
+ ]
148
+ },
149
+ "execution_count": 4,
150
+ "metadata": {},
151
+ "output_type": "execute_result"
152
+ }
153
+ ],
154
+ "source": [
155
+ "multimedia.identifier[0]"
156
+ ]
157
+ },
158
+ {
159
+ "cell_type": "markdown",
160
+ "metadata": {},
161
+ "source": [
162
+ "Let's get a filename and record number recorded. Would like to add a `zenodo_link` column to see how that matches up to the master file as well. David said these were mostly resolution for records from [3477891](https://zenodo.org/records/3477891) (where these files are from) at download.\n",
163
+ "\n",
164
+ "`identifier` is non-null for all entries, but there is one non-Zenodo link."
165
+ ]
166
+ },
167
+ {
168
+ "cell_type": "code",
169
+ "execution_count": 5,
170
+ "metadata": {},
171
+ "outputs": [
172
+ {
173
+ "data": {
174
+ "text/html": [
175
+ "<div>\n",
176
+ "<style scoped>\n",
177
+ " .dataframe tbody tr th:only-of-type {\n",
178
+ " vertical-align: middle;\n",
179
+ " }\n",
180
+ "\n",
181
+ " .dataframe tbody tr th {\n",
182
+ " vertical-align: top;\n",
183
+ " }\n",
184
+ "\n",
185
+ " .dataframe thead th {\n",
186
+ " text-align: right;\n",
187
+ " }\n",
188
+ "</style>\n",
189
+ "<table border=\"1\" class=\"dataframe\">\n",
190
+ " <thead>\n",
191
+ " <tr style=\"text-align: right;\">\n",
192
+ " <th></th>\n",
193
+ " <th>coreid</th>\n",
194
+ " <th>type</th>\n",
195
+ " <th>identifier</th>\n",
196
+ " <th>license</th>\n",
197
+ " <th>zenodo_link</th>\n",
198
+ " <th>Image_name</th>\n",
199
+ " <th>record_number</th>\n",
200
+ " </tr>\n",
201
+ " </thead>\n",
202
+ " <tbody>\n",
203
+ " <tr>\n",
204
+ " <th>0</th>\n",
205
+ " <td>275ad2e7-bc7e-4e74-832e-869825f5bf0b</td>\n",
206
+ " <td>NaN</td>\n",
207
+ " <td>https://zenodo.org/record/2684906/files/CAM008...</td>\n",
208
+ " <td>NaN</td>\n",
209
+ " <td>https://zenodo.org/record/2684906</td>\n",
210
+ " <td>CAM008538_d.JPG</td>\n",
211
+ " <td>2684906</td>\n",
212
+ " </tr>\n",
213
+ " <tr>\n",
214
+ " <th>1</th>\n",
215
+ " <td>cf02ac3a-6204-417c-b342-6f84eab48931</td>\n",
216
+ " <td>NaN</td>\n",
217
+ " <td>https://zenodo.org/record/2714333/files/CAM041...</td>\n",
218
+ " <td>NaN</td>\n",
219
+ " <td>https://zenodo.org/record/2714333</td>\n",
220
+ " <td>CAM041048_v.JPG</td>\n",
221
+ " <td>2714333</td>\n",
222
+ " </tr>\n",
223
+ " <tr>\n",
224
+ " <th>2</th>\n",
225
+ " <td>7be80267-dbe9-4f4b-8f73-c7355447d5e1</td>\n",
226
+ " <td>NaN</td>\n",
227
+ " <td>https://zenodo.org/record/2686762/files/CAM008...</td>\n",
228
+ " <td>NaN</td>\n",
229
+ " <td>https://zenodo.org/record/2686762</td>\n",
230
+ " <td>CAM008842_d.JPG</td>\n",
231
+ " <td>2686762</td>\n",
232
+ " </tr>\n",
233
+ " <tr>\n",
234
+ " <th>3</th>\n",
235
+ " <td>b97011cb-c4fd-4ea9-8828-dc920c7b900a</td>\n",
236
+ " <td>NaN</td>\n",
237
+ " <td>https://zenodo.org/record/2684906/files/CAM008...</td>\n",
238
+ " <td>NaN</td>\n",
239
+ " <td>https://zenodo.org/record/2684906</td>\n",
240
+ " <td>CAM008539_v.JPG</td>\n",
241
+ " <td>2684906</td>\n",
242
+ " </tr>\n",
243
+ " <tr>\n",
244
+ " <th>4</th>\n",
245
+ " <td>6375bf74-3333-4cb6-a0dc-f95c3794edae</td>\n",
246
+ " <td>NaN</td>\n",
247
+ " <td>https://zenodo.org/record/2714333/files/CAM040...</td>\n",
248
+ " <td>NaN</td>\n",
249
+ " <td>https://zenodo.org/record/2714333</td>\n",
250
+ " <td>CAM040771_v.JPG</td>\n",
251
+ " <td>2714333</td>\n",
252
+ " </tr>\n",
253
+ " </tbody>\n",
254
+ "</table>\n",
255
+ "</div>"
256
+ ],
257
+ "text/plain": [
258
+ " coreid type \\\n",
259
+ "0 275ad2e7-bc7e-4e74-832e-869825f5bf0b NaN \n",
260
+ "1 cf02ac3a-6204-417c-b342-6f84eab48931 NaN \n",
261
+ "2 7be80267-dbe9-4f4b-8f73-c7355447d5e1 NaN \n",
262
+ "3 b97011cb-c4fd-4ea9-8828-dc920c7b900a NaN \n",
263
+ "4 6375bf74-3333-4cb6-a0dc-f95c3794edae NaN \n",
264
+ "\n",
265
+ " identifier license \\\n",
266
+ "0 https://zenodo.org/record/2684906/files/CAM008... NaN \n",
267
+ "1 https://zenodo.org/record/2714333/files/CAM041... NaN \n",
268
+ "2 https://zenodo.org/record/2686762/files/CAM008... NaN \n",
269
+ "3 https://zenodo.org/record/2684906/files/CAM008... NaN \n",
270
+ "4 https://zenodo.org/record/2714333/files/CAM040... NaN \n",
271
+ "\n",
272
+ " zenodo_link Image_name record_number \n",
273
+ "0 https://zenodo.org/record/2684906 CAM008538_d.JPG 2684906 \n",
274
+ "1 https://zenodo.org/record/2714333 CAM041048_v.JPG 2714333 \n",
275
+ "2 https://zenodo.org/record/2686762 CAM008842_d.JPG 2686762 \n",
276
+ "3 https://zenodo.org/record/2684906 CAM008539_v.JPG 2684906 \n",
277
+ "4 https://zenodo.org/record/2714333 CAM040771_v.JPG 2714333 "
278
+ ]
279
+ },
280
+ "execution_count": 5,
281
+ "metadata": {},
282
+ "output_type": "execute_result"
283
+ }
284
+ ],
285
+ "source": [
286
+ "def get_link_filename(identifier):\n",
287
+ " if \"zenodo\" not in identifier:\n",
288
+ " link_list = identifier.split(\"com/\")\n",
289
+ " link_list[0] = np.nan\n",
290
+ " else:\n",
291
+ " link_list = identifier.split(\"/files/\")\n",
292
+ " # link is first part, filename at end\n",
293
+ " return pd.Series(link_list)\n",
294
+ "\n",
295
+ "def get_record_number(zenodo_link):\n",
296
+ " if type(zenodo_link) != float:\n",
297
+ " link = zenodo_link.split(\"record/\")\n",
298
+ " return link[1]\n",
299
+ "\n",
300
+ "multimedia[[\"zenodo_link\", \"Image_name\"]] = multimedia[\"identifier\"].apply(get_link_filename)\n",
301
+ "multimedia[\"record_number\"] = multimedia[\"zenodo_link\"].apply(get_record_number)\n",
302
+ "multimedia.head()"
303
+ ]
304
+ },
305
+ {
306
+ "cell_type": "code",
307
+ "execution_count": 6,
308
+ "metadata": {},
309
+ "outputs": [
310
+ {
311
+ "name": "stdout",
312
+ "output_type": "stream",
313
+ "text": [
314
+ "http://earthcape-heliconius.s3-eu-west-1.amazonaws.com/F1FD2804C9E643798A7C1B0D9FBDE4AB.JPG\n"
315
+ ]
316
+ }
317
+ ],
318
+ "source": [
319
+ "for link in list(multimedia.identifier):\n",
320
+ " if \"zenodo\" not in link:\n",
321
+ " print(link)"
322
+ ]
323
+ },
324
+ {
325
+ "cell_type": "markdown",
326
+ "metadata": {},
327
+ "source": [
328
+ "So there is one image that does not have a Zenodo link."
329
+ ]
330
+ },
331
+ {
332
+ "cell_type": "code",
333
+ "execution_count": 7,
334
+ "metadata": {},
335
+ "outputs": [
336
+ {
337
+ "name": "stdout",
338
+ "output_type": "stream",
339
+ "text": [
340
+ "<class 'pandas.core.frame.DataFrame'>\n",
341
+ "RangeIndex: 5683 entries, 0 to 5682\n",
342
+ "Data columns (total 7 columns):\n",
343
+ " # Column Non-Null Count Dtype \n",
344
+ "--- ------ -------------- ----- \n",
345
+ " 0 coreid 5683 non-null object \n",
346
+ " 1 type 0 non-null float64\n",
347
+ " 2 identifier 5683 non-null object \n",
348
+ " 3 license 0 non-null float64\n",
349
+ " 4 zenodo_link 5682 non-null object \n",
350
+ " 5 Image_name 5683 non-null object \n",
351
+ " 6 record_number 5682 non-null object \n",
352
+ "dtypes: float64(2), object(5)\n",
353
+ "memory usage: 310.9+ KB\n"
354
+ ]
355
+ }
356
+ ],
357
+ "source": [
358
+ "multimedia.info()"
359
+ ]
360
+ },
361
+ {
362
+ "cell_type": "code",
363
+ "execution_count": 8,
364
+ "metadata": {},
365
+ "outputs": [
366
+ {
367
+ "data": {
368
+ "text/plain": [
369
+ "coreid 2794\n",
370
+ "type 0\n",
371
+ "identifier 5683\n",
372
+ "license 0\n",
373
+ "zenodo_link 12\n",
374
+ "Image_name 5683\n",
375
+ "record_number 12\n",
376
+ "dtype: int64"
377
+ ]
378
+ },
379
+ "execution_count": 8,
380
+ "metadata": {},
381
+ "output_type": "execute_result"
382
+ }
383
+ ],
384
+ "source": [
385
+ "multimedia.nunique()"
386
+ ]
387
+ },
388
+ {
389
+ "cell_type": "markdown",
390
+ "metadata": {},
391
+ "source": [
392
+ "The `coreid` is repeated, but the `Image_name` is unique across entries, so this could (hopefully) connect us to the source images."
393
+ ]
394
+ },
395
+ {
396
+ "cell_type": "code",
397
+ "execution_count": 9,
398
+ "metadata": {},
399
+ "outputs": [
400
+ {
401
+ "data": {
402
+ "text/plain": [
403
+ "record_number\n",
404
+ "2707828 1276\n",
405
+ "2714333 1113\n",
406
+ "2686762 986\n",
407
+ "2684906 863\n",
408
+ "2677821 703\n",
409
+ "2702457 276\n",
410
+ "2682458 158\n",
411
+ "2682669 124\n",
412
+ "2552371 91\n",
413
+ "2550097 50\n",
414
+ "2553977 22\n",
415
+ "2813153 20\n",
416
+ "Name: count, dtype: int64"
417
+ ]
418
+ },
419
+ "execution_count": 9,
420
+ "metadata": {},
421
+ "output_type": "execute_result"
422
+ }
423
+ ],
424
+ "source": [
425
+ "multimedia.record_number.value_counts()"
426
+ ]
427
+ },
428
+ {
429
+ "cell_type": "markdown",
430
+ "metadata": {},
431
+ "source": [
432
+ "Interesting, it would seem that record 3477891 is a collection of these 12 other records. It matches with this [GBIF Collection](https://www.gbif.org/dataset/34f8683a-dfc0-46b8-acf6-390fe5ca6b92) that is the \"collection records from the research group of Chris Jiggins at the University of Cambridge derived from almost 20 years of field studies. Many records include images as well as locality data.\" released in October 2019."
433
+ ]
434
+ },
435
+ {
436
+ "cell_type": "code",
437
+ "execution_count": 10,
438
+ "metadata": {},
439
+ "outputs": [
440
+ {
441
+ "name": "stdout",
442
+ "output_type": "stream",
443
+ "text": [
444
+ "<class 'pandas.core.frame.DataFrame'>\n",
445
+ "RangeIndex: 4372 entries, 0 to 4371\n",
446
+ "Data columns (total 29 columns):\n",
447
+ " # Column Non-Null Count Dtype \n",
448
+ "--- ------ -------------- ----- \n",
449
+ " 0 id 4372 non-null object \n",
450
+ " 1 occurrenceID 4372 non-null object \n",
451
+ " 2 catalogNumber 4372 non-null object \n",
452
+ " 3 datasetName 4372 non-null object \n",
453
+ " 4 recordNumber 0 non-null float64\n",
454
+ " 5 otherCatalogNumbers 33 non-null object \n",
455
+ " 6 basisOfRecord 4372 non-null object \n",
456
+ " 7 eventDate 3806 non-null object \n",
457
+ " 8 locality 4372 non-null object \n",
458
+ " 9 country 4372 non-null object \n",
459
+ " 10 decimalLatitude 4372 non-null float64\n",
460
+ " 11 decimalLongitude 4372 non-null float64\n",
461
+ " 12 geodeticDatum 4372 non-null int64 \n",
462
+ " 13 year 3806 non-null float64\n",
463
+ " 14 sex 3882 non-null object \n",
464
+ " 15 lifeStage 39 non-null object \n",
465
+ " 16 recordedBy 0 non-null float64\n",
466
+ " 17 individualCount 4372 non-null int64 \n",
467
+ " 18 taxonId 1105 non-null float64\n",
468
+ " 19 scientificName 4360 non-null object \n",
469
+ " 20 scientificNameAuthorship 0 non-null float64\n",
470
+ " 21 taxonRank 4358 non-null object \n",
471
+ " 22 genus 4358 non-null object \n",
472
+ " 23 family 4086 non-null object \n",
473
+ " 24 order 4086 non-null object \n",
474
+ " 25 class 4086 non-null object \n",
475
+ " 26 kingdom 4086 non-null object \n",
476
+ " 27 coordinateUncertaintyInMeters 0 non-null float64\n",
477
+ " 28 dynamicProperties 4372 non-null object \n",
478
+ "dtypes: float64(8), int64(2), object(19)\n",
479
+ "memory usage: 990.7+ KB\n"
480
+ ]
481
+ }
482
+ ],
483
+ "source": [
484
+ "occurrence = pd.read_csv(\"../metadata/deduplication/Zenodo_meta_files/occurrences__(rec_3477891).csv\",low_memory=False)\n",
485
+ "occurrence.info(show_counts=True)"
486
+ ]
487
+ },
488
+ {
489
+ "cell_type": "code",
490
+ "execution_count": 11,
491
+ "metadata": {},
492
+ "outputs": [
493
+ {
494
+ "data": {
495
+ "text/plain": [
496
+ "id 4372\n",
497
+ "occurrenceID 4372\n",
498
+ "catalogNumber 4372\n",
499
+ "datasetName 1\n",
500
+ "dtype: int64"
501
+ ]
502
+ },
503
+ "execution_count": 11,
504
+ "metadata": {},
505
+ "output_type": "execute_result"
506
+ }
507
+ ],
508
+ "source": [
509
+ "occurrence[(occurrence.columns)[:4]].nunique()"
510
+ ]
511
+ },
512
+ {
513
+ "cell_type": "markdown",
514
+ "metadata": {},
515
+ "source": [
516
+ "Are `id` and `occurrenceID` all equal?"
517
+ ]
518
+ },
519
+ {
520
+ "cell_type": "code",
521
+ "execution_count": 12,
522
+ "metadata": {},
523
+ "outputs": [
524
+ {
525
+ "data": {
526
+ "text/plain": [
527
+ "(4372, 29)"
528
+ ]
529
+ },
530
+ "execution_count": 12,
531
+ "metadata": {},
532
+ "output_type": "execute_result"
533
+ }
534
+ ],
535
+ "source": [
536
+ "occurrence.loc[occurrence[\"id\"] == occurrence[\"occurrenceID\"]].shape"
537
+ ]
538
+ },
539
+ {
540
+ "cell_type": "markdown",
541
+ "metadata": {},
542
+ "source": [
543
+ "This has a record number column, but there are no non-null values, so we'll try to fill that in. Except there is nothing to use to fill it in...we have to connect on `catalogNumber` to the `id` to the `coreid`, but `catalogNumber` is just the CAMID and we have more unique IDs than there are in the multimedia file..."
544
+ ]
545
+ },
546
+ {
547
+ "cell_type": "code",
548
+ "execution_count": 13,
549
+ "metadata": {},
550
+ "outputs": [
551
+ {
552
+ "data": {
553
+ "text/html": [
554
+ "<div>\n",
555
+ "<style scoped>\n",
556
+ " .dataframe tbody tr th:only-of-type {\n",
557
+ " vertical-align: middle;\n",
558
+ " }\n",
559
+ "\n",
560
+ " .dataframe tbody tr th {\n",
561
+ " vertical-align: top;\n",
562
+ " }\n",
563
+ "\n",
564
+ " .dataframe thead th {\n",
565
+ " text-align: right;\n",
566
+ " }\n",
567
+ "</style>\n",
568
+ "<table border=\"1\" class=\"dataframe\">\n",
569
+ " <thead>\n",
570
+ " <tr style=\"text-align: right;\">\n",
571
+ " <th></th>\n",
572
+ " <th>id</th>\n",
573
+ " <th>occurrenceID</th>\n",
574
+ " <th>catalogNumber</th>\n",
575
+ " <th>datasetName</th>\n",
576
+ " <th>recordNumber</th>\n",
577
+ " <th>otherCatalogNumbers</th>\n",
578
+ " <th>basisOfRecord</th>\n",
579
+ " <th>eventDate</th>\n",
580
+ " <th>locality</th>\n",
581
+ " <th>country</th>\n",
582
+ " <th>...</th>\n",
583
+ " <th>scientificName</th>\n",
584
+ " <th>scientificNameAuthorship</th>\n",
585
+ " <th>taxonRank</th>\n",
586
+ " <th>genus</th>\n",
587
+ " <th>family</th>\n",
588
+ " <th>order</th>\n",
589
+ " <th>class</th>\n",
590
+ " <th>kingdom</th>\n",
591
+ " <th>coordinateUncertaintyInMeters</th>\n",
592
+ " <th>dynamicProperties</th>\n",
593
+ " </tr>\n",
594
+ " </thead>\n",
595
+ " <tbody>\n",
596
+ " <tr>\n",
597
+ " <th>0</th>\n",
598
+ " <td>00075b7f-3920-4987-a3e4-e98568a38558</td>\n",
599
+ " <td>00075b7f-3920-4987-a3e4-e98568a38558</td>\n",
600
+ " <td>CAM040599</td>\n",
601
+ " <td>Heliconiine Butterfly Collection Records from ...</td>\n",
602
+ " <td>NaN</td>\n",
603
+ " <td>NaN</td>\n",
604
+ " <td>PreservedSpecimen</td>\n",
605
+ " <td>2017-03-07</td>\n",
606
+ " <td>Mashpi to Pachijal 2</td>\n",
607
+ " <td>Ecuador</td>\n",
608
+ " <td>...</td>\n",
609
+ " <td>Heliconius cydno ssp. alithea</td>\n",
610
+ " <td>NaN</td>\n",
611
+ " <td>Subspecies</td>\n",
612
+ " <td>Heliconius</td>\n",
613
+ " <td>Nymphalidae</td>\n",
614
+ " <td>Lepidoptera</td>\n",
615
+ " <td>Insecta</td>\n",
616
+ " <td>Animalia</td>\n",
617
+ " <td>NaN</td>\n",
618
+ " <td>{}</td>\n",
619
+ " </tr>\n",
620
+ " <tr>\n",
621
+ " <th>1</th>\n",
622
+ " <td>000dc8ca-5d60-4aff-9823-33d20d52c7cd</td>\n",
623
+ " <td>000dc8ca-5d60-4aff-9823-33d20d52c7cd</td>\n",
624
+ " <td>CAM040277</td>\n",
625
+ " <td>Heliconiine Butterfly Collection Records from ...</td>\n",
626
+ " <td>NaN</td>\n",
627
+ " <td>NaN</td>\n",
628
+ " <td>PreservedSpecimen</td>\n",
629
+ " <td>2017-01-30</td>\n",
630
+ " <td>Km 119 Baeza - Lago Agrio</td>\n",
631
+ " <td>Ecuador</td>\n",
632
+ " <td>...</td>\n",
633
+ " <td>Actinote sp.</td>\n",
634
+ " <td>NaN</td>\n",
635
+ " <td>Species</td>\n",
636
+ " <td>Actinote</td>\n",
637
+ " <td>Nymphalidae</td>\n",
638
+ " <td>Lepidoptera</td>\n",
639
+ " <td>Insecta</td>\n",
640
+ " <td>Animalia</td>\n",
641
+ " <td>NaN</td>\n",
642
+ " <td>{}</td>\n",
643
+ " </tr>\n",
644
+ " <tr>\n",
645
+ " <th>2</th>\n",
646
+ " <td>001b4619-bfe3-4a89-9709-45a70c1fa380</td>\n",
647
+ " <td>001b4619-bfe3-4a89-9709-45a70c1fa380</td>\n",
648
+ " <td>CAM120368</td>\n",
649
+ " <td>Heliconiine Butterfly Collection Records from ...</td>\n",
650
+ " <td>NaN</td>\n",
651
+ " <td>NaN</td>\n",
652
+ " <td>PreservedSpecimen</td>\n",
653
+ " <td>2005-11-15</td>\n",
654
+ " <td>Anangu Boca del Rio ECD OR</td>\n",
655
+ " <td>Ecuador</td>\n",
656
+ " <td>...</td>\n",
657
+ " <td>Pseudoscada timna ssp. utilla</td>\n",
658
+ " <td>NaN</td>\n",
659
+ " <td>Subspecies</td>\n",
660
+ " <td>Pseudoscada</td>\n",
661
+ " <td>Nymphalidae</td>\n",
662
+ " <td>Lepidoptera</td>\n",
663
+ " <td>Insecta</td>\n",
664
+ " <td>Animalia</td>\n",
665
+ " <td>NaN</td>\n",
666
+ " <td>{}</td>\n",
667
+ " </tr>\n",
668
+ " <tr>\n",
669
+ " <th>3</th>\n",
670
+ " <td>0021e86f-64b3-4ce8-b872-f783f00f5f6a</td>\n",
671
+ " <td>0021e86f-64b3-4ce8-b872-f783f00f5f6a</td>\n",
672
+ " <td>CAM014638</td>\n",
673
+ " <td>Heliconiine Butterfly Collection Records from ...</td>\n",
674
+ " <td>NaN</td>\n",
675
+ " <td>NaN</td>\n",
676
+ " <td>PreservedSpecimen</td>\n",
677
+ " <td>2009-11-23</td>\n",
678
+ " <td>Puerta Lara</td>\n",
679
+ " <td>Panamá</td>\n",
680
+ " <td>...</td>\n",
681
+ " <td>Heliconius melpomene ssp. melpomene</td>\n",
682
+ " <td>NaN</td>\n",
683
+ " <td>Subspecies</td>\n",
684
+ " <td>Heliconius</td>\n",
685
+ " <td>Nymphalidae</td>\n",
686
+ " <td>Lepidoptera</td>\n",
687
+ " <td>Insecta</td>\n",
688
+ " <td>Animalia</td>\n",
689
+ " <td>NaN</td>\n",
690
+ " <td>{}</td>\n",
691
+ " </tr>\n",
692
+ " <tr>\n",
693
+ " <th>4</th>\n",
694
+ " <td>0034a857-9ed6-45be-b437-8e20eef541bb</td>\n",
695
+ " <td>0034a857-9ed6-45be-b437-8e20eef541bb</td>\n",
696
+ " <td>CAM008071</td>\n",
697
+ " <td>Heliconiine Butterfly Collection Records from ...</td>\n",
698
+ " <td>NaN</td>\n",
699
+ " <td>NaN</td>\n",
700
+ " <td>PreservedSpecimen</td>\n",
701
+ " <td>2000-12-17</td>\n",
702
+ " <td>Gamboa #183</td>\n",
703
+ " <td>Panamá</td>\n",
704
+ " <td>...</td>\n",
705
+ " <td>Anthanassa drusilla</td>\n",
706
+ " <td>NaN</td>\n",
707
+ " <td>Species</td>\n",
708
+ " <td>Anthanassa</td>\n",
709
+ " <td>Nymphalidae</td>\n",
710
+ " <td>Lepidoptera</td>\n",
711
+ " <td>Insecta</td>\n",
712
+ " <td>Animalia</td>\n",
713
+ " <td>NaN</td>\n",
714
+ " <td>{}</td>\n",
715
+ " </tr>\n",
716
+ " </tbody>\n",
717
+ "</table>\n",
718
+ "<p>5 rows × 29 columns</p>\n",
719
+ "</div>"
720
+ ],
721
+ "text/plain": [
722
+ " id occurrenceID \\\n",
723
+ "0 00075b7f-3920-4987-a3e4-e98568a38558 00075b7f-3920-4987-a3e4-e98568a38558 \n",
724
+ "1 000dc8ca-5d60-4aff-9823-33d20d52c7cd 000dc8ca-5d60-4aff-9823-33d20d52c7cd \n",
725
+ "2 001b4619-bfe3-4a89-9709-45a70c1fa380 001b4619-bfe3-4a89-9709-45a70c1fa380 \n",
726
+ "3 0021e86f-64b3-4ce8-b872-f783f00f5f6a 0021e86f-64b3-4ce8-b872-f783f00f5f6a \n",
727
+ "4 0034a857-9ed6-45be-b437-8e20eef541bb 0034a857-9ed6-45be-b437-8e20eef541bb \n",
728
+ "\n",
729
+ " catalogNumber datasetName \\\n",
730
+ "0 CAM040599 Heliconiine Butterfly Collection Records from ... \n",
731
+ "1 CAM040277 Heliconiine Butterfly Collection Records from ... \n",
732
+ "2 CAM120368 Heliconiine Butterfly Collection Records from ... \n",
733
+ "3 CAM014638 Heliconiine Butterfly Collection Records from ... \n",
734
+ "4 CAM008071 Heliconiine Butterfly Collection Records from ... \n",
735
+ "\n",
736
+ " recordNumber otherCatalogNumbers basisOfRecord eventDate \\\n",
737
+ "0 NaN NaN PreservedSpecimen 2017-03-07 \n",
738
+ "1 NaN NaN PreservedSpecimen 2017-01-30 \n",
739
+ "2 NaN NaN PreservedSpecimen 2005-11-15 \n",
740
+ "3 NaN NaN PreservedSpecimen 2009-11-23 \n",
741
+ "4 NaN NaN PreservedSpecimen 2000-12-17 \n",
742
+ "\n",
743
+ " locality country ... \\\n",
744
+ "0 Mashpi to Pachijal 2 Ecuador ... \n",
745
+ "1 Km 119 Baeza - Lago Agrio Ecuador ... \n",
746
+ "2 Anangu Boca del Rio ECD OR Ecuador ... \n",
747
+ "3 Puerta Lara Panamá ... \n",
748
+ "4 Gamboa #183 Panamá ... \n",
749
+ "\n",
750
+ " scientificName scientificNameAuthorship taxonRank \\\n",
751
+ "0 Heliconius cydno ssp. alithea NaN Subspecies \n",
752
+ "1 Actinote sp. NaN Species \n",
753
+ "2 Pseudoscada timna ssp. utilla NaN Subspecies \n",
754
+ "3 Heliconius melpomene ssp. melpomene NaN Subspecies \n",
755
+ "4 Anthanassa drusilla NaN Species \n",
756
+ "\n",
757
+ " genus family order class kingdom \\\n",
758
+ "0 Heliconius Nymphalidae Lepidoptera Insecta Animalia \n",
759
+ "1 Actinote Nymphalidae Lepidoptera Insecta Animalia \n",
760
+ "2 Pseudoscada Nymphalidae Lepidoptera Insecta Animalia \n",
761
+ "3 Heliconius Nymphalidae Lepidoptera Insecta Animalia \n",
762
+ "4 Anthanassa Nymphalidae Lepidoptera Insecta Animalia \n",
763
+ "\n",
764
+ " coordinateUncertaintyInMeters dynamicProperties \n",
765
+ "0 NaN {} \n",
766
+ "1 NaN {} \n",
767
+ "2 NaN {} \n",
768
+ "3 NaN {} \n",
769
+ "4 NaN {} \n",
770
+ "\n",
771
+ "[5 rows x 29 columns]"
772
+ ]
773
+ },
774
+ "execution_count": 13,
775
+ "metadata": {},
776
+ "output_type": "execute_result"
777
+ }
778
+ ],
779
+ "source": [
780
+ "occurrence.head()"
781
+ ]
782
+ },
783
+ {
784
+ "cell_type": "markdown",
785
+ "metadata": {},
786
+ "source": [
787
+ "How many unique CAMIDs do we have in `multimedia`?"
788
+ ]
789
+ },
790
+ {
791
+ "cell_type": "code",
792
+ "execution_count": 14,
793
+ "metadata": {},
794
+ "outputs": [
795
+ {
796
+ "data": {
797
+ "text/plain": [
798
+ "2802"
799
+ ]
800
+ },
801
+ "execution_count": 14,
802
+ "metadata": {},
803
+ "output_type": "execute_result"
804
+ }
805
+ ],
806
+ "source": [
807
+ "def get_camid(image_name):\n",
808
+ " if \"_\" in image_name:\n",
809
+ " return image_name.split(\"_\")[0]\n",
810
+ " else:\n",
811
+ " # We have at least one record with image name that doesn't have CAMID (the non-zenodo record)\n",
812
+ " return np.nan\n",
813
+ "\n",
814
+ "multimedia[\"CAMID\"] = multimedia[\"Image_name\"].apply(get_camid)\n",
815
+ "multimedia[\"CAMID\"].nunique()"
816
+ ]
817
+ },
818
+ {
819
+ "cell_type": "markdown",
820
+ "metadata": {},
821
+ "source": [
822
+ "Okay, so there are more unique `CAMID`s than there are unique `coreid`s, but less than there are unique CAMIDs (`catalogNumber`) in `occurrence`...\n",
823
+ "\n",
824
+ "What do I get if I merge these on `CAMID` and `coreid`?"
825
+ ]
826
+ },
827
+ {
828
+ "cell_type": "code",
829
+ "execution_count": 15,
830
+ "metadata": {},
831
+ "outputs": [
832
+ {
833
+ "name": "stdout",
834
+ "output_type": "stream",
835
+ "text": [
836
+ "<class 'pandas.core.frame.DataFrame'>\n",
837
+ "RangeIndex: 5407 entries, 0 to 5406\n",
838
+ "Data columns (total 37 columns):\n",
839
+ " # Column Non-Null Count Dtype \n",
840
+ "--- ------ -------------- ----- \n",
841
+ " 0 coreid 5407 non-null object \n",
842
+ " 1 type 0 non-null float64\n",
843
+ " 2 identifier 5407 non-null object \n",
844
+ " 3 license 0 non-null float64\n",
845
+ " 4 zenodo_link 5407 non-null object \n",
846
+ " 5 Image_name 5407 non-null object \n",
847
+ " 6 record_number 5407 non-null object \n",
848
+ " 7 CAMID 5407 non-null object \n",
849
+ " 8 id 5407 non-null object \n",
850
+ " 9 occurrenceID 5407 non-null object \n",
851
+ " 10 catalogNumber 5407 non-null object \n",
852
+ " 11 datasetName 5407 non-null object \n",
853
+ " 12 recordNumber 0 non-null float64\n",
854
+ " 13 otherCatalogNumbers 0 non-null object \n",
855
+ " 14 basisOfRecord 5407 non-null object \n",
856
+ " 15 eventDate 4937 non-null object \n",
857
+ " 16 locality 5407 non-null object \n",
858
+ " 17 country 5407 non-null object \n",
859
+ " 18 decimalLatitude 5407 non-null float64\n",
860
+ " 19 decimalLongitude 5407 non-null float64\n",
861
+ " 20 geodeticDatum 5407 non-null int64 \n",
862
+ " 21 year 4937 non-null float64\n",
863
+ " 22 sex 5307 non-null object \n",
864
+ " 23 lifeStage 0 non-null object \n",
865
+ " 24 recordedBy 0 non-null float64\n",
866
+ " 25 individualCount 5407 non-null int64 \n",
867
+ " 26 taxonId 1473 non-null float64\n",
868
+ " 27 scientificName 5389 non-null object \n",
869
+ " 28 scientificNameAuthorship 0 non-null float64\n",
870
+ " 29 taxonRank 5387 non-null object \n",
871
+ " 30 genus 5387 non-null object \n",
872
+ " 31 family 5211 non-null object \n",
873
+ " 32 order 5211 non-null object \n",
874
+ " 33 class 5211 non-null object \n",
875
+ " 34 kingdom 5211 non-null object \n",
876
+ " 35 coordinateUncertaintyInMeters 0 non-null float64\n",
877
+ " 36 dynamicProperties 5407 non-null object \n",
878
+ "dtypes: float64(10), int64(2), object(25)\n",
879
+ "memory usage: 1.5+ MB\n"
880
+ ]
881
+ }
882
+ ],
883
+ "source": [
884
+ "test_merge = pd.merge(multimedia,\n",
885
+ " occurrence,\n",
886
+ " left_on = [\"coreid\", \"CAMID\"],\n",
887
+ " right_on = [\"id\", \"catalogNumber\"],\n",
888
+ " how = \"inner\")\n",
889
+ "test_merge.info(show_counts=True)"
890
+ ]
891
+ },
892
+ {
893
+ "cell_type": "markdown",
894
+ "metadata": {},
895
+ "source": [
896
+ "So there are about 270 images listed in `multimedia` that are unaccounted for in `occurences`."
897
+ ]
898
+ },
899
+ {
900
+ "cell_type": "code",
901
+ "execution_count": 16,
902
+ "metadata": {},
903
+ "outputs": [
904
+ {
905
+ "data": {
906
+ "text/html": [
907
+ "<div>\n",
908
+ "<style scoped>\n",
909
+ " .dataframe tbody tr th:only-of-type {\n",
910
+ " vertical-align: middle;\n",
911
+ " }\n",
912
+ "\n",
913
+ " .dataframe tbody tr th {\n",
914
+ " vertical-align: top;\n",
915
+ " }\n",
916
+ "\n",
917
+ " .dataframe thead th {\n",
918
+ " text-align: right;\n",
919
+ " }\n",
920
+ "</style>\n",
921
+ "<table border=\"1\" class=\"dataframe\">\n",
922
+ " <thead>\n",
923
+ " <tr style=\"text-align: right;\">\n",
924
+ " <th></th>\n",
925
+ " <th>coreid</th>\n",
926
+ " <th>type</th>\n",
927
+ " <th>identifier</th>\n",
928
+ " <th>license</th>\n",
929
+ " <th>zenodo_link</th>\n",
930
+ " <th>Image_name</th>\n",
931
+ " <th>record_number</th>\n",
932
+ " <th>CAMID</th>\n",
933
+ " <th>id</th>\n",
934
+ " <th>occurrenceID</th>\n",
935
+ " <th>catalogNumber</th>\n",
936
+ " <th>datasetName</th>\n",
937
+ " </tr>\n",
938
+ " </thead>\n",
939
+ " <tbody>\n",
940
+ " <tr>\n",
941
+ " <th>0</th>\n",
942
+ " <td>275ad2e7-bc7e-4e74-832e-869825f5bf0b</td>\n",
943
+ " <td>NaN</td>\n",
944
+ " <td>https://zenodo.org/record/2684906/files/CAM008...</td>\n",
945
+ " <td>NaN</td>\n",
946
+ " <td>https://zenodo.org/record/2684906</td>\n",
947
+ " <td>CAM008538_d.JPG</td>\n",
948
+ " <td>2684906</td>\n",
949
+ " <td>CAM008538</td>\n",
950
+ " <td>275ad2e7-bc7e-4e74-832e-869825f5bf0b</td>\n",
951
+ " <td>275ad2e7-bc7e-4e74-832e-869825f5bf0b</td>\n",
952
+ " <td>CAM008538</td>\n",
953
+ " <td>Heliconiine Butterfly Collection Records from ...</td>\n",
954
+ " </tr>\n",
955
+ " <tr>\n",
956
+ " <th>1</th>\n",
957
+ " <td>275ad2e7-bc7e-4e74-832e-869825f5bf0b</td>\n",
958
+ " <td>NaN</td>\n",
959
+ " <td>https://zenodo.org/record/2684906/files/CAM008...</td>\n",
960
+ " <td>NaN</td>\n",
961
+ " <td>https://zenodo.org/record/2684906</td>\n",
962
+ " <td>CAM008538_v.JPG</td>\n",
963
+ " <td>2684906</td>\n",
964
+ " <td>CAM008538</td>\n",
965
+ " <td>275ad2e7-bc7e-4e74-832e-869825f5bf0b</td>\n",
966
+ " <td>275ad2e7-bc7e-4e74-832e-869825f5bf0b</td>\n",
967
+ " <td>CAM008538</td>\n",
968
+ " <td>Heliconiine Butterfly Collection Records from ...</td>\n",
969
+ " </tr>\n",
970
+ " <tr>\n",
971
+ " <th>2</th>\n",
972
+ " <td>cf02ac3a-6204-417c-b342-6f84eab48931</td>\n",
973
+ " <td>NaN</td>\n",
974
+ " <td>https://zenodo.org/record/2714333/files/CAM041...</td>\n",
975
+ " <td>NaN</td>\n",
976
+ " <td>https://zenodo.org/record/2714333</td>\n",
977
+ " <td>CAM041048_v.JPG</td>\n",
978
+ " <td>2714333</td>\n",
979
+ " <td>CAM041048</td>\n",
980
+ " <td>cf02ac3a-6204-417c-b342-6f84eab48931</td>\n",
981
+ " <td>cf02ac3a-6204-417c-b342-6f84eab48931</td>\n",
982
+ " <td>CAM041048</td>\n",
983
+ " <td>Heliconiine Butterfly Collection Records from ...</td>\n",
984
+ " </tr>\n",
985
+ " <tr>\n",
986
+ " <th>3</th>\n",
987
+ " <td>cf02ac3a-6204-417c-b342-6f84eab48931</td>\n",
988
+ " <td>NaN</td>\n",
989
+ " <td>https://zenodo.org/record/2714333/files/CAM041...</td>\n",
990
+ " <td>NaN</td>\n",
991
+ " <td>https://zenodo.org/record/2714333</td>\n",
992
+ " <td>CAM041048_d.JPG</td>\n",
993
+ " <td>2714333</td>\n",
994
+ " <td>CAM041048</td>\n",
995
+ " <td>cf02ac3a-6204-417c-b342-6f84eab48931</td>\n",
996
+ " <td>cf02ac3a-6204-417c-b342-6f84eab48931</td>\n",
997
+ " <td>CAM041048</td>\n",
998
+ " <td>Heliconiine Butterfly Collection Records from ...</td>\n",
999
+ " </tr>\n",
1000
+ " <tr>\n",
1001
+ " <th>4</th>\n",
1002
+ " <td>7be80267-dbe9-4f4b-8f73-c7355447d5e1</td>\n",
1003
+ " <td>NaN</td>\n",
1004
+ " <td>https://zenodo.org/record/2686762/files/CAM008...</td>\n",
1005
+ " <td>NaN</td>\n",
1006
+ " <td>https://zenodo.org/record/2686762</td>\n",
1007
+ " <td>CAM008842_d.JPG</td>\n",
1008
+ " <td>2686762</td>\n",
1009
+ " <td>CAM008842</td>\n",
1010
+ " <td>7be80267-dbe9-4f4b-8f73-c7355447d5e1</td>\n",
1011
+ " <td>7be80267-dbe9-4f4b-8f73-c7355447d5e1</td>\n",
1012
+ " <td>CAM008842</td>\n",
1013
+ " <td>Heliconiine Butterfly Collection Records from ...</td>\n",
1014
+ " </tr>\n",
1015
+ " </tbody>\n",
1016
+ "</table>\n",
1017
+ "</div>"
1018
+ ],
1019
+ "text/plain": [
1020
+ " coreid type \\\n",
1021
+ "0 275ad2e7-bc7e-4e74-832e-869825f5bf0b NaN \n",
1022
+ "1 275ad2e7-bc7e-4e74-832e-869825f5bf0b NaN \n",
1023
+ "2 cf02ac3a-6204-417c-b342-6f84eab48931 NaN \n",
1024
+ "3 cf02ac3a-6204-417c-b342-6f84eab48931 NaN \n",
1025
+ "4 7be80267-dbe9-4f4b-8f73-c7355447d5e1 NaN \n",
1026
+ "\n",
1027
+ " identifier license \\\n",
1028
+ "0 https://zenodo.org/record/2684906/files/CAM008... NaN \n",
1029
+ "1 https://zenodo.org/record/2684906/files/CAM008... NaN \n",
1030
+ "2 https://zenodo.org/record/2714333/files/CAM041... NaN \n",
1031
+ "3 https://zenodo.org/record/2714333/files/CAM041... NaN \n",
1032
+ "4 https://zenodo.org/record/2686762/files/CAM008... NaN \n",
1033
+ "\n",
1034
+ " zenodo_link Image_name record_number \\\n",
1035
+ "0 https://zenodo.org/record/2684906 CAM008538_d.JPG 2684906 \n",
1036
+ "1 https://zenodo.org/record/2684906 CAM008538_v.JPG 2684906 \n",
1037
+ "2 https://zenodo.org/record/2714333 CAM041048_v.JPG 2714333 \n",
1038
+ "3 https://zenodo.org/record/2714333 CAM041048_d.JPG 2714333 \n",
1039
+ "4 https://zenodo.org/record/2686762 CAM008842_d.JPG 2686762 \n",
1040
+ "\n",
1041
+ " CAMID id \\\n",
1042
+ "0 CAM008538 275ad2e7-bc7e-4e74-832e-869825f5bf0b \n",
1043
+ "1 CAM008538 275ad2e7-bc7e-4e74-832e-869825f5bf0b \n",
1044
+ "2 CAM041048 cf02ac3a-6204-417c-b342-6f84eab48931 \n",
1045
+ "3 CAM041048 cf02ac3a-6204-417c-b342-6f84eab48931 \n",
1046
+ "4 CAM008842 7be80267-dbe9-4f4b-8f73-c7355447d5e1 \n",
1047
+ "\n",
1048
+ " occurrenceID catalogNumber \\\n",
1049
+ "0 275ad2e7-bc7e-4e74-832e-869825f5bf0b CAM008538 \n",
1050
+ "1 275ad2e7-bc7e-4e74-832e-869825f5bf0b CAM008538 \n",
1051
+ "2 cf02ac3a-6204-417c-b342-6f84eab48931 CAM041048 \n",
1052
+ "3 cf02ac3a-6204-417c-b342-6f84eab48931 CAM041048 \n",
1053
+ "4 7be80267-dbe9-4f4b-8f73-c7355447d5e1 CAM008842 \n",
1054
+ "\n",
1055
+ " datasetName \n",
1056
+ "0 Heliconiine Butterfly Collection Records from ... \n",
1057
+ "1 Heliconiine Butterfly Collection Records from ... \n",
1058
+ "2 Heliconiine Butterfly Collection Records from ... \n",
1059
+ "3 Heliconiine Butterfly Collection Records from ... \n",
1060
+ "4 Heliconiine Butterfly Collection Records from ... "
1061
+ ]
1062
+ },
1063
+ "execution_count": 16,
1064
+ "metadata": {},
1065
+ "output_type": "execute_result"
1066
+ }
1067
+ ],
1068
+ "source": [
1069
+ "test_merge[list(test_merge.columns)[:12]].head()"
1070
+ ]
1071
+ },
1072
+ {
1073
+ "cell_type": "code",
1074
+ "execution_count": 17,
1075
+ "metadata": {},
1076
+ "outputs": [
1077
+ {
1078
+ "data": {
1079
+ "text/plain": [
1080
+ "coreid 2713\n",
1081
+ "CAMID 2713\n",
1082
+ "identifier 5407\n",
1083
+ "record_number 10\n",
1084
+ "dtype: int64"
1085
+ ]
1086
+ },
1087
+ "execution_count": 17,
1088
+ "metadata": {},
1089
+ "output_type": "execute_result"
1090
+ }
1091
+ ],
1092
+ "source": [
1093
+ "test_merge[[\"coreid\", \"CAMID\", \"identifier\", \"record_number\"]].nunique()"
1094
+ ]
1095
+ },
1096
+ {
1097
+ "cell_type": "markdown",
1098
+ "metadata": {},
1099
+ "source": [
1100
+ "Uniqueness counts from `multimedia`:\n",
1101
+ "```\n",
1102
+ "CAMID 2802\n",
1103
+ "coreid 2794\n",
1104
+ "identifier 5683\n",
1105
+ "Image_name 5683\n",
1106
+ "record_number 12\n",
1107
+ "```\n",
1108
+ "It seems there are 2 records that don't match on IDs, which is a loss of 81 unique listings in `multimedia`.\n",
1109
+ "\n",
1110
+ "How will this compare to the entries from record 3477891 in our master file? Also, are these other records in there?"
1111
+ ]
1112
+ },
1113
+ {
1114
+ "cell_type": "code",
1115
+ "execution_count": 18,
1116
+ "metadata": {},
1117
+ "outputs": [
1118
+ {
1119
+ "name": "stdout",
1120
+ "output_type": "stream",
1121
+ "text": [
1122
+ "<class 'pandas.core.frame.DataFrame'>\n",
1123
+ "Index: 5501 entries, 3235 to 42852\n",
1124
+ "Data columns (total 28 columns):\n",
1125
+ " # Column Non-Null Count Dtype \n",
1126
+ "--- ------ -------------- ----- \n",
1127
+ " 0 CAMID 5501 non-null object\n",
1128
+ " 1 X 5501 non-null int64 \n",
1129
+ " 2 Image_name 5501 non-null object\n",
1130
+ " 3 View 5501 non-null object\n",
1131
+ " 4 zenodo_name 5501 non-null object\n",
1132
+ " 5 zenodo_link 5501 non-null object\n",
1133
+ " 6 Sequence 5501 non-null object\n",
1134
+ " 7 Taxonomic_Name 5501 non-null object\n",
1135
+ " 8 Locality 5501 non-null object\n",
1136
+ " 9 Sample_accession 925 non-null object\n",
1137
+ " 10 Collected_by 0 non-null object\n",
1138
+ " 11 Other_ID 12 non-null object\n",
1139
+ " 12 Date 5025 non-null object\n",
1140
+ " 13 Dataset 5501 non-null object\n",
1141
+ " 14 Store 5421 non-null object\n",
1142
+ " 15 Brood 4 non-null object\n",
1143
+ " 16 Death_Date 0 non-null object\n",
1144
+ " 17 Cross_Type 0 non-null object\n",
1145
+ " 18 Stage 0 non-null object\n",
1146
+ " 19 Sex 5435 non-null object\n",
1147
+ " 20 Unit_Type 5501 non-null object\n",
1148
+ " 21 file_type 5501 non-null object\n",
1149
+ " 22 record_number 5501 non-null int64 \n",
1150
+ " 23 species 5501 non-null object\n",
1151
+ " 24 subspecies 3673 non-null object\n",
1152
+ " 25 genus 5501 non-null object\n",
1153
+ " 26 file_url 5501 non-null object\n",
1154
+ " 27 hybrid_stat 3705 non-null object\n",
1155
+ "dtypes: int64(2), object(26)\n",
1156
+ "memory usage: 1.2+ MB\n"
1157
+ ]
1158
+ }
1159
+ ],
1160
+ "source": [
1161
+ "df = pd.read_csv(\"../Jiggins_Zenodo_Img_Master.csv\", low_memory = False)\n",
1162
+ "\n",
1163
+ "odd_record = df.loc[df[\"record_number\"] == 3477891]\n",
1164
+ "odd_record.info()"
1165
+ ]
1166
+ },
1167
+ {
1168
+ "cell_type": "code",
1169
+ "execution_count": 19,
1170
+ "metadata": {},
1171
+ "outputs": [],
1172
+ "source": [
1173
+ "id_cols = [\"CAMID\", \"X\", \"Image_name\", \"zenodo_name\", \"zenodo_link\", \"file_url\", \"Dataset\"]"
1174
+ ]
1175
+ },
1176
+ {
1177
+ "cell_type": "code",
1178
+ "execution_count": 20,
1179
+ "metadata": {},
1180
+ "outputs": [
1181
+ {
1182
+ "data": {
1183
+ "text/plain": [
1184
+ "CAMID 2704\n",
1185
+ "X 5501\n",
1186
+ "Image_name 5497\n",
1187
+ "zenodo_name 1\n",
1188
+ "zenodo_link 1\n",
1189
+ "file_url 5497\n",
1190
+ "Dataset 1\n",
1191
+ "dtype: int64"
1192
+ ]
1193
+ },
1194
+ "execution_count": 20,
1195
+ "metadata": {},
1196
+ "output_type": "execute_result"
1197
+ }
1198
+ ],
1199
+ "source": [
1200
+ "odd_record[id_cols].nunique()"
1201
+ ]
1202
+ },
1203
+ {
1204
+ "cell_type": "markdown",
1205
+ "metadata": {},
1206
+ "source": [
1207
+ "This falls somewhere between the `multimedia` & `occurrence` merge, and the `multimedia` file. Let's see a sample of these images then try aligning it with `multimedia` on `Image_name`."
1208
+ ]
1209
+ },
1210
+ {
1211
+ "cell_type": "code",
1212
+ "execution_count": 21,
1213
+ "metadata": {},
1214
+ "outputs": [
1215
+ {
1216
+ "data": {
1217
+ "text/html": [
1218
+ "<div>\n",
1219
+ "<style scoped>\n",
1220
+ " .dataframe tbody tr th:only-of-type {\n",
1221
+ " vertical-align: middle;\n",
1222
+ " }\n",
1223
+ "\n",
1224
+ " .dataframe tbody tr th {\n",
1225
+ " vertical-align: top;\n",
1226
+ " }\n",
1227
+ "\n",
1228
+ " .dataframe thead th {\n",
1229
+ " text-align: right;\n",
1230
+ " }\n",
1231
+ "</style>\n",
1232
+ "<table border=\"1\" class=\"dataframe\">\n",
1233
+ " <thead>\n",
1234
+ " <tr style=\"text-align: right;\">\n",
1235
+ " <th></th>\n",
1236
+ " <th>CAMID</th>\n",
1237
+ " <th>X</th>\n",
1238
+ " <th>Image_name</th>\n",
1239
+ " <th>zenodo_name</th>\n",
1240
+ " <th>zenodo_link</th>\n",
1241
+ " <th>file_url</th>\n",
1242
+ " <th>Dataset</th>\n",
1243
+ " </tr>\n",
1244
+ " </thead>\n",
1245
+ " <tbody>\n",
1246
+ " <tr>\n",
1247
+ " <th>3235</th>\n",
1248
+ " <td>CAM000001</td>\n",
1249
+ " <td>44387</td>\n",
1250
+ " <td>CAM000001_v.JPG</td>\n",
1251
+ " <td>occurences_and_multimedia.csv</td>\n",
1252
+ " <td>https://zenodo.org/record/3477891</td>\n",
1253
+ " <td>https://zenodo.org/record/3477891/files/CAM000...</td>\n",
1254
+ " <td>Heliconiine Butterfly Collection Records from ...</td>\n",
1255
+ " </tr>\n",
1256
+ " <tr>\n",
1257
+ " <th>3236</th>\n",
1258
+ " <td>CAM000001</td>\n",
1259
+ " <td>44386</td>\n",
1260
+ " <td>CAM000001_d.JPG</td>\n",
1261
+ " <td>occurences_and_multimedia.csv</td>\n",
1262
+ " <td>https://zenodo.org/record/3477891</td>\n",
1263
+ " <td>https://zenodo.org/record/3477891/files/CAM000...</td>\n",
1264
+ " <td>Heliconiine Butterfly Collection Records from ...</td>\n",
1265
+ " </tr>\n",
1266
+ " <tr>\n",
1267
+ " <th>3237</th>\n",
1268
+ " <td>CAM000003</td>\n",
1269
+ " <td>44388</td>\n",
1270
+ " <td>CAM000003_d.JPG</td>\n",
1271
+ " <td>occurences_and_multimedia.csv</td>\n",
1272
+ " <td>https://zenodo.org/record/3477891</td>\n",
1273
+ " <td>https://zenodo.org/record/3477891/files/CAM000...</td>\n",
1274
+ " <td>Heliconiine Butterfly Collection Records from ...</td>\n",
1275
+ " </tr>\n",
1276
+ " <tr>\n",
1277
+ " <th>3240</th>\n",
1278
+ " <td>CAM000003</td>\n",
1279
+ " <td>44389</td>\n",
1280
+ " <td>CAM000003_v.JPG</td>\n",
1281
+ " <td>occurences_and_multimedia.csv</td>\n",
1282
+ " <td>https://zenodo.org/record/3477891</td>\n",
1283
+ " <td>https://zenodo.org/record/3477891/files/CAM000...</td>\n",
1284
+ " <td>Heliconiine Butterfly Collection Records from ...</td>\n",
1285
+ " </tr>\n",
1286
+ " <tr>\n",
1287
+ " <th>3242</th>\n",
1288
+ " <td>CAM000004</td>\n",
1289
+ " <td>44390</td>\n",
1290
+ " <td>CAM000004_d.JPG</td>\n",
1291
+ " <td>occurences_and_multimedia.csv</td>\n",
1292
+ " <td>https://zenodo.org/record/3477891</td>\n",
1293
+ " <td>https://zenodo.org/record/3477891/files/CAM000...</td>\n",
1294
+ " <td>Heliconiine Butterfly Collection Records from ...</td>\n",
1295
+ " </tr>\n",
1296
+ " </tbody>\n",
1297
+ "</table>\n",
1298
+ "</div>"
1299
+ ],
1300
+ "text/plain": [
1301
+ " CAMID X Image_name zenodo_name \\\n",
1302
+ "3235 CAM000001 44387 CAM000001_v.JPG occurences_and_multimedia.csv \n",
1303
+ "3236 CAM000001 44386 CAM000001_d.JPG occurences_and_multimedia.csv \n",
1304
+ "3237 CAM000003 44388 CAM000003_d.JPG occurences_and_multimedia.csv \n",
1305
+ "3240 CAM000003 44389 CAM000003_v.JPG occurences_and_multimedia.csv \n",
1306
+ "3242 CAM000004 44390 CAM000004_d.JPG occurences_and_multimedia.csv \n",
1307
+ "\n",
1308
+ " zenodo_link \\\n",
1309
+ "3235 https://zenodo.org/record/3477891 \n",
1310
+ "3236 https://zenodo.org/record/3477891 \n",
1311
+ "3237 https://zenodo.org/record/3477891 \n",
1312
+ "3240 https://zenodo.org/record/3477891 \n",
1313
+ "3242 https://zenodo.org/record/3477891 \n",
1314
+ "\n",
1315
+ " file_url \\\n",
1316
+ "3235 https://zenodo.org/record/3477891/files/CAM000... \n",
1317
+ "3236 https://zenodo.org/record/3477891/files/CAM000... \n",
1318
+ "3237 https://zenodo.org/record/3477891/files/CAM000... \n",
1319
+ "3240 https://zenodo.org/record/3477891/files/CAM000... \n",
1320
+ "3242 https://zenodo.org/record/3477891/files/CAM000... \n",
1321
+ "\n",
1322
+ " Dataset \n",
1323
+ "3235 Heliconiine Butterfly Collection Records from ... \n",
1324
+ "3236 Heliconiine Butterfly Collection Records from ... \n",
1325
+ "3237 Heliconiine Butterfly Collection Records from ... \n",
1326
+ "3240 Heliconiine Butterfly Collection Records from ... \n",
1327
+ "3242 Heliconiine Butterfly Collection Records from ... "
1328
+ ]
1329
+ },
1330
+ "execution_count": 21,
1331
+ "metadata": {},
1332
+ "output_type": "execute_result"
1333
+ }
1334
+ ],
1335
+ "source": [
1336
+ "odd_record[id_cols].head()"
1337
+ ]
1338
+ },
1339
+ {
1340
+ "cell_type": "markdown",
1341
+ "metadata": {},
1342
+ "source": [
1343
+ "They are all labeled as that dataset with the `zenodo_name` \"occurrences_and_multimedia.csv\" because it was a combo of these used by Christopher to populate the CSV."
1344
+ ]
1345
+ },
1346
+ {
1347
+ "cell_type": "code",
1348
+ "execution_count": 22,
1349
+ "metadata": {},
1350
+ "outputs": [
1351
+ {
1352
+ "name": "stdout",
1353
+ "output_type": "stream",
1354
+ "text": [
1355
+ "<class 'pandas.core.frame.DataFrame'>\n",
1356
+ "RangeIndex: 5501 entries, 0 to 5500\n",
1357
+ "Data columns (total 14 columns):\n",
1358
+ " # Column Non-Null Count Dtype \n",
1359
+ "--- ------ -------------- ----- \n",
1360
+ " 0 CAMID_master 5501 non-null object \n",
1361
+ " 1 X 5501 non-null int64 \n",
1362
+ " 2 Image_name 5501 non-null object \n",
1363
+ " 3 zenodo_name 5501 non-null object \n",
1364
+ " 4 zenodo_link_master 5501 non-null object \n",
1365
+ " 5 file_url 5501 non-null object \n",
1366
+ " 6 Dataset 5501 non-null object \n",
1367
+ " 7 coreid 5501 non-null object \n",
1368
+ " 8 type 0 non-null float64\n",
1369
+ " 9 identifier 5501 non-null object \n",
1370
+ " 10 license 0 non-null float64\n",
1371
+ " 11 zenodo_link_media 5501 non-null object \n",
1372
+ " 12 record_number 5501 non-null object \n",
1373
+ " 13 CAMID_media 5409 non-null object \n",
1374
+ "dtypes: float64(2), int64(1), object(11)\n",
1375
+ "memory usage: 601.8+ KB\n"
1376
+ ]
1377
+ }
1378
+ ],
1379
+ "source": [
1380
+ "odd_multimedia = pd.merge(odd_record[id_cols],\n",
1381
+ " multimedia,\n",
1382
+ " on = \"Image_name\",\n",
1383
+ " how = \"inner\",\n",
1384
+ " suffixes = (\"_master\", \"_media\"))\n",
1385
+ "odd_multimedia.info()"
1386
+ ]
1387
+ },
1388
+ {
1389
+ "cell_type": "code",
1390
+ "execution_count": 23,
1391
+ "metadata": {},
1392
+ "outputs": [
1393
+ {
1394
+ "data": {
1395
+ "text/plain": [
1396
+ "CAMID_master 2704\n",
1397
+ "X 5501\n",
1398
+ "Image_name 5497\n",
1399
+ "zenodo_name 1\n",
1400
+ "zenodo_link_master 1\n",
1401
+ "file_url 5497\n",
1402
+ "Dataset 1\n",
1403
+ "coreid 2704\n",
1404
+ "type 0\n",
1405
+ "identifier 5497\n",
1406
+ "license 0\n",
1407
+ "zenodo_link_media 12\n",
1408
+ "record_number 12\n",
1409
+ "CAMID_media 2712\n",
1410
+ "dtype: int64"
1411
+ ]
1412
+ },
1413
+ "execution_count": 23,
1414
+ "metadata": {},
1415
+ "output_type": "execute_result"
1416
+ }
1417
+ ],
1418
+ "source": [
1419
+ "odd_multimedia.nunique()"
1420
+ ]
1421
+ },
1422
+ {
1423
+ "cell_type": "markdown",
1424
+ "metadata": {},
1425
+ "source": [
1426
+ "Looks like all the images were captured (there are more entries than unique `Image_name` & URL), so we should be able to replace the URLs in the master file with the multimedia image URLs directly.\n",
1427
+ "\n",
1428
+ "We do want to compare record numbers to the master file first."
1429
+ ]
1430
+ },
1431
+ {
1432
+ "cell_type": "code",
1433
+ "execution_count": 24,
1434
+ "metadata": {},
1435
+ "outputs": [
1436
+ {
1437
+ "data": {
1438
+ "text/plain": [
1439
+ "0"
1440
+ ]
1441
+ },
1442
+ "execution_count": 24,
1443
+ "metadata": {},
1444
+ "output_type": "execute_result"
1445
+ }
1446
+ ],
1447
+ "source": [
1448
+ "media_records = list(multimedia.record_number.unique())\n",
1449
+ "media_imgs = list(multimedia.Image_name.unique())\n",
1450
+ "master_records = list(df.record_number.unique())\n",
1451
+ "\n",
1452
+ "overlap_records = [record for record in media_records if record in master_records]\n",
1453
+ "len(overlap_records)"
1454
+ ]
1455
+ },
1456
+ {
1457
+ "cell_type": "markdown",
1458
+ "metadata": {},
1459
+ "source": [
1460
+ "Ahhh no duplication then. Interesting (and good!)"
1461
+ ]
1462
+ },
1463
+ {
1464
+ "cell_type": "code",
1465
+ "execution_count": 25,
1466
+ "metadata": {},
1467
+ "outputs": [
1468
+ {
1469
+ "data": {
1470
+ "text/plain": [
1471
+ "(5501, 55)"
1472
+ ]
1473
+ },
1474
+ "execution_count": 25,
1475
+ "metadata": {},
1476
+ "output_type": "execute_result"
1477
+ }
1478
+ ],
1479
+ "source": [
1480
+ "non_odd_df = df.loc[df[\"record_number\"] != 3477891]\n",
1481
+ "\n",
1482
+ "test_odd_merge = pd.merge(odd_record,\n",
1483
+ " non_odd_df,\n",
1484
+ " on = \"Image_name\",\n",
1485
+ " how = \"inner\")\n",
1486
+ "test_odd_merge.shape"
1487
+ ]
1488
+ },
1489
+ {
1490
+ "cell_type": "code",
1491
+ "execution_count": 26,
1492
+ "metadata": {},
1493
+ "outputs": [
1494
+ {
1495
+ "data": {
1496
+ "text/plain": [
1497
+ "'https://zenodo.org/record/2677821/files/CAM000003_v.JPG'"
1498
+ ]
1499
+ },
1500
+ "execution_count": 26,
1501
+ "metadata": {},
1502
+ "output_type": "execute_result"
1503
+ }
1504
+ ],
1505
+ "source": [
1506
+ "multimedia.loc[multimedia[\"Image_name\"] == \"CAM000003_v.JPG\", \"identifier\"].values[0]"
1507
+ ]
1508
+ },
1509
+ {
1510
+ "cell_type": "markdown",
1511
+ "metadata": {},
1512
+ "source": [
1513
+ "Duplication in `Image_name`, though that's not necessarily unexpected."
1514
+ ]
1515
+ },
1516
+ {
1517
+ "cell_type": "code",
1518
+ "execution_count": 27,
1519
+ "metadata": {},
1520
+ "outputs": [
1521
+ {
1522
+ "data": {
1523
+ "text/plain": [
1524
+ "CAMID 2704\n",
1525
+ "X 5501\n",
1526
+ "Image_name 5497\n",
1527
+ "View 2\n",
1528
+ "zenodo_name 1\n",
1529
+ "zenodo_link 1\n",
1530
+ "Sequence 2704\n",
1531
+ "Taxonomic_Name 195\n",
1532
+ "Locality 205\n",
1533
+ "Sample_accession 446\n",
1534
+ "Collected_by 0\n",
1535
+ "Other_ID 5\n",
1536
+ "Date 200\n",
1537
+ "Dataset 1\n",
1538
+ "Store 55\n",
1539
+ "Brood 2\n",
1540
+ "Death_Date 0\n",
1541
+ "Cross_Type 0\n",
1542
+ "Stage 0\n",
1543
+ "Sex 3\n",
1544
+ "Unit_Type 2\n",
1545
+ "file_type 1\n",
1546
+ "record_number 1\n",
1547
+ "species 121\n",
1548
+ "subspecies 93\n",
1549
+ "genus 38\n",
1550
+ "file_url 5497\n",
1551
+ "hybrid_stat 2\n",
1552
+ "dtype: int64"
1553
+ ]
1554
+ },
1555
+ "execution_count": 27,
1556
+ "metadata": {},
1557
+ "output_type": "execute_result"
1558
+ }
1559
+ ],
1560
+ "source": [
1561
+ "for image_name in list(odd_record.Image_name.unique()):\n",
1562
+ " url = multimedia.loc[multimedia[\"Image_name\"] == image_name, \"identifier\"].values[0]\n",
1563
+ " df.loc[(df[\"record_number\"] == 3477891) & (df[\"Image_name\"] == image_name), \"file_url\"] = url\n",
1564
+ "\n",
1565
+ "df.loc[df[\"record_number\"] == 3477891].nunique()"
1566
+ ]
1567
+ },
1568
+ {
1569
+ "cell_type": "code",
1570
+ "execution_count": 28,
1571
+ "metadata": {},
1572
+ "outputs": [
1573
+ {
1574
+ "data": {
1575
+ "text/plain": [
1576
+ "CAMID 11991\n",
1577
+ "X 44809\n",
1578
+ "Image_name 36281\n",
1579
+ "zenodo_name 33\n",
1580
+ "zenodo_link 30\n",
1581
+ "file_url 39297\n",
1582
+ "Dataset 8\n",
1583
+ "dtype: int64"
1584
+ ]
1585
+ },
1586
+ "execution_count": 28,
1587
+ "metadata": {},
1588
+ "output_type": "execute_result"
1589
+ }
1590
+ ],
1591
+ "source": [
1592
+ "df[id_cols].nunique()"
1593
+ ]
1594
+ },
1595
+ {
1596
+ "cell_type": "code",
1597
+ "execution_count": 29,
1598
+ "metadata": {},
1599
+ "outputs": [
1600
+ {
1601
+ "data": {
1602
+ "text/plain": [
1603
+ "Dataset\n",
1604
+ "Heliconiine Butterfly Collection Records from University of Cambridge 25211\n",
1605
+ "Patricio Salazar 7519\n",
1606
+ "Nadeau Sheffield 3233\n",
1607
+ "Bogota Collection (Camilo Salazar) 982\n",
1608
+ "Cambridge Collection 47\n",
1609
+ "Mallet 22\n",
1610
+ "Merril_Gamboa 6\n",
1611
+ "STRI Collection (Owen) 4\n",
1612
+ "Name: count, dtype: int64"
1613
+ ]
1614
+ },
1615
+ "execution_count": 29,
1616
+ "metadata": {},
1617
+ "output_type": "execute_result"
1618
+ }
1619
+ ],
1620
+ "source": [
1621
+ "df.Dataset.value_counts()"
1622
+ ]
1623
+ },
1624
+ {
1625
+ "cell_type": "code",
1626
+ "execution_count": 30,
1627
+ "metadata": {},
1628
+ "outputs": [
1629
+ {
1630
+ "data": {
1631
+ "text/plain": [
1632
+ "CAMID 6538\n",
1633
+ "X 25211\n",
1634
+ "Image_name 17362\n",
1635
+ "View 7\n",
1636
+ "zenodo_name 17\n",
1637
+ "zenodo_link 17\n",
1638
+ "Sequence 6538\n",
1639
+ "Taxonomic_Name 287\n",
1640
+ "Locality 372\n",
1641
+ "Sample_accession 485\n",
1642
+ "Collected_by 0\n",
1643
+ "Other_ID 1123\n",
1644
+ "Date 282\n",
1645
+ "Dataset 1\n",
1646
+ "Store 102\n",
1647
+ "Brood 102\n",
1648
+ "Death_Date 0\n",
1649
+ "Cross_Type 0\n",
1650
+ "Stage 0\n",
1651
+ "Sex 3\n",
1652
+ "Unit_Type 2\n",
1653
+ "file_type 2\n",
1654
+ "record_number 17\n",
1655
+ "species 207\n",
1656
+ "subspecies 99\n",
1657
+ "genus 82\n",
1658
+ "file_url 19710\n",
1659
+ "hybrid_stat 2\n",
1660
+ "dtype: int64"
1661
+ ]
1662
+ },
1663
+ "execution_count": 30,
1664
+ "metadata": {},
1665
+ "output_type": "execute_result"
1666
+ }
1667
+ ],
1668
+ "source": [
1669
+ "HBCRUC = \"Heliconiine Butterfly Collection Records from University of Cambridge\"\n",
1670
+ "df.loc[df.Dataset == HBCRUC].nunique()"
1671
+ ]
1672
+ },
1673
+ {
1674
+ "cell_type": "code",
1675
+ "execution_count": 31,
1676
+ "metadata": {},
1677
+ "outputs": [],
1678
+ "source": [
1679
+ "df.to_csv(\"../metadata/Jiggins_Zenodo_Img_Master_3477891Patch.csv\", index = False)"
1680
+ ]
1681
+ }
1682
+ ],
1683
+ "metadata": {
1684
+ "kernelspec": {
1685
+ "display_name": "std",
1686
+ "language": "python",
1687
+ "name": "python3"
1688
+ },
1689
+ "language_info": {
1690
+ "codemirror_mode": {
1691
+ "name": "ipython",
1692
+ "version": 3
1693
+ },
1694
+ "file_extension": ".py",
1695
+ "mimetype": "text/x-python",
1696
+ "name": "python",
1697
+ "nbconvert_exporter": "python",
1698
+ "pygments_lexer": "ipython3",
1699
+ "version": "3.11.3"
1700
+ }
1701
+ },
1702
+ "nbformat": 4,
1703
+ "nbformat_minor": 2
1704
+ }
notebooks/Data-gen-1-2.ipynb ADDED
@@ -0,0 +1,2566 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {},
7
+ "outputs": [],
8
+ "source": [
9
+ "import pandas as pd"
10
+ ]
11
+ },
12
+ {
13
+ "cell_type": "markdown",
14
+ "metadata": {},
15
+ "source": [
16
+ "## Summary\n",
17
+ "\n",
18
+ "We explored our downloaded images in `EDA-DL-0-3.ipynb`, and established the following causes of duplication along with remedies:\n",
19
+ "1. The \"patch\" record (record 3477891) which required alignment in `Data-gen-1-1.ipynb`, resulting in `../metadata/Jiggins_Zenodo_Img_Master_3477891Patch.csv` used for download, is a duplication of all listed records. Additionally, it introduced extra copies of 4 images with incorrect labels for their views (i.e., dorsal vs ventral).\n",
20
+ " - Solution: This record will be removed.\n",
21
+ "2. The remaining duplication (430 images x2) comes from 5 records: [4291095](https://zenodo.org/records/4291095), [2813153](https://zenodo.org/records/2813153), [5526257](https://zenodo.org/records/5526257), [2553977](https://zenodo.org/records/2553977), and [2552371](https://zenodo.org/records/2552371).\n",
22
+ " - Though there is nothing in their descriptions on Zenodo to indicate this overlap occurred, record 4291095 duplicated 415 images from record 2813153. 104 of these images had their view/side labels (dorsal vs ventral) updated to reflect an earlier mislabeling in record 2813153; these were all RAW copies of the images. All other metadata was consistent across records.\n",
23
+ " - Solution: Copies of these images and their metadata will be retained from the newer record, record 4291095.\n",
24
+ " - Record 5526257 has 10 images that were added twice. All their metadata is consistent, so we will just keep the first instance of each image.\n",
25
+ " - Records 2553977 and 2552371 are both \"Miscellaneous Heliconius wing photographs (2001-2019)\" Parts 3 & 1, respectively. Record 2553977 has duplicated images with matching metadata, though 3 of the 4 images have different filenames (`Image_name`). It seems to have resulted from typos or not indicating `cut`, as they are all close-up crops of a single wing. From this perspective, the view labels (dorsal) don't seem appropriate when we have more fine-grained indicators such as \"forewing dorsal\".\n",
26
+ " - Suggestion that the entries in this record with `cut` in the filename not be used for general classification unless this variety is desired. These also appear to be all the `tif` images, which are often ignored.\n",
27
+ " - Record 2552371 has one image duplicated with two different `CAMID`s assigned (different views as well). These will both be removed as the image has no indicator of the specimen ID in it. Note that these also were labeled `Heliconius sp.`.\n",
28
+ "3. Looking at images that were not duplicates, there are clearly still multiple images of the same specimen from the same perspective (eg., two dorsal images) that are also of the same file type (eg., both jpgs). Duplication was checked at the pixel level, so there is no guarantee that they are truly different images, but due to the scope of this collection (over 20 years), it does not seem unlikely that multiple images could have been taken of the same specimen. \n",
29
+ " - Suggestion/Solution: When determining splits using this data, follow these steps:\n",
30
+ " 1. Ensure you are looking at only **_one_** view (eg., dorsal or ventral).\n",
31
+ " 2. Ensure you are only looking one file type (`raw`, `jpg`, or `tif`).\n",
32
+ " 3. Reduce to only unique `CAMID`s.\n",
33
+ " 4. Generate splits as desired.\n",
34
+ " 5. Add images to splits based on matched `CAMID`s if multiple views are desired (i.e., if a `CAMID` is present in the dorsal training, add the matching ventral image to the training set).\n",
35
+ " 6. Be sure to check only desired categories are included, such as excluding hybrids or cross types, or specimens not labeled to the level of classification.\n",
36
+ "\n",
37
+ "\n",
38
+ "## Generate \"Clean\" Master Metadata File\n",
39
+ "\n",
40
+ "We'll now generate a cleaned master metadata file from `../metadata/deduplication/Jiggins_Zenodo_Img_Master_3477891Patch_downloaded.csv` (generated in `EDA-DL-0-3.ipynb` from our download master file and checksums of successful downloads) following the solutions outlined above. "
41
+ ]
42
+ },
43
+ {
44
+ "cell_type": "code",
45
+ "execution_count": 2,
46
+ "metadata": {},
47
+ "outputs": [],
48
+ "source": [
49
+ "STATS_COLS = [\"X\",\n",
50
+ " \"CAMID\",\n",
51
+ " \"Image_name\",\n",
52
+ " \"md5\",\n",
53
+ " \"record_number\",\n",
54
+ " \"Taxonomic_Name\",\n",
55
+ " \"species\",\n",
56
+ " \"subspecies\",\n",
57
+ " \"genus\",\n",
58
+ " \"Cross_Type\",\n",
59
+ " \"View\",\n",
60
+ " \"Locality\",\n",
61
+ " \"Sex\",\n",
62
+ " \"Dataset\",\n",
63
+ " \"file_type\"]"
64
+ ]
65
+ },
66
+ {
67
+ "cell_type": "code",
68
+ "execution_count": 3,
69
+ "metadata": {},
70
+ "outputs": [
71
+ {
72
+ "name": "stdout",
73
+ "output_type": "stream",
74
+ "text": [
75
+ "<class 'pandas.core.frame.DataFrame'>\n",
76
+ "RangeIndex: 42143 entries, 0 to 42142\n",
77
+ "Data columns (total 15 columns):\n",
78
+ " # Column Non-Null Count Dtype \n",
79
+ "--- ------ -------------- ----- \n",
80
+ " 0 X 42143 non-null int64 \n",
81
+ " 1 CAMID 42143 non-null object\n",
82
+ " 2 Image_name 42143 non-null object\n",
83
+ " 3 md5 42143 non-null object\n",
84
+ " 4 record_number 42143 non-null int64 \n",
85
+ " 5 Taxonomic_Name 42143 non-null object\n",
86
+ " 6 species 42143 non-null object\n",
87
+ " 7 subspecies 24502 non-null object\n",
88
+ " 8 genus 42143 non-null object\n",
89
+ " 9 Cross_Type 4447 non-null object\n",
90
+ " 10 View 41364 non-null object\n",
91
+ " 11 Locality 29047 non-null object\n",
92
+ " 12 Sex 33254 non-null object\n",
93
+ " 13 Dataset 34924 non-null object\n",
94
+ " 14 file_type 42143 non-null object\n",
95
+ "dtypes: int64(2), object(13)\n",
96
+ "memory usage: 4.8+ MB\n"
97
+ ]
98
+ }
99
+ ],
100
+ "source": [
101
+ "df = pd.read_csv(\"../metadata/deduplication/Jiggins_Zenodo_Img_Master_3477891Patch_downloaded.csv\", low_memory = False)\n",
102
+ "df[STATS_COLS].info()"
103
+ ]
104
+ },
105
+ {
106
+ "cell_type": "code",
107
+ "execution_count": 4,
108
+ "metadata": {},
109
+ "outputs": [
110
+ {
111
+ "data": {
112
+ "text/plain": [
113
+ "X 42143\n",
114
+ "CAMID 11968\n",
115
+ "Image_name 36216\n",
116
+ "md5 36212\n",
117
+ "record_number 30\n",
118
+ "Taxonomic_Name 366\n",
119
+ "species 246\n",
120
+ "subspecies 155\n",
121
+ "genus 94\n",
122
+ "Cross_Type 30\n",
123
+ "View 7\n",
124
+ "Locality 644\n",
125
+ "Sex 3\n",
126
+ "Dataset 7\n",
127
+ "file_type 3\n",
128
+ "dtype: int64"
129
+ ]
130
+ },
131
+ "execution_count": 4,
132
+ "metadata": {},
133
+ "output_type": "execute_result"
134
+ }
135
+ ],
136
+ "source": [
137
+ "df[STATS_COLS].nunique()"
138
+ ]
139
+ },
140
+ {
141
+ "cell_type": "markdown",
142
+ "metadata": {},
143
+ "source": [
144
+ "Observations:\n",
145
+ "- Half of the Zenodo records wind up with duplicated images. \n",
146
+ "- `Image_name` uniqueness is close to `md5`, but there are 4 more unique image names than unique images. I believe this was from the duplication in reocrd 2553977. We can check when cleaning it. \n",
147
+ "- None of the cross types are duplicated.\n",
148
+ "- We do have multiple unique images for a single `CAMID`, more than just dorsal vs ventral since there are 11968 unique CAMIDs and 36212 unique `md5` values (36212 = **3**x11968 + 308)"
149
+ ]
150
+ },
151
+ {
152
+ "cell_type": "markdown",
153
+ "metadata": {},
154
+ "source": [
155
+ "### Remove Record 3477891\n",
156
+ "\n",
157
+ "This is just a duplication of images and we already have from earlier records, along with some extra duplication that gets mislabeled."
158
+ ]
159
+ },
160
+ {
161
+ "cell_type": "code",
162
+ "execution_count": 5,
163
+ "metadata": {},
164
+ "outputs": [
165
+ {
166
+ "data": {
167
+ "text/plain": [
168
+ "X 36642\n",
169
+ "CAMID 11968\n",
170
+ "Image_name 36216\n",
171
+ "md5 36212\n",
172
+ "record_number 29\n",
173
+ "Taxonomic_Name 366\n",
174
+ "species 246\n",
175
+ "subspecies 155\n",
176
+ "genus 94\n",
177
+ "Cross_Type 30\n",
178
+ "View 7\n",
179
+ "Locality 644\n",
180
+ "Sex 3\n",
181
+ "Dataset 7\n",
182
+ "file_type 3\n",
183
+ "dtype: int64"
184
+ ]
185
+ },
186
+ "execution_count": 5,
187
+ "metadata": {},
188
+ "output_type": "execute_result"
189
+ }
190
+ ],
191
+ "source": [
192
+ "df_reduced = df.loc[df[\"record_number\"] != 3477891].copy()\n",
193
+ "df_reduced[STATS_COLS].nunique()"
194
+ ]
195
+ },
196
+ {
197
+ "cell_type": "markdown",
198
+ "metadata": {},
199
+ "source": [
200
+ "The only change is in `X` (our total entry count) and in `record_number` (expected since we removed one)."
201
+ ]
202
+ },
203
+ {
204
+ "cell_type": "markdown",
205
+ "metadata": {},
206
+ "source": [
207
+ "## Address Remaining Duplicates\n",
208
+ "\n",
209
+ "The remaining duplicates are across 5 records and will require a bit more care to reslove (following the plan outlined at the top of the notebook and in the README).\n",
210
+ "\n",
211
+ "### Record 4291095 & 2813153 Duplicates\n",
212
+ "\n",
213
+ "There are 415 duplicates across these two records, with `View` corrections in record 4291095, so we will remove the duplicates from record 2813153."
214
+ ]
215
+ },
216
+ {
217
+ "cell_type": "code",
218
+ "execution_count": 6,
219
+ "metadata": {},
220
+ "outputs": [
221
+ {
222
+ "data": {
223
+ "text/plain": [
224
+ "Index(['CAMID', 'X', 'Image_name', 'View', 'zenodo_name', 'zenodo_link',\n",
225
+ " 'Sequence', 'Taxonomic_Name', 'Locality', 'Sample_accession',\n",
226
+ " 'Collected_by', 'Other_ID', 'Date', 'Dataset', 'Store', 'Brood',\n",
227
+ " 'Death_Date', 'Cross_Type', 'Stage', 'Sex', 'Unit_Type', 'file_type',\n",
228
+ " 'record_number', 'species', 'subspecies', 'genus', 'file_url',\n",
229
+ " 'hybrid_stat', 'filename', 'filepath', 'md5'],\n",
230
+ " dtype='object')"
231
+ ]
232
+ },
233
+ "execution_count": 6,
234
+ "metadata": {},
235
+ "output_type": "execute_result"
236
+ }
237
+ ],
238
+ "source": [
239
+ "df_reduced.columns"
240
+ ]
241
+ },
242
+ {
243
+ "cell_type": "markdown",
244
+ "metadata": {},
245
+ "source": [
246
+ "We start by marking all duplicate images since the decision of which to keep is dependent on comparisons between them."
247
+ ]
248
+ },
249
+ {
250
+ "cell_type": "code",
251
+ "execution_count": 7,
252
+ "metadata": {},
253
+ "outputs": [
254
+ {
255
+ "data": {
256
+ "text/plain": [
257
+ "md5_duplicated\n",
258
+ "False 35782\n",
259
+ "True 860\n",
260
+ "Name: count, dtype: int64"
261
+ ]
262
+ },
263
+ "execution_count": 7,
264
+ "metadata": {},
265
+ "output_type": "execute_result"
266
+ }
267
+ ],
268
+ "source": [
269
+ "df_reduced[\"md5_duplicated\"] = df_reduced.duplicated(\"md5\", keep = False)\n",
270
+ "df_reduced[\"md5_duplicated\"].value_counts()"
271
+ ]
272
+ },
273
+ {
274
+ "cell_type": "code",
275
+ "execution_count": 8,
276
+ "metadata": {},
277
+ "outputs": [
278
+ {
279
+ "data": {
280
+ "text/plain": [
281
+ "415"
282
+ ]
283
+ },
284
+ "execution_count": 8,
285
+ "metadata": {},
286
+ "output_type": "execute_result"
287
+ }
288
+ ],
289
+ "source": [
290
+ "duplicates = df_reduced[df_reduced[\"md5_duplicated\"]]\n",
291
+ "dupes_2813153 = duplicates.loc[duplicates[\"record_number\"] == 2813153]\n",
292
+ "#print(duplicates.loc[duplicates[\"record_number\"] == 4291095])\n",
293
+ "dupes_2813153.shape[0]"
294
+ ]
295
+ },
296
+ {
297
+ "cell_type": "markdown",
298
+ "metadata": {},
299
+ "source": [
300
+ "We will record the `X` value from these 415 entries to remove them from the overall dataset in favor of the updated entries from record 4291095."
301
+ ]
302
+ },
303
+ {
304
+ "cell_type": "code",
305
+ "execution_count": 9,
306
+ "metadata": {},
307
+ "outputs": [],
308
+ "source": [
309
+ "X_dupes_2813153 = list(dupes_2813153.X)"
310
+ ]
311
+ },
312
+ {
313
+ "cell_type": "code",
314
+ "execution_count": 10,
315
+ "metadata": {},
316
+ "outputs": [
317
+ {
318
+ "data": {
319
+ "text/plain": [
320
+ "X 36227\n",
321
+ "CAMID 11968\n",
322
+ "Image_name 36216\n",
323
+ "md5 36212\n",
324
+ "record_number 29\n",
325
+ "Taxonomic_Name 366\n",
326
+ "species 246\n",
327
+ "subspecies 155\n",
328
+ "genus 94\n",
329
+ "Cross_Type 30\n",
330
+ "View 7\n",
331
+ "Locality 644\n",
332
+ "Sex 3\n",
333
+ "Dataset 7\n",
334
+ "file_type 3\n",
335
+ "dtype: int64"
336
+ ]
337
+ },
338
+ "execution_count": 10,
339
+ "metadata": {},
340
+ "output_type": "execute_result"
341
+ }
342
+ ],
343
+ "source": [
344
+ "df_reduced_2 = df_reduced.loc[~df_reduced[\"X\"].isin(X_dupes_2813153)]\n",
345
+ "df_reduced_2[STATS_COLS].nunique()"
346
+ ]
347
+ },
348
+ {
349
+ "cell_type": "markdown",
350
+ "metadata": {},
351
+ "source": [
352
+ "As expected, our numbers are holding steady with a reduction in `X` values of 415."
353
+ ]
354
+ },
355
+ {
356
+ "cell_type": "markdown",
357
+ "metadata": {},
358
+ "source": [
359
+ "### Record 5526257 Duplicates\n",
360
+ "\n",
361
+ "For record 5526257, the 10 duplicated entries are all the same, so we will just check `.duplicated` and keep the first instance of each."
362
+ ]
363
+ },
364
+ {
365
+ "cell_type": "code",
366
+ "execution_count": 11,
367
+ "metadata": {},
368
+ "outputs": [
369
+ {
370
+ "name": "stdout",
371
+ "output_type": "stream",
372
+ "text": [
373
+ "dupe_entries\n",
374
+ "False 10\n",
375
+ "True 10\n",
376
+ "Name: count, dtype: int64\n"
377
+ ]
378
+ },
379
+ {
380
+ "data": {
381
+ "text/plain": [
382
+ "10"
383
+ ]
384
+ },
385
+ "execution_count": 11,
386
+ "metadata": {},
387
+ "output_type": "execute_result"
388
+ }
389
+ ],
390
+ "source": [
391
+ "dupes_5526257 = duplicates.loc[duplicates[\"record_number\"] == 5526257].copy()\n",
392
+ "dupes_5526257[\"dupe_entries\"] = dupes_5526257.duplicated([\"CAMID\", \"Image_name\", \"View\", \"Taxonomic_Name\", \"Locality\", \"md5\"], keep = \"first\")\n",
393
+ "print(dupes_5526257[\"dupe_entries\"].value_counts())\n",
394
+ "\n",
395
+ "X_dupes_5526257 = list(dupes_5526257.loc[dupes_5526257[\"dupe_entries\"], \"X\"])\n",
396
+ "len(X_dupes_5526257)"
397
+ ]
398
+ },
399
+ {
400
+ "cell_type": "code",
401
+ "execution_count": 12,
402
+ "metadata": {},
403
+ "outputs": [
404
+ {
405
+ "data": {
406
+ "text/plain": [
407
+ "X 36217\n",
408
+ "CAMID 11968\n",
409
+ "Image_name 36216\n",
410
+ "md5 36212\n",
411
+ "record_number 29\n",
412
+ "Taxonomic_Name 366\n",
413
+ "species 246\n",
414
+ "subspecies 155\n",
415
+ "genus 94\n",
416
+ "Cross_Type 30\n",
417
+ "View 7\n",
418
+ "Locality 644\n",
419
+ "Sex 3\n",
420
+ "Dataset 7\n",
421
+ "file_type 3\n",
422
+ "dtype: int64"
423
+ ]
424
+ },
425
+ "execution_count": 12,
426
+ "metadata": {},
427
+ "output_type": "execute_result"
428
+ }
429
+ ],
430
+ "source": [
431
+ "df_reduced_3 = df_reduced_2.loc[~df_reduced_2[\"X\"].isin(X_dupes_5526257)]\n",
432
+ "df_reduced_3[STATS_COLS].nunique()"
433
+ ]
434
+ },
435
+ {
436
+ "cell_type": "markdown",
437
+ "metadata": {},
438
+ "source": [
439
+ "Reduction in `X` by 10, consistency in all other numbers.\n",
440
+ "\n",
441
+ "### Record 2552371 Duplicates\n",
442
+ "\n",
443
+ "We are removing both duplicates from this record as their metadata is contradictory and cannot be verified. (Two different CAMIDs, different filenames, different views, etc.)"
444
+ ]
445
+ },
446
+ {
447
+ "cell_type": "code",
448
+ "execution_count": 13,
449
+ "metadata": {},
450
+ "outputs": [
451
+ {
452
+ "data": {
453
+ "text/html": [
454
+ "<div>\n",
455
+ "<style scoped>\n",
456
+ " .dataframe tbody tr th:only-of-type {\n",
457
+ " vertical-align: middle;\n",
458
+ " }\n",
459
+ "\n",
460
+ " .dataframe tbody tr th {\n",
461
+ " vertical-align: top;\n",
462
+ " }\n",
463
+ "\n",
464
+ " .dataframe thead th {\n",
465
+ " text-align: right;\n",
466
+ " }\n",
467
+ "</style>\n",
468
+ "<table border=\"1\" class=\"dataframe\">\n",
469
+ " <thead>\n",
470
+ " <tr style=\"text-align: right;\">\n",
471
+ " <th></th>\n",
472
+ " <th>CAMID</th>\n",
473
+ " <th>X</th>\n",
474
+ " <th>Image_name</th>\n",
475
+ " <th>View</th>\n",
476
+ " <th>zenodo_name</th>\n",
477
+ " <th>zenodo_link</th>\n",
478
+ " <th>Sequence</th>\n",
479
+ " <th>Taxonomic_Name</th>\n",
480
+ " <th>Locality</th>\n",
481
+ " <th>Sample_accession</th>\n",
482
+ " <th>...</th>\n",
483
+ " <th>record_number</th>\n",
484
+ " <th>species</th>\n",
485
+ " <th>subspecies</th>\n",
486
+ " <th>genus</th>\n",
487
+ " <th>file_url</th>\n",
488
+ " <th>hybrid_stat</th>\n",
489
+ " <th>filename</th>\n",
490
+ " <th>filepath</th>\n",
491
+ " <th>md5</th>\n",
492
+ " <th>md5_duplicated</th>\n",
493
+ " </tr>\n",
494
+ " </thead>\n",
495
+ " <tbody>\n",
496
+ " <tr>\n",
497
+ " <th>11978</th>\n",
498
+ " <td>CAM010354</td>\n",
499
+ " <td>23471</td>\n",
500
+ " <td>10354d.jpg</td>\n",
501
+ " <td>dorsal</td>\n",
502
+ " <td>Heliconius_wing_old_photos_2001_2019_part1.csv</td>\n",
503
+ " <td>https://zenodo.org/record/2552371</td>\n",
504
+ " <td>10,354</td>\n",
505
+ " <td>Heliconius sp.</td>\n",
506
+ " <td>NaN</td>\n",
507
+ " <td>NaN</td>\n",
508
+ " <td>...</td>\n",
509
+ " <td>2552371</td>\n",
510
+ " <td>Heliconius sp.</td>\n",
511
+ " <td>NaN</td>\n",
512
+ " <td>Heliconius</td>\n",
513
+ " <td>https://zenodo.org/record/2552371/files/10354d...</td>\n",
514
+ " <td>NaN</td>\n",
515
+ " <td>23471_10354d.jpg</td>\n",
516
+ " <td>images/Heliconius sp./23471_10354d.jpg</td>\n",
517
+ " <td>84d4ac6527458786cdb33166cd80e0a8</td>\n",
518
+ " <td>True</td>\n",
519
+ " </tr>\n",
520
+ " <tr>\n",
521
+ " <th>12010</th>\n",
522
+ " <td>CAM010362</td>\n",
523
+ " <td>23484</td>\n",
524
+ " <td>10362v.jpg</td>\n",
525
+ " <td>ventral</td>\n",
526
+ " <td>Heliconius_wing_old_photos_2001_2019_part1.csv</td>\n",
527
+ " <td>https://zenodo.org/record/2552371</td>\n",
528
+ " <td>10,362</td>\n",
529
+ " <td>Heliconius sp.</td>\n",
530
+ " <td>NaN</td>\n",
531
+ " <td>NaN</td>\n",
532
+ " <td>...</td>\n",
533
+ " <td>2552371</td>\n",
534
+ " <td>Heliconius sp.</td>\n",
535
+ " <td>NaN</td>\n",
536
+ " <td>Heliconius</td>\n",
537
+ " <td>https://zenodo.org/record/2552371/files/10362v...</td>\n",
538
+ " <td>NaN</td>\n",
539
+ " <td>23484_10362v.jpg</td>\n",
540
+ " <td>images/Heliconius sp./23484_10362v.jpg</td>\n",
541
+ " <td>84d4ac6527458786cdb33166cd80e0a8</td>\n",
542
+ " <td>True</td>\n",
543
+ " </tr>\n",
544
+ " </tbody>\n",
545
+ "</table>\n",
546
+ "<p>2 rows × 32 columns</p>\n",
547
+ "</div>"
548
+ ],
549
+ "text/plain": [
550
+ " CAMID X Image_name View \\\n",
551
+ "11978 CAM010354 23471 10354d.jpg dorsal \n",
552
+ "12010 CAM010362 23484 10362v.jpg ventral \n",
553
+ "\n",
554
+ " zenodo_name \\\n",
555
+ "11978 Heliconius_wing_old_photos_2001_2019_part1.csv \n",
556
+ "12010 Heliconius_wing_old_photos_2001_2019_part1.csv \n",
557
+ "\n",
558
+ " zenodo_link Sequence Taxonomic_Name Locality \\\n",
559
+ "11978 https://zenodo.org/record/2552371 10,354 Heliconius sp. NaN \n",
560
+ "12010 https://zenodo.org/record/2552371 10,362 Heliconius sp. NaN \n",
561
+ "\n",
562
+ " Sample_accession ... record_number species subspecies \\\n",
563
+ "11978 NaN ... 2552371 Heliconius sp. NaN \n",
564
+ "12010 NaN ... 2552371 Heliconius sp. NaN \n",
565
+ "\n",
566
+ " genus file_url \\\n",
567
+ "11978 Heliconius https://zenodo.org/record/2552371/files/10354d... \n",
568
+ "12010 Heliconius https://zenodo.org/record/2552371/files/10362v... \n",
569
+ "\n",
570
+ " hybrid_stat filename filepath \\\n",
571
+ "11978 NaN 23471_10354d.jpg images/Heliconius sp./23471_10354d.jpg \n",
572
+ "12010 NaN 23484_10362v.jpg images/Heliconius sp./23484_10362v.jpg \n",
573
+ "\n",
574
+ " md5 md5_duplicated \n",
575
+ "11978 84d4ac6527458786cdb33166cd80e0a8 True \n",
576
+ "12010 84d4ac6527458786cdb33166cd80e0a8 True \n",
577
+ "\n",
578
+ "[2 rows x 32 columns]"
579
+ ]
580
+ },
581
+ "execution_count": 13,
582
+ "metadata": {},
583
+ "output_type": "execute_result"
584
+ }
585
+ ],
586
+ "source": [
587
+ "dupes_2552371 = duplicates.loc[duplicates[\"record_number\"] == 2552371]\n",
588
+ "X_dupes_2552371 = list(dupes_2552371[\"X\"])\n",
589
+ "dupes_2552371"
590
+ ]
591
+ },
592
+ {
593
+ "cell_type": "code",
594
+ "execution_count": 14,
595
+ "metadata": {},
596
+ "outputs": [
597
+ {
598
+ "data": {
599
+ "text/plain": [
600
+ "X 36215\n",
601
+ "CAMID 11968\n",
602
+ "Image_name 36214\n",
603
+ "md5 36211\n",
604
+ "record_number 29\n",
605
+ "Taxonomic_Name 366\n",
606
+ "species 246\n",
607
+ "subspecies 155\n",
608
+ "genus 94\n",
609
+ "Cross_Type 30\n",
610
+ "View 7\n",
611
+ "Locality 644\n",
612
+ "Sex 3\n",
613
+ "Dataset 7\n",
614
+ "file_type 3\n",
615
+ "dtype: int64"
616
+ ]
617
+ },
618
+ "execution_count": 14,
619
+ "metadata": {},
620
+ "output_type": "execute_result"
621
+ }
622
+ ],
623
+ "source": [
624
+ "df_reduced_4 = df_reduced_3.loc[~df_reduced_3[\"X\"].isin(X_dupes_2552371)]\n",
625
+ "df_reduced_4[STATS_COLS].nunique()"
626
+ ]
627
+ },
628
+ {
629
+ "cell_type": "markdown",
630
+ "metadata": {},
631
+ "source": [
632
+ "Removing these two has reduced our `X` count by 2, as well as our number of unique `Image_name`s, and it reduced our unique image count (`md5`) by 1. Observe that our unique `CAMID` count has remained constant, so both specimens indicated by these duplicate images are still represented in the dataset."
633
+ ]
634
+ },
635
+ {
636
+ "cell_type": "markdown",
637
+ "metadata": {},
638
+ "source": [
639
+ "### Record 2553977 Duplicates\n",
640
+ "\n",
641
+ "The duplicated entries for record 2553977 are the most complicated in that their metadata is nearly exact, though a few have different filenames (`Image_name`) and we would like to preserve the version that has `_cut` in the name."
642
+ ]
643
+ },
644
+ {
645
+ "cell_type": "code",
646
+ "execution_count": 15,
647
+ "metadata": {},
648
+ "outputs": [
649
+ {
650
+ "data": {
651
+ "text/html": [
652
+ "<div>\n",
653
+ "<style scoped>\n",
654
+ " .dataframe tbody tr th:only-of-type {\n",
655
+ " vertical-align: middle;\n",
656
+ " }\n",
657
+ "\n",
658
+ " .dataframe tbody tr th {\n",
659
+ " vertical-align: top;\n",
660
+ " }\n",
661
+ "\n",
662
+ " .dataframe thead th {\n",
663
+ " text-align: right;\n",
664
+ " }\n",
665
+ "</style>\n",
666
+ "<table border=\"1\" class=\"dataframe\">\n",
667
+ " <thead>\n",
668
+ " <tr style=\"text-align: right;\">\n",
669
+ " <th></th>\n",
670
+ " <th>X</th>\n",
671
+ " <th>CAMID</th>\n",
672
+ " <th>Image_name</th>\n",
673
+ " <th>md5</th>\n",
674
+ " <th>record_number</th>\n",
675
+ " <th>Taxonomic_Name</th>\n",
676
+ " <th>species</th>\n",
677
+ " <th>subspecies</th>\n",
678
+ " <th>genus</th>\n",
679
+ " <th>Cross_Type</th>\n",
680
+ " <th>View</th>\n",
681
+ " <th>Locality</th>\n",
682
+ " <th>Sex</th>\n",
683
+ " <th>Dataset</th>\n",
684
+ " <th>file_type</th>\n",
685
+ " </tr>\n",
686
+ " </thead>\n",
687
+ " <tbody>\n",
688
+ " <tr>\n",
689
+ " <th>40141</th>\n",
690
+ " <td>26197</td>\n",
691
+ " <td>CAM050147</td>\n",
692
+ " <td>CAM050147_DS1_HW_IMG_8537_cut_3.tif</td>\n",
693
+ " <td>21e726df7076f5c13fe1441126bac4d5</td>\n",
694
+ " <td>2553977</td>\n",
695
+ " <td>Heliconius sara ssp. sara</td>\n",
696
+ " <td>Heliconius sara</td>\n",
697
+ " <td>sara</td>\n",
698
+ " <td>Heliconius</td>\n",
699
+ " <td>NaN</td>\n",
700
+ " <td>dorsal</td>\n",
701
+ " <td>Madingley</td>\n",
702
+ " <td>NaN</td>\n",
703
+ " <td>NaN</td>\n",
704
+ " <td>tif</td>\n",
705
+ " </tr>\n",
706
+ " <tr>\n",
707
+ " <th>40144</th>\n",
708
+ " <td>26196</td>\n",
709
+ " <td>CAM050147</td>\n",
710
+ " <td>CAM050147_DS1_HW_IMG_8537_cut_3.tif</td>\n",
711
+ " <td>21e726df7076f5c13fe1441126bac4d5</td>\n",
712
+ " <td>2553977</td>\n",
713
+ " <td>Heliconius sara ssp. sara</td>\n",
714
+ " <td>Heliconius sara</td>\n",
715
+ " <td>sara</td>\n",
716
+ " <td>Heliconius</td>\n",
717
+ " <td>NaN</td>\n",
718
+ " <td>dorsal</td>\n",
719
+ " <td>Madingley</td>\n",
720
+ " <td>NaN</td>\n",
721
+ " <td>NaN</td>\n",
722
+ " <td>tif</td>\n",
723
+ " </tr>\n",
724
+ " <tr>\n",
725
+ " <th>40112</th>\n",
726
+ " <td>26102</td>\n",
727
+ " <td>CAM050036</td>\n",
728
+ " <td>CAM050036_S1_9_FW_IMG_8547_wb_2.tif</td>\n",
729
+ " <td>34adbd5596f977834fb2c6876d2f4493</td>\n",
730
+ " <td>2553977</td>\n",
731
+ " <td>Heliconius sara ssp. sara</td>\n",
732
+ " <td>Heliconius sara</td>\n",
733
+ " <td>sara</td>\n",
734
+ " <td>Heliconius</td>\n",
735
+ " <td>NaN</td>\n",
736
+ " <td>dorsal</td>\n",
737
+ " <td>Gamboa_insectaries</td>\n",
738
+ " <td>NaN</td>\n",
739
+ " <td>NaN</td>\n",
740
+ " <td>tif</td>\n",
741
+ " </tr>\n",
742
+ " <tr>\n",
743
+ " <th>40116</th>\n",
744
+ " <td>26115</td>\n",
745
+ " <td>CAM050036</td>\n",
746
+ " <td>CAM050036_S1_9_FW_IMG_8547_cut_2.tif</td>\n",
747
+ " <td>34adbd5596f977834fb2c6876d2f4493</td>\n",
748
+ " <td>2553977</td>\n",
749
+ " <td>Heliconius sara ssp. sara</td>\n",
750
+ " <td>Heliconius sara</td>\n",
751
+ " <td>sara</td>\n",
752
+ " <td>Heliconius</td>\n",
753
+ " <td>NaN</td>\n",
754
+ " <td>dorsal</td>\n",
755
+ " <td>Gamboa_insectaries</td>\n",
756
+ " <td>NaN</td>\n",
757
+ " <td>NaN</td>\n",
758
+ " <td>tif</td>\n",
759
+ " </tr>\n",
760
+ " <tr>\n",
761
+ " <th>40138</th>\n",
762
+ " <td>26112</td>\n",
763
+ " <td>CAM050147</td>\n",
764
+ " <td>CAM050147_DS1_IMG_8513_4.tif</td>\n",
765
+ " <td>464801449aa127933d9619cb4e6f0a01</td>\n",
766
+ " <td>2553977</td>\n",
767
+ " <td>Heliconius sara ssp. sara</td>\n",
768
+ " <td>Heliconius sara</td>\n",
769
+ " <td>sara</td>\n",
770
+ " <td>Heliconius</td>\n",
771
+ " <td>NaN</td>\n",
772
+ " <td>dorsal</td>\n",
773
+ " <td>Madingley</td>\n",
774
+ " <td>NaN</td>\n",
775
+ " <td>NaN</td>\n",
776
+ " <td>tif</td>\n",
777
+ " </tr>\n",
778
+ " <tr>\n",
779
+ " <th>40145</th>\n",
780
+ " <td>26117</td>\n",
781
+ " <td>CAM050147</td>\n",
782
+ " <td>CAM050147_DS1_FW_IMG_8513_cut_4.tif</td>\n",
783
+ " <td>464801449aa127933d9619cb4e6f0a01</td>\n",
784
+ " <td>2553977</td>\n",
785
+ " <td>Heliconius sara ssp. sara</td>\n",
786
+ " <td>Heliconius sara</td>\n",
787
+ " <td>sara</td>\n",
788
+ " <td>Heliconius</td>\n",
789
+ " <td>NaN</td>\n",
790
+ " <td>dorsal</td>\n",
791
+ " <td>Madingley</td>\n",
792
+ " <td>NaN</td>\n",
793
+ " <td>NaN</td>\n",
794
+ " <td>tif</td>\n",
795
+ " </tr>\n",
796
+ " <tr>\n",
797
+ " <th>40113</th>\n",
798
+ " <td>26105</td>\n",
799
+ " <td>CAM050036</td>\n",
800
+ " <td>CAM050036_S1_9_HW_wt_IMG_8541_cut3.tif</td>\n",
801
+ " <td>6d63d659fbc02369010938bbc229ad4d</td>\n",
802
+ " <td>2553977</td>\n",
803
+ " <td>Heliconius sara ssp. sara</td>\n",
804
+ " <td>Heliconius sara</td>\n",
805
+ " <td>sara</td>\n",
806
+ " <td>Heliconius</td>\n",
807
+ " <td>NaN</td>\n",
808
+ " <td>dorsal</td>\n",
809
+ " <td>Gamboa_insectaries</td>\n",
810
+ " <td>NaN</td>\n",
811
+ " <td>NaN</td>\n",
812
+ " <td>tif</td>\n",
813
+ " </tr>\n",
814
+ " <tr>\n",
815
+ " <th>40120</th>\n",
816
+ " <td>26116</td>\n",
817
+ " <td>CAM050036</td>\n",
818
+ " <td>CAM050036_S1_9_HW_wt_IMG_8541_cut_3.tif</td>\n",
819
+ " <td>6d63d659fbc02369010938bbc229ad4d</td>\n",
820
+ " <td>2553977</td>\n",
821
+ " <td>Heliconius sara ssp. sara</td>\n",
822
+ " <td>Heliconius sara</td>\n",
823
+ " <td>sara</td>\n",
824
+ " <td>Heliconius</td>\n",
825
+ " <td>NaN</td>\n",
826
+ " <td>dorsal</td>\n",
827
+ " <td>Gamboa_insectaries</td>\n",
828
+ " <td>NaN</td>\n",
829
+ " <td>NaN</td>\n",
830
+ " <td>tif</td>\n",
831
+ " </tr>\n",
832
+ " </tbody>\n",
833
+ "</table>\n",
834
+ "</div>"
835
+ ],
836
+ "text/plain": [
837
+ " X CAMID Image_name \\\n",
838
+ "40141 26197 CAM050147 CAM050147_DS1_HW_IMG_8537_cut_3.tif \n",
839
+ "40144 26196 CAM050147 CAM050147_DS1_HW_IMG_8537_cut_3.tif \n",
840
+ "40112 26102 CAM050036 CAM050036_S1_9_FW_IMG_8547_wb_2.tif \n",
841
+ "40116 26115 CAM050036 CAM050036_S1_9_FW_IMG_8547_cut_2.tif \n",
842
+ "40138 26112 CAM050147 CAM050147_DS1_IMG_8513_4.tif \n",
843
+ "40145 26117 CAM050147 CAM050147_DS1_FW_IMG_8513_cut_4.tif \n",
844
+ "40113 26105 CAM050036 CAM050036_S1_9_HW_wt_IMG_8541_cut3.tif \n",
845
+ "40120 26116 CAM050036 CAM050036_S1_9_HW_wt_IMG_8541_cut_3.tif \n",
846
+ "\n",
847
+ " md5 record_number \\\n",
848
+ "40141 21e726df7076f5c13fe1441126bac4d5 2553977 \n",
849
+ "40144 21e726df7076f5c13fe1441126bac4d5 2553977 \n",
850
+ "40112 34adbd5596f977834fb2c6876d2f4493 2553977 \n",
851
+ "40116 34adbd5596f977834fb2c6876d2f4493 2553977 \n",
852
+ "40138 464801449aa127933d9619cb4e6f0a01 2553977 \n",
853
+ "40145 464801449aa127933d9619cb4e6f0a01 2553977 \n",
854
+ "40113 6d63d659fbc02369010938bbc229ad4d 2553977 \n",
855
+ "40120 6d63d659fbc02369010938bbc229ad4d 2553977 \n",
856
+ "\n",
857
+ " Taxonomic_Name species subspecies genus \\\n",
858
+ "40141 Heliconius sara ssp. sara Heliconius sara sara Heliconius \n",
859
+ "40144 Heliconius sara ssp. sara Heliconius sara sara Heliconius \n",
860
+ "40112 Heliconius sara ssp. sara Heliconius sara sara Heliconius \n",
861
+ "40116 Heliconius sara ssp. sara Heliconius sara sara Heliconius \n",
862
+ "40138 Heliconius sara ssp. sara Heliconius sara sara Heliconius \n",
863
+ "40145 Heliconius sara ssp. sara Heliconius sara sara Heliconius \n",
864
+ "40113 Heliconius sara ssp. sara Heliconius sara sara Heliconius \n",
865
+ "40120 Heliconius sara ssp. sara Heliconius sara sara Heliconius \n",
866
+ "\n",
867
+ " Cross_Type View Locality Sex Dataset file_type \n",
868
+ "40141 NaN dorsal Madingley NaN NaN tif \n",
869
+ "40144 NaN dorsal Madingley NaN NaN tif \n",
870
+ "40112 NaN dorsal Gamboa_insectaries NaN NaN tif \n",
871
+ "40116 NaN dorsal Gamboa_insectaries NaN NaN tif \n",
872
+ "40138 NaN dorsal Madingley NaN NaN tif \n",
873
+ "40145 NaN dorsal Madingley NaN NaN tif \n",
874
+ "40113 NaN dorsal Gamboa_insectaries NaN NaN tif \n",
875
+ "40120 NaN dorsal Gamboa_insectaries NaN NaN tif "
876
+ ]
877
+ },
878
+ "execution_count": 15,
879
+ "metadata": {},
880
+ "output_type": "execute_result"
881
+ }
882
+ ],
883
+ "source": [
884
+ "dupes_2553977 = duplicates.loc[duplicates[\"record_number\"] == 2553977]\n",
885
+ "dupes_2553977[STATS_COLS].sort_values(\"md5\")"
886
+ ]
887
+ },
888
+ {
889
+ "cell_type": "markdown",
890
+ "metadata": {},
891
+ "source": [
892
+ "For each of these, we want the one with `_cut_` in the `Image_name`."
893
+ ]
894
+ },
895
+ {
896
+ "cell_type": "code",
897
+ "execution_count": 16,
898
+ "metadata": {},
899
+ "outputs": [
900
+ {
901
+ "data": {
902
+ "text/plain": [
903
+ "[26102, 26105, 26112]"
904
+ ]
905
+ },
906
+ "execution_count": 16,
907
+ "metadata": {},
908
+ "output_type": "execute_result"
909
+ }
910
+ ],
911
+ "source": [
912
+ "X_dupes_2553977 = [x for x in list(dupes_2553977[\"X\"]) if \"_cut_\" not in dupes_2553977.loc[dupes_2553977[\"X\"] == x, \"Image_name\"].values[0]]\n",
913
+ "\n",
914
+ "# Check we got the ones expected\n",
915
+ "X_dupes_2553977"
916
+ ]
917
+ },
918
+ {
919
+ "cell_type": "code",
920
+ "execution_count": 17,
921
+ "metadata": {},
922
+ "outputs": [],
923
+ "source": [
924
+ "# Add 26196, since both those entries (26196 and 26197) are the same\n",
925
+ "X_dupes_2553977.append(26196)\n"
926
+ ]
927
+ },
928
+ {
929
+ "cell_type": "code",
930
+ "execution_count": 18,
931
+ "metadata": {},
932
+ "outputs": [
933
+ {
934
+ "data": {
935
+ "text/plain": [
936
+ "X 36211\n",
937
+ "CAMID 11968\n",
938
+ "Image_name 36211\n",
939
+ "md5 36211\n",
940
+ "record_number 29\n",
941
+ "Taxonomic_Name 366\n",
942
+ "species 246\n",
943
+ "subspecies 155\n",
944
+ "genus 94\n",
945
+ "Cross_Type 30\n",
946
+ "View 7\n",
947
+ "Locality 644\n",
948
+ "Sex 3\n",
949
+ "Dataset 7\n",
950
+ "file_type 3\n",
951
+ "dtype: int64"
952
+ ]
953
+ },
954
+ "execution_count": 18,
955
+ "metadata": {},
956
+ "output_type": "execute_result"
957
+ }
958
+ ],
959
+ "source": [
960
+ "df_reduced_5 = df_reduced_4.loc[~df_reduced_4[\"X\"].isin(X_dupes_2553977)]\n",
961
+ "df_reduced_5[STATS_COLS].nunique()"
962
+ ]
963
+ },
964
+ {
965
+ "cell_type": "markdown",
966
+ "metadata": {},
967
+ "source": [
968
+ "4 entries were removed, reducing our number of unique `Image_name`s by 3 (one of the duplicated images had all its metadata duplicated), and everything else has remained consistent. Now the number of unique image names and entries matches the number of unique images. We have a total of 36,211 images, and we will save this reduced CSV as our new master file."
969
+ ]
970
+ },
971
+ {
972
+ "cell_type": "markdown",
973
+ "metadata": {},
974
+ "source": [
975
+ "## Save Reduced Master File of Unique Images\n",
976
+ "\n",
977
+ "Don't include last column indicating duplicate MD5s."
978
+ ]
979
+ },
980
+ {
981
+ "cell_type": "code",
982
+ "execution_count": 19,
983
+ "metadata": {},
984
+ "outputs": [],
985
+ "source": [
986
+ "df_reduced_5[list(df_reduced_5.columns)[:-1]].to_csv(\"../Jiggins_Zenodo_Img_Master.csv\", index = False)"
987
+ ]
988
+ },
989
+ {
990
+ "cell_type": "markdown",
991
+ "metadata": {},
992
+ "source": [
993
+ "# Generate New Master Heliconius and Dorsal Subsets\n",
994
+ "\n",
995
+ "## Read in New Master File\n",
996
+ "\n",
997
+ "First check on our stats noted in the README."
998
+ ]
999
+ },
1000
+ {
1001
+ "cell_type": "code",
1002
+ "execution_count": 2,
1003
+ "metadata": {},
1004
+ "outputs": [
1005
+ {
1006
+ "name": "stdout",
1007
+ "output_type": "stream",
1008
+ "text": [
1009
+ "<class 'pandas.core.frame.DataFrame'>\n",
1010
+ "RangeIndex: 36211 entries, 0 to 36210\n",
1011
+ "Data columns (total 31 columns):\n",
1012
+ " # Column Non-Null Count Dtype \n",
1013
+ "--- ------ -------------- ----- \n",
1014
+ " 0 CAMID 36211 non-null object\n",
1015
+ " 1 X 36211 non-null int64 \n",
1016
+ " 2 Image_name 36211 non-null object\n",
1017
+ " 3 View 35432 non-null object\n",
1018
+ " 4 zenodo_name 36211 non-null object\n",
1019
+ " 5 zenodo_link 36211 non-null object\n",
1020
+ " 6 Sequence 35279 non-null object\n",
1021
+ " 7 Taxonomic_Name 36211 non-null object\n",
1022
+ " 8 Locality 23127 non-null object\n",
1023
+ " 9 Sample_accession 3647 non-null object\n",
1024
+ " 10 Collected_by 3043 non-null object\n",
1025
+ " 11 Other_ID 11329 non-null object\n",
1026
+ " 12 Date 23040 non-null object\n",
1027
+ " 13 Dataset 29114 non-null object\n",
1028
+ " 14 Store 27813 non-null object\n",
1029
+ " 15 Brood 13847 non-null object\n",
1030
+ " 16 Death_Date 269 non-null object\n",
1031
+ " 17 Cross_Type 4447 non-null object\n",
1032
+ " 18 Stage 6 non-null object\n",
1033
+ " 19 Sex 27514 non-null object\n",
1034
+ " 20 Unit_Type 25060 non-null object\n",
1035
+ " 21 file_type 36211 non-null object\n",
1036
+ " 22 record_number 36211 non-null int64 \n",
1037
+ " 23 species 36211 non-null object\n",
1038
+ " 24 subspecies 20400 non-null object\n",
1039
+ " 25 genus 36211 non-null object\n",
1040
+ " 26 file_url 36211 non-null object\n",
1041
+ " 27 hybrid_stat 20948 non-null object\n",
1042
+ " 28 filename 36211 non-null object\n",
1043
+ " 29 filepath 36211 non-null object\n",
1044
+ " 30 md5 36211 non-null object\n",
1045
+ "dtypes: int64(2), object(29)\n",
1046
+ "memory usage: 8.6+ MB\n"
1047
+ ]
1048
+ }
1049
+ ],
1050
+ "source": [
1051
+ "master = pd.read_csv(\"../Jiggins_Zenodo_Img_Master.csv\", low_memory = False)\n",
1052
+ "master.info()"
1053
+ ]
1054
+ },
1055
+ {
1056
+ "cell_type": "markdown",
1057
+ "metadata": {},
1058
+ "source": [
1059
+ "### Taxonomic Labeling Check\n",
1060
+ "\n",
1061
+ "As noted above, there are instances of `<Genus> sp.` in the `Taxonomic_Name` column. These get reproduced in the `species` column as well. We also have at least one instance of just `Heliconius`, and an instance of `Unknown` was observed outside this process. To ensure the taxonomic information is indeed clear, we will print and check all 246 unique species listed in the dataset."
1062
+ ]
1063
+ },
1064
+ {
1065
+ "cell_type": "code",
1066
+ "execution_count": 3,
1067
+ "metadata": {},
1068
+ "outputs": [],
1069
+ "source": [
1070
+ "pd.Series(master.species.unique()).to_csv(\"../metadata/Unique_species_labels.txt\", index = False)"
1071
+ ]
1072
+ },
1073
+ {
1074
+ "cell_type": "code",
1075
+ "execution_count": 4,
1076
+ "metadata": {},
1077
+ "outputs": [
1078
+ {
1079
+ "name": "stdout",
1080
+ "output_type": "stream",
1081
+ "text": [
1082
+ "We have 24 'species' designations really labeled only to genus, 5 species designations that may not be labeled at the species level, and 1 with 'hybrid' in the name.\n"
1083
+ ]
1084
+ }
1085
+ ],
1086
+ "source": [
1087
+ "species_list = list(master.species.unique())\n",
1088
+ "\n",
1089
+ "sp_list = []\n",
1090
+ "one_word_list = []\n",
1091
+ "hybrid_label = []\n",
1092
+ "for species in species_list:\n",
1093
+ " if \"sp.\" in species:\n",
1094
+ " sp_list.append(species)\n",
1095
+ " if len(species.split(\" \")) == 1:\n",
1096
+ " one_word_list.append(species)\n",
1097
+ " if \"hybrid\" in species.lower():\n",
1098
+ " hybrid_label.append(species)\n",
1099
+ "\n",
1100
+ "print(f\"We have {len(sp_list)} 'species' designations really labeled only to genus, {len(one_word_list)} species designations that may not be labeled at the species level, and {len(hybrid_label)} with 'hybrid' in the name.\")"
1101
+ ]
1102
+ },
1103
+ {
1104
+ "cell_type": "code",
1105
+ "execution_count": 5,
1106
+ "metadata": {},
1107
+ "outputs": [
1108
+ {
1109
+ "data": {
1110
+ "text/plain": [
1111
+ "['Pteronymia', 'Unknown', 'Ithomiinae', 'Stratiomyidae', 'Heliconius']"
1112
+ ]
1113
+ },
1114
+ "execution_count": 5,
1115
+ "metadata": {},
1116
+ "output_type": "execute_result"
1117
+ }
1118
+ ],
1119
+ "source": [
1120
+ "one_word_list"
1121
+ ]
1122
+ },
1123
+ {
1124
+ "cell_type": "code",
1125
+ "execution_count": 6,
1126
+ "metadata": {},
1127
+ "outputs": [
1128
+ {
1129
+ "data": {
1130
+ "text/plain": [
1131
+ "['Heliconius hybrid']"
1132
+ ]
1133
+ },
1134
+ "execution_count": 6,
1135
+ "metadata": {},
1136
+ "output_type": "execute_result"
1137
+ }
1138
+ ],
1139
+ "source": [
1140
+ "hybrid_label"
1141
+ ]
1142
+ },
1143
+ {
1144
+ "cell_type": "markdown",
1145
+ "metadata": {},
1146
+ "source": [
1147
+ "This matches my manual check:\n",
1148
+ "\n",
1149
+ "Non-standard labels found:\n",
1150
+ "\n",
1151
+ "- 'Heliconius hybrid'\n",
1152
+ "- \"sp.\":\n",
1153
+ " >'Heliconius sp.', 'Melinaea sp.', 'Oleria sp.', 'Ithomia sp.', 'Godyris sp.', 'Hypothyris sp.', 'Pteronymia sp.', 'Greta sp.', 'Dircenna sp.', 'Actinote sp.', 'Eresia sp.', 'Eueides sp.', 'Pteronymia sp.nov.', 'Patricia sp.', 'Hyalyris sp.', 'Olyras sp.', 'Mechanitis sp.', 'Euides sp.', 'Taygetis sp.', 'Euselasia sp.', 'Eunica sp.', 'Ascia sp.', 'Euptychia sp.', 'Megaleas sp.'\n",
1154
+ "- One name: 'Heliconius', 'Stratiomyidae', 'Ithomiinae', 'Pteronymia', + 'Unknown'. \n",
1155
+ " - This is becuase `species` was just a split at `ssp.` and take the first element of that list, hence the duplication of single names.\n",
1156
+ "\n",
1157
+ "### Taxonomic Labeling Fix:\n",
1158
+ "- We'll adjust the genera to be `<Genus> sp.` to be consistent. Then to avoid any labeled only to the genus level, one must simply exclude those with `sp.` in the species name. \n",
1159
+ "- The `Heliconius hybrid` should be labeled as a hybrid, but have null `subspecies` value, so that should be avoidable or useable as well. \n",
1160
+ "- We will remove the `Unknown` values as their CAMIDs don't appear elsewhere so the taxonomic information is non-reconcilable. \n",
1161
+ "- Christopher confirmed that `Ithomiinae` and `Pteronymia` are genera in the family `nymphalidae`, like `Heliconius`, but `Stratiomyidae` is a \"Soldier Fly\" (Google, Christopher did not recognize it as a butterfly), clearly not a butterfly from the images. This label is present in [record 5561246](https://zenodo.org/records/5561246), attached to `CAMID: CAM036326`, which does not appear elsewhere in our dataset (see check below). Looking at the record, it is labeled as `BSF blue wings` in the CSV, and the images are clearly of a butterfly's wings. We have concluded it is a mislabeling and will drop it for now."
1162
+ ]
1163
+ },
1164
+ {
1165
+ "cell_type": "code",
1166
+ "execution_count": 7,
1167
+ "metadata": {},
1168
+ "outputs": [
1169
+ {
1170
+ "name": "stdout",
1171
+ "output_type": "stream",
1172
+ "text": [
1173
+ "There are 18 entries with the taxonomic label 'Unknown', and 18 entries of that/those CAMID(s).\n"
1174
+ ]
1175
+ },
1176
+ {
1177
+ "data": {
1178
+ "text/plain": [
1179
+ "zenodo_link\n",
1180
+ "https://zenodo.org/record/5561246 12\n",
1181
+ "https://zenodo.org/record/4291095 4\n",
1182
+ "https://zenodo.org/record/2702457 2\n",
1183
+ "Name: count, dtype: int64"
1184
+ ]
1185
+ },
1186
+ "execution_count": 7,
1187
+ "metadata": {},
1188
+ "output_type": "execute_result"
1189
+ }
1190
+ ],
1191
+ "source": [
1192
+ "cams_unknown = list(master.loc[master[\"species\"] == \"Unknown\", \"CAMID\"])\n",
1193
+ "print(f\"There are {len(cams_unknown)} entries with the taxonomic label 'Unknown', and {master.loc[master['CAMID'].isin(cams_unknown)].shape[0]} entries of that/those CAMID(s).\")\n",
1194
+ "master.loc[master[\"CAMID\"].isin(cams_unknown), \"zenodo_link\"].value_counts()"
1195
+ ]
1196
+ },
1197
+ {
1198
+ "cell_type": "code",
1199
+ "execution_count": 8,
1200
+ "metadata": {},
1201
+ "outputs": [
1202
+ {
1203
+ "name": "stdout",
1204
+ "output_type": "stream",
1205
+ "text": [
1206
+ "There are 4 entries with the taxonomic label 'Stratiomyidae', and 4 entries of that/those CAMID(s).\n"
1207
+ ]
1208
+ },
1209
+ {
1210
+ "data": {
1211
+ "text/html": [
1212
+ "<div>\n",
1213
+ "<style scoped>\n",
1214
+ " .dataframe tbody tr th:only-of-type {\n",
1215
+ " vertical-align: middle;\n",
1216
+ " }\n",
1217
+ "\n",
1218
+ " .dataframe tbody tr th {\n",
1219
+ " vertical-align: top;\n",
1220
+ " }\n",
1221
+ "\n",
1222
+ " .dataframe thead th {\n",
1223
+ " text-align: right;\n",
1224
+ " }\n",
1225
+ "</style>\n",
1226
+ "<table border=\"1\" class=\"dataframe\">\n",
1227
+ " <thead>\n",
1228
+ " <tr style=\"text-align: right;\">\n",
1229
+ " <th></th>\n",
1230
+ " <th>CAMID</th>\n",
1231
+ " <th>X</th>\n",
1232
+ " <th>Image_name</th>\n",
1233
+ " <th>View</th>\n",
1234
+ " <th>zenodo_name</th>\n",
1235
+ " <th>zenodo_link</th>\n",
1236
+ " <th>Sequence</th>\n",
1237
+ " <th>Taxonomic_Name</th>\n",
1238
+ " <th>Locality</th>\n",
1239
+ " <th>Sample_accession</th>\n",
1240
+ " <th>...</th>\n",
1241
+ " <th>file_type</th>\n",
1242
+ " <th>record_number</th>\n",
1243
+ " <th>species</th>\n",
1244
+ " <th>subspecies</th>\n",
1245
+ " <th>genus</th>\n",
1246
+ " <th>file_url</th>\n",
1247
+ " <th>hybrid_stat</th>\n",
1248
+ " <th>filename</th>\n",
1249
+ " <th>filepath</th>\n",
1250
+ " <th>md5</th>\n",
1251
+ " </tr>\n",
1252
+ " </thead>\n",
1253
+ " <tbody>\n",
1254
+ " <tr>\n",
1255
+ " <th>21877</th>\n",
1256
+ " <td>CAM036326</td>\n",
1257
+ " <td>41866</td>\n",
1258
+ " <td>CAM036326_d.CR2</td>\n",
1259
+ " <td>dorsal</td>\n",
1260
+ " <td>Filelist.csv</td>\n",
1261
+ " <td>https://zenodo.org/record/5561246</td>\n",
1262
+ " <td>36,326</td>\n",
1263
+ " <td>Stratiomyidae</td>\n",
1264
+ " <td>Reserva Serra Bonita - BSF02</td>\n",
1265
+ " <td>NaN</td>\n",
1266
+ " <td>...</td>\n",
1267
+ " <td>raw</td>\n",
1268
+ " <td>5561246</td>\n",
1269
+ " <td>Stratiomyidae</td>\n",
1270
+ " <td>NaN</td>\n",
1271
+ " <td>Stratiomyidae</td>\n",
1272
+ " <td>https://zenodo.org/record/5561246/files/CAM036...</td>\n",
1273
+ " <td>NaN</td>\n",
1274
+ " <td>41866_CAM036326_d.CR2</td>\n",
1275
+ " <td>images/Stratiomyidae/41866_CAM036326_d.CR2</td>\n",
1276
+ " <td>4d823bf9308f967d8c1b2ea9325dac1d</td>\n",
1277
+ " </tr>\n",
1278
+ " <tr>\n",
1279
+ " <th>21878</th>\n",
1280
+ " <td>CAM036326</td>\n",
1281
+ " <td>41867</td>\n",
1282
+ " <td>CAM036326_d.JPG</td>\n",
1283
+ " <td>dorsal</td>\n",
1284
+ " <td>Filelist.csv</td>\n",
1285
+ " <td>https://zenodo.org/record/5561246</td>\n",
1286
+ " <td>36,326</td>\n",
1287
+ " <td>Stratiomyidae</td>\n",
1288
+ " <td>Reserva Serra Bonita - BSF02</td>\n",
1289
+ " <td>NaN</td>\n",
1290
+ " <td>...</td>\n",
1291
+ " <td>jpg</td>\n",
1292
+ " <td>5561246</td>\n",
1293
+ " <td>Stratiomyidae</td>\n",
1294
+ " <td>NaN</td>\n",
1295
+ " <td>Stratiomyidae</td>\n",
1296
+ " <td>https://zenodo.org/record/5561246/files/CAM036...</td>\n",
1297
+ " <td>NaN</td>\n",
1298
+ " <td>41867_CAM036326_d.JPG</td>\n",
1299
+ " <td>images/Stratiomyidae/41867_CAM036326_d.JPG</td>\n",
1300
+ " <td>23d2d33583c31c83b3e36563418204b8</td>\n",
1301
+ " </tr>\n",
1302
+ " <tr>\n",
1303
+ " <th>21879</th>\n",
1304
+ " <td>CAM036326</td>\n",
1305
+ " <td>41868</td>\n",
1306
+ " <td>CAM036326_v.CR2</td>\n",
1307
+ " <td>ventral</td>\n",
1308
+ " <td>Filelist.csv</td>\n",
1309
+ " <td>https://zenodo.org/record/5561246</td>\n",
1310
+ " <td>36,326</td>\n",
1311
+ " <td>Stratiomyidae</td>\n",
1312
+ " <td>Reserva Serra Bonita - BSF02</td>\n",
1313
+ " <td>NaN</td>\n",
1314
+ " <td>...</td>\n",
1315
+ " <td>raw</td>\n",
1316
+ " <td>5561246</td>\n",
1317
+ " <td>Stratiomyidae</td>\n",
1318
+ " <td>NaN</td>\n",
1319
+ " <td>Stratiomyidae</td>\n",
1320
+ " <td>https://zenodo.org/record/5561246/files/CAM036...</td>\n",
1321
+ " <td>NaN</td>\n",
1322
+ " <td>41868_CAM036326_v.CR2</td>\n",
1323
+ " <td>images/Stratiomyidae/41868_CAM036326_v.CR2</td>\n",
1324
+ " <td>d4a628aa306aa7deafa93d2b913ba4de</td>\n",
1325
+ " </tr>\n",
1326
+ " <tr>\n",
1327
+ " <th>21880</th>\n",
1328
+ " <td>CAM036326</td>\n",
1329
+ " <td>41869</td>\n",
1330
+ " <td>CAM036326_v.JPG</td>\n",
1331
+ " <td>ventral</td>\n",
1332
+ " <td>Filelist.csv</td>\n",
1333
+ " <td>https://zenodo.org/record/5561246</td>\n",
1334
+ " <td>36,326</td>\n",
1335
+ " <td>Stratiomyidae</td>\n",
1336
+ " <td>Reserva Serra Bonita - BSF02</td>\n",
1337
+ " <td>NaN</td>\n",
1338
+ " <td>...</td>\n",
1339
+ " <td>jpg</td>\n",
1340
+ " <td>5561246</td>\n",
1341
+ " <td>Stratiomyidae</td>\n",
1342
+ " <td>NaN</td>\n",
1343
+ " <td>Stratiomyidae</td>\n",
1344
+ " <td>https://zenodo.org/record/5561246/files/CAM036...</td>\n",
1345
+ " <td>NaN</td>\n",
1346
+ " <td>41869_CAM036326_v.JPG</td>\n",
1347
+ " <td>images/Stratiomyidae/41869_CAM036326_v.JPG</td>\n",
1348
+ " <td>0a8ed38b8ad9755831bb796febaa624e</td>\n",
1349
+ " </tr>\n",
1350
+ " </tbody>\n",
1351
+ "</table>\n",
1352
+ "<p>4 rows × 31 columns</p>\n",
1353
+ "</div>"
1354
+ ],
1355
+ "text/plain": [
1356
+ " CAMID X Image_name View zenodo_name \\\n",
1357
+ "21877 CAM036326 41866 CAM036326_d.CR2 dorsal Filelist.csv \n",
1358
+ "21878 CAM036326 41867 CAM036326_d.JPG dorsal Filelist.csv \n",
1359
+ "21879 CAM036326 41868 CAM036326_v.CR2 ventral Filelist.csv \n",
1360
+ "21880 CAM036326 41869 CAM036326_v.JPG ventral Filelist.csv \n",
1361
+ "\n",
1362
+ " zenodo_link Sequence Taxonomic_Name \\\n",
1363
+ "21877 https://zenodo.org/record/5561246 36,326 Stratiomyidae \n",
1364
+ "21878 https://zenodo.org/record/5561246 36,326 Stratiomyidae \n",
1365
+ "21879 https://zenodo.org/record/5561246 36,326 Stratiomyidae \n",
1366
+ "21880 https://zenodo.org/record/5561246 36,326 Stratiomyidae \n",
1367
+ "\n",
1368
+ " Locality Sample_accession ... file_type \\\n",
1369
+ "21877 Reserva Serra Bonita - BSF02 NaN ... raw \n",
1370
+ "21878 Reserva Serra Bonita - BSF02 NaN ... jpg \n",
1371
+ "21879 Reserva Serra Bonita - BSF02 NaN ... raw \n",
1372
+ "21880 Reserva Serra Bonita - BSF02 NaN ... jpg \n",
1373
+ "\n",
1374
+ " record_number species subspecies genus \\\n",
1375
+ "21877 5561246 Stratiomyidae NaN Stratiomyidae \n",
1376
+ "21878 5561246 Stratiomyidae NaN Stratiomyidae \n",
1377
+ "21879 5561246 Stratiomyidae NaN Stratiomyidae \n",
1378
+ "21880 5561246 Stratiomyidae NaN Stratiomyidae \n",
1379
+ "\n",
1380
+ " file_url hybrid_stat \\\n",
1381
+ "21877 https://zenodo.org/record/5561246/files/CAM036... NaN \n",
1382
+ "21878 https://zenodo.org/record/5561246/files/CAM036... NaN \n",
1383
+ "21879 https://zenodo.org/record/5561246/files/CAM036... NaN \n",
1384
+ "21880 https://zenodo.org/record/5561246/files/CAM036... NaN \n",
1385
+ "\n",
1386
+ " filename filepath \\\n",
1387
+ "21877 41866_CAM036326_d.CR2 images/Stratiomyidae/41866_CAM036326_d.CR2 \n",
1388
+ "21878 41867_CAM036326_d.JPG images/Stratiomyidae/41867_CAM036326_d.JPG \n",
1389
+ "21879 41868_CAM036326_v.CR2 images/Stratiomyidae/41868_CAM036326_v.CR2 \n",
1390
+ "21880 41869_CAM036326_v.JPG images/Stratiomyidae/41869_CAM036326_v.JPG \n",
1391
+ "\n",
1392
+ " md5 \n",
1393
+ "21877 4d823bf9308f967d8c1b2ea9325dac1d \n",
1394
+ "21878 23d2d33583c31c83b3e36563418204b8 \n",
1395
+ "21879 d4a628aa306aa7deafa93d2b913ba4de \n",
1396
+ "21880 0a8ed38b8ad9755831bb796febaa624e \n",
1397
+ "\n",
1398
+ "[4 rows x 31 columns]"
1399
+ ]
1400
+ },
1401
+ "execution_count": 8,
1402
+ "metadata": {},
1403
+ "output_type": "execute_result"
1404
+ }
1405
+ ],
1406
+ "source": [
1407
+ "cams_stratiomyidae = list(master.loc[master[\"species\"] == \"Stratiomyidae\", \"CAMID\"])\n",
1408
+ "print(f\"There are {len(cams_stratiomyidae)} entries with the taxonomic label 'Stratiomyidae', and {master.loc[master['CAMID'].isin(cams_stratiomyidae)].shape[0]} entries of that/those CAMID(s).\")\n",
1409
+ "master.loc[master[\"species\"] == \"Stratiomyidae\"]"
1410
+ ]
1411
+ },
1412
+ {
1413
+ "cell_type": "code",
1414
+ "execution_count": 9,
1415
+ "metadata": {},
1416
+ "outputs": [],
1417
+ "source": [
1418
+ "missing_label_cams = cams_unknown + cams_stratiomyidae\n",
1419
+ "master.loc[master[\"CAMID\"].isin(missing_label_cams)].to_csv(\"../metadata/Missing_taxa_download.csv\")"
1420
+ ]
1421
+ },
1422
+ {
1423
+ "cell_type": "code",
1424
+ "execution_count": 10,
1425
+ "metadata": {},
1426
+ "outputs": [
1427
+ {
1428
+ "data": {
1429
+ "text/plain": [
1430
+ "36193"
1431
+ ]
1432
+ },
1433
+ "execution_count": 10,
1434
+ "metadata": {},
1435
+ "output_type": "execute_result"
1436
+ }
1437
+ ],
1438
+ "source": [
1439
+ "# Drop Unknown\n",
1440
+ "master = master.loc[master[\"species\"] != \"Unknown\"]\n",
1441
+ "master.shape[0] # should now be 36,193"
1442
+ ]
1443
+ },
1444
+ {
1445
+ "cell_type": "code",
1446
+ "execution_count": 11,
1447
+ "metadata": {},
1448
+ "outputs": [
1449
+ {
1450
+ "data": {
1451
+ "text/plain": [
1452
+ "36189"
1453
+ ]
1454
+ },
1455
+ "execution_count": 11,
1456
+ "metadata": {},
1457
+ "output_type": "execute_result"
1458
+ }
1459
+ ],
1460
+ "source": [
1461
+ "# Drop Stratiomyidae\n",
1462
+ "master = master.loc[master[\"species\"] != \"Stratiomyidae\"]\n",
1463
+ "master.shape[0] # should now be 36,189"
1464
+ ]
1465
+ },
1466
+ {
1467
+ "cell_type": "code",
1468
+ "execution_count": 12,
1469
+ "metadata": {},
1470
+ "outputs": [],
1471
+ "source": [
1472
+ "# Rename 'Pteronymia', 'Ithomiinae', and 'Heliconius' as '<Genus> sp.' for consistency\n",
1473
+ "rename_sp = ['Pteronymia', 'Ithomiinae', 'Heliconius']\n",
1474
+ "\n",
1475
+ "for species in rename_sp:\n",
1476
+ " master.loc[master[\"species\"] == species, \"Taxonomic_Name\"] = species + \" sp.\"\n",
1477
+ " master.loc[master[\"species\"] == species, \"species\"] = species + \" sp.\""
1478
+ ]
1479
+ },
1480
+ {
1481
+ "cell_type": "code",
1482
+ "execution_count": 13,
1483
+ "metadata": {},
1484
+ "outputs": [
1485
+ {
1486
+ "name": "stdout",
1487
+ "output_type": "stream",
1488
+ "text": [
1489
+ "We have 25 'species' designations really labeled only to genus, 0 species designations that may not be labeled at the species level.\n"
1490
+ ]
1491
+ }
1492
+ ],
1493
+ "source": [
1494
+ "# Check, sp_list should now be 25, as Heliconius sp. and 'Pteronymia sp.' were already on there, and our one_word_list should now be zero\n",
1495
+ "species_list = list(master.species.unique())\n",
1496
+ "\n",
1497
+ "sp_list = []\n",
1498
+ "one_word_list = []\n",
1499
+ "for species in species_list:\n",
1500
+ " if \"sp.\" in species:\n",
1501
+ " sp_list.append(species)\n",
1502
+ " if len(species.split(\" \")) == 1:\n",
1503
+ " one_word_list.append(species)\n",
1504
+ "\n",
1505
+ "print(f\"We have {len(sp_list)} 'species' designations really labeled only to genus, {len(one_word_list)} species designations that may not be labeled at the species level.\")"
1506
+ ]
1507
+ },
1508
+ {
1509
+ "cell_type": "markdown",
1510
+ "metadata": {},
1511
+ "source": [
1512
+ "### Stats Checks & Save\n",
1513
+ "\n",
1514
+ "We'll now save our updated master file, then check all our stats to update the Dataset Card appropriately before regenerating our other subsets."
1515
+ ]
1516
+ },
1517
+ {
1518
+ "cell_type": "code",
1519
+ "execution_count": 14,
1520
+ "metadata": {},
1521
+ "outputs": [],
1522
+ "source": [
1523
+ "master.to_csv(\"../Jiggins_Zenodo_Img_Master.csv\", index = False)"
1524
+ ]
1525
+ },
1526
+ {
1527
+ "cell_type": "code",
1528
+ "execution_count": 15,
1529
+ "metadata": {},
1530
+ "outputs": [
1531
+ {
1532
+ "name": "stdout",
1533
+ "output_type": "stream",
1534
+ "text": [
1535
+ "<class 'pandas.core.frame.DataFrame'>\n",
1536
+ "Index: 36189 entries, 0 to 36210\n",
1537
+ "Data columns (total 31 columns):\n",
1538
+ " # Column Non-Null Count Dtype \n",
1539
+ "--- ------ -------------- ----- \n",
1540
+ " 0 CAMID 36189 non-null object\n",
1541
+ " 1 X 36189 non-null int64 \n",
1542
+ " 2 Image_name 36189 non-null object\n",
1543
+ " 3 View 35410 non-null object\n",
1544
+ " 4 zenodo_name 36189 non-null object\n",
1545
+ " 5 zenodo_link 36189 non-null object\n",
1546
+ " 6 Sequence 35257 non-null object\n",
1547
+ " 7 Taxonomic_Name 36189 non-null object\n",
1548
+ " 8 Locality 23105 non-null object\n",
1549
+ " 9 Sample_accession 3647 non-null object\n",
1550
+ " 10 Collected_by 3043 non-null object\n",
1551
+ " 11 Other_ID 11325 non-null object\n",
1552
+ " 12 Date 23022 non-null object\n",
1553
+ " 13 Dataset 29112 non-null object\n",
1554
+ " 14 Store 27807 non-null object\n",
1555
+ " 15 Brood 13847 non-null object\n",
1556
+ " 16 Death_Date 269 non-null object\n",
1557
+ " 17 Cross_Type 4447 non-null object\n",
1558
+ " 18 Stage 6 non-null object\n",
1559
+ " 19 Sex 27510 non-null object\n",
1560
+ " 20 Unit_Type 25058 non-null object\n",
1561
+ " 21 file_type 36189 non-null object\n",
1562
+ " 22 record_number 36189 non-null int64 \n",
1563
+ " 23 species 36189 non-null object\n",
1564
+ " 24 subspecies 20400 non-null object\n",
1565
+ " 25 genus 36189 non-null object\n",
1566
+ " 26 file_url 36189 non-null object\n",
1567
+ " 27 hybrid_stat 20948 non-null object\n",
1568
+ " 28 filename 36189 non-null object\n",
1569
+ " 29 filepath 36189 non-null object\n",
1570
+ " 30 md5 36189 non-null object\n",
1571
+ "dtypes: int64(2), object(29)\n",
1572
+ "memory usage: 8.8+ MB\n"
1573
+ ]
1574
+ }
1575
+ ],
1576
+ "source": [
1577
+ "master.info()"
1578
+ ]
1579
+ },
1580
+ {
1581
+ "cell_type": "code",
1582
+ "execution_count": 16,
1583
+ "metadata": {},
1584
+ "outputs": [
1585
+ {
1586
+ "data": {
1587
+ "text/plain": [
1588
+ "CAMID 11962\n",
1589
+ "X 36189\n",
1590
+ "Image_name 36189\n",
1591
+ "View 7\n",
1592
+ "zenodo_name 31\n",
1593
+ "zenodo_link 29\n",
1594
+ "Sequence 10876\n",
1595
+ "Taxonomic_Name 362\n",
1596
+ "Locality 643\n",
1597
+ "Sample_accession 1559\n",
1598
+ "Collected_by 12\n",
1599
+ "Other_ID 3080\n",
1600
+ "Date 804\n",
1601
+ "Dataset 7\n",
1602
+ "Store 137\n",
1603
+ "Brood 224\n",
1604
+ "Death_Date 79\n",
1605
+ "Cross_Type 30\n",
1606
+ "Stage 1\n",
1607
+ "Sex 3\n",
1608
+ "Unit_Type 4\n",
1609
+ "file_type 3\n",
1610
+ "record_number 29\n",
1611
+ "species 242\n",
1612
+ "subspecies 155\n",
1613
+ "genus 92\n",
1614
+ "file_url 36189\n",
1615
+ "hybrid_stat 2\n",
1616
+ "filename 36189\n",
1617
+ "filepath 36189\n",
1618
+ "md5 36189\n",
1619
+ "dtype: int64"
1620
+ ]
1621
+ },
1622
+ "execution_count": 16,
1623
+ "metadata": {},
1624
+ "output_type": "execute_result"
1625
+ }
1626
+ ],
1627
+ "source": [
1628
+ "master.nunique()"
1629
+ ]
1630
+ },
1631
+ {
1632
+ "cell_type": "markdown",
1633
+ "metadata": {},
1634
+ "source": [
1635
+ "Note that a total of 4 \"unique\" Taxonomic Names and species were removed above: \"Unknown\", \"Heliconius\", \"Pteronymia\", \"Ithomiinae\", and \"Stratiomyidae\" were removed and \"Ithomiinae sp.\" was added. This process also resulted in the removal of 2 \"unique\" genera (\"Unknown\" and \"Stratiomyidae\").\n",
1636
+ "\n",
1637
+ "No records were removed."
1638
+ ]
1639
+ },
1640
+ {
1641
+ "cell_type": "code",
1642
+ "execution_count": 17,
1643
+ "metadata": {},
1644
+ "outputs": [
1645
+ {
1646
+ "data": {
1647
+ "text/html": [
1648
+ "<div>\n",
1649
+ "<style scoped>\n",
1650
+ " .dataframe tbody tr th:only-of-type {\n",
1651
+ " vertical-align: middle;\n",
1652
+ " }\n",
1653
+ "\n",
1654
+ " .dataframe tbody tr th {\n",
1655
+ " vertical-align: top;\n",
1656
+ " }\n",
1657
+ "\n",
1658
+ " .dataframe thead th {\n",
1659
+ " text-align: right;\n",
1660
+ " }\n",
1661
+ "</style>\n",
1662
+ "<table border=\"1\" class=\"dataframe\">\n",
1663
+ " <thead>\n",
1664
+ " <tr style=\"text-align: right;\">\n",
1665
+ " <th></th>\n",
1666
+ " <th>CAMID</th>\n",
1667
+ " <th>X</th>\n",
1668
+ " <th>Image_name</th>\n",
1669
+ " <th>View</th>\n",
1670
+ " <th>zenodo_name</th>\n",
1671
+ " <th>zenodo_link</th>\n",
1672
+ " <th>Sequence</th>\n",
1673
+ " <th>Taxonomic_Name</th>\n",
1674
+ " <th>Locality</th>\n",
1675
+ " <th>Sample_accession</th>\n",
1676
+ " <th>...</th>\n",
1677
+ " <th>file_type</th>\n",
1678
+ " <th>record_number</th>\n",
1679
+ " <th>species</th>\n",
1680
+ " <th>subspecies</th>\n",
1681
+ " <th>genus</th>\n",
1682
+ " <th>file_url</th>\n",
1683
+ " <th>hybrid_stat</th>\n",
1684
+ " <th>filename</th>\n",
1685
+ " <th>filepath</th>\n",
1686
+ " <th>md5</th>\n",
1687
+ " </tr>\n",
1688
+ " </thead>\n",
1689
+ " <tbody>\n",
1690
+ " <tr>\n",
1691
+ " <th>13300</th>\n",
1692
+ " <td>CAM013566</td>\n",
1693
+ " <td>26040</td>\n",
1694
+ " <td>13566_H_m_thelxiopeia_V.JPG.jpg</td>\n",
1695
+ " <td>ventral</td>\n",
1696
+ " <td>Heliconius_wing_old_photos_2001_2019_part3.csv</td>\n",
1697
+ " <td>https://zenodo.org/record/2553977</td>\n",
1698
+ " <td>13,566</td>\n",
1699
+ " <td>Heliconius melpomene ssp. thelxiopeia</td>\n",
1700
+ " <td>Maripasoula</td>\n",
1701
+ " <td>ERS977708</td>\n",
1702
+ " <td>...</td>\n",
1703
+ " <td>jpg</td>\n",
1704
+ " <td>2553977</td>\n",
1705
+ " <td>Heliconius melpomene</td>\n",
1706
+ " <td>thelxiopeia</td>\n",
1707
+ " <td>Heliconius</td>\n",
1708
+ " <td>https://zenodo.org/record/2553977/files/13566_...</td>\n",
1709
+ " <td>non-hybrid</td>\n",
1710
+ " <td>26040_13566_H_m_thelxiopeia_V.JPG.jpg</td>\n",
1711
+ " <td>images/Heliconius melpomene ssp. thelxiopeia/2...</td>\n",
1712
+ " <td>b5ed68f937132cbbb04a81d550c9f17e</td>\n",
1713
+ " </tr>\n",
1714
+ " <tr>\n",
1715
+ " <th>13301</th>\n",
1716
+ " <td>CAM013566</td>\n",
1717
+ " <td>26039</td>\n",
1718
+ " <td>13566_H_m_thelxiopeia_D.JPG.jpg</td>\n",
1719
+ " <td>dorsal</td>\n",
1720
+ " <td>Heliconius_wing_old_photos_2001_2019_part3.csv</td>\n",
1721
+ " <td>https://zenodo.org/record/2553977</td>\n",
1722
+ " <td>13,566</td>\n",
1723
+ " <td>Heliconius melpomene ssp. thelxiopeia</td>\n",
1724
+ " <td>Maripasoula</td>\n",
1725
+ " <td>ERS977708</td>\n",
1726
+ " <td>...</td>\n",
1727
+ " <td>jpg</td>\n",
1728
+ " <td>2553977</td>\n",
1729
+ " <td>Heliconius melpomene</td>\n",
1730
+ " <td>thelxiopeia</td>\n",
1731
+ " <td>Heliconius</td>\n",
1732
+ " <td>https://zenodo.org/record/2553977/files/13566_...</td>\n",
1733
+ " <td>non-hybrid</td>\n",
1734
+ " <td>26039_13566_H_m_thelxiopeia_D.JPG.jpg</td>\n",
1735
+ " <td>images/Heliconius melpomene ssp. thelxiopeia/2...</td>\n",
1736
+ " <td>cb107e2d6a2c3c84b68bbf4e3cfa7af7</td>\n",
1737
+ " </tr>\n",
1738
+ " <tr>\n",
1739
+ " <th>13302</th>\n",
1740
+ " <td>CAM013715</td>\n",
1741
+ " <td>26041</td>\n",
1742
+ " <td>13715_H_m_meriana_D.JPG.jpg</td>\n",
1743
+ " <td>dorsal</td>\n",
1744
+ " <td>Heliconius_wing_old_photos_2001_2019_part3.csv</td>\n",
1745
+ " <td>https://zenodo.org/record/2553977</td>\n",
1746
+ " <td>13,715</td>\n",
1747
+ " <td>Heliconius melpomene ssp. meriana</td>\n",
1748
+ " <td>N. Wakapou, Maripausala FR GUIANA</td>\n",
1749
+ " <td>ERS977704</td>\n",
1750
+ " <td>...</td>\n",
1751
+ " <td>jpg</td>\n",
1752
+ " <td>2553977</td>\n",
1753
+ " <td>Heliconius melpomene</td>\n",
1754
+ " <td>meriana</td>\n",
1755
+ " <td>Heliconius</td>\n",
1756
+ " <td>https://zenodo.org/record/2553977/files/13715_...</td>\n",
1757
+ " <td>non-hybrid</td>\n",
1758
+ " <td>26041_13715_H_m_meriana_D.JPG.jpg</td>\n",
1759
+ " <td>images/Heliconius melpomene ssp. meriana/26041...</td>\n",
1760
+ " <td>8c77ecb2d8d878f8ac8b097ad361deda</td>\n",
1761
+ " </tr>\n",
1762
+ " <tr>\n",
1763
+ " <th>13303</th>\n",
1764
+ " <td>CAM013715</td>\n",
1765
+ " <td>26042</td>\n",
1766
+ " <td>13715_H_m_meriana_V.JPG.jpg</td>\n",
1767
+ " <td>ventral</td>\n",
1768
+ " <td>Heliconius_wing_old_photos_2001_2019_part3.csv</td>\n",
1769
+ " <td>https://zenodo.org/record/2553977</td>\n",
1770
+ " <td>13,715</td>\n",
1771
+ " <td>Heliconius melpomene ssp. meriana</td>\n",
1772
+ " <td>N. Wakapou, Maripausala FR GUIANA</td>\n",
1773
+ " <td>ERS977704</td>\n",
1774
+ " <td>...</td>\n",
1775
+ " <td>jpg</td>\n",
1776
+ " <td>2553977</td>\n",
1777
+ " <td>Heliconius melpomene</td>\n",
1778
+ " <td>meriana</td>\n",
1779
+ " <td>Heliconius</td>\n",
1780
+ " <td>https://zenodo.org/record/2553977/files/13715_...</td>\n",
1781
+ " <td>non-hybrid</td>\n",
1782
+ " <td>26042_13715_H_m_meriana_V.JPG.jpg</td>\n",
1783
+ " <td>images/Heliconius melpomene ssp. meriana/26042...</td>\n",
1784
+ " <td>fcf74c73537323bb90127cf92775ac08</td>\n",
1785
+ " </tr>\n",
1786
+ " <tr>\n",
1787
+ " <th>13304</th>\n",
1788
+ " <td>CAM013819</td>\n",
1789
+ " <td>26044</td>\n",
1790
+ " <td>13819_H_m_meriana_V.JPG.jpg</td>\n",
1791
+ " <td>ventral</td>\n",
1792
+ " <td>Heliconius_wing_old_photos_2001_2019_part3.csv</td>\n",
1793
+ " <td>https://zenodo.org/record/2553977</td>\n",
1794
+ " <td>13,819</td>\n",
1795
+ " <td>Heliconius melpomene ssp. meriana</td>\n",
1796
+ " <td>N. Wakapou, Maripausala FR GUIANA</td>\n",
1797
+ " <td>ERS977703</td>\n",
1798
+ " <td>...</td>\n",
1799
+ " <td>jpg</td>\n",
1800
+ " <td>2553977</td>\n",
1801
+ " <td>Heliconius melpomene</td>\n",
1802
+ " <td>meriana</td>\n",
1803
+ " <td>Heliconius</td>\n",
1804
+ " <td>https://zenodo.org/record/2553977/files/13819_...</td>\n",
1805
+ " <td>non-hybrid</td>\n",
1806
+ " <td>26044_13819_H_m_meriana_V.JPG.jpg</td>\n",
1807
+ " <td>images/Heliconius melpomene ssp. meriana/26044...</td>\n",
1808
+ " <td>601b67512a8c25e5f25a9da89841e8c2</td>\n",
1809
+ " </tr>\n",
1810
+ " <tr>\n",
1811
+ " <th>13305</th>\n",
1812
+ " <td>CAM013819</td>\n",
1813
+ " <td>26043</td>\n",
1814
+ " <td>13819_H_m_meriana_D.JPG.jpg</td>\n",
1815
+ " <td>dorsal</td>\n",
1816
+ " <td>Heliconius_wing_old_photos_2001_2019_part3.csv</td>\n",
1817
+ " <td>https://zenodo.org/record/2553977</td>\n",
1818
+ " <td>13,819</td>\n",
1819
+ " <td>Heliconius melpomene ssp. meriana</td>\n",
1820
+ " <td>N. Wakapou, Maripausala FR GUIANA</td>\n",
1821
+ " <td>ERS977703</td>\n",
1822
+ " <td>...</td>\n",
1823
+ " <td>jpg</td>\n",
1824
+ " <td>2553977</td>\n",
1825
+ " <td>Heliconius melpomene</td>\n",
1826
+ " <td>meriana</td>\n",
1827
+ " <td>Heliconius</td>\n",
1828
+ " <td>https://zenodo.org/record/2553977/files/13819_...</td>\n",
1829
+ " <td>non-hybrid</td>\n",
1830
+ " <td>26043_13819_H_m_meriana_D.JPG.jpg</td>\n",
1831
+ " <td>images/Heliconius melpomene ssp. meriana/26043...</td>\n",
1832
+ " <td>fe4cf831c5203ad6c9010fc047b7fa10</td>\n",
1833
+ " </tr>\n",
1834
+ " </tbody>\n",
1835
+ "</table>\n",
1836
+ "<p>6 rows × 31 columns</p>\n",
1837
+ "</div>"
1838
+ ],
1839
+ "text/plain": [
1840
+ " CAMID X Image_name View \\\n",
1841
+ "13300 CAM013566 26040 13566_H_m_thelxiopeia_V.JPG.jpg ventral \n",
1842
+ "13301 CAM013566 26039 13566_H_m_thelxiopeia_D.JPG.jpg dorsal \n",
1843
+ "13302 CAM013715 26041 13715_H_m_meriana_D.JPG.jpg dorsal \n",
1844
+ "13303 CAM013715 26042 13715_H_m_meriana_V.JPG.jpg ventral \n",
1845
+ "13304 CAM013819 26044 13819_H_m_meriana_V.JPG.jpg ventral \n",
1846
+ "13305 CAM013819 26043 13819_H_m_meriana_D.JPG.jpg dorsal \n",
1847
+ "\n",
1848
+ " zenodo_name \\\n",
1849
+ "13300 Heliconius_wing_old_photos_2001_2019_part3.csv \n",
1850
+ "13301 Heliconius_wing_old_photos_2001_2019_part3.csv \n",
1851
+ "13302 Heliconius_wing_old_photos_2001_2019_part3.csv \n",
1852
+ "13303 Heliconius_wing_old_photos_2001_2019_part3.csv \n",
1853
+ "13304 Heliconius_wing_old_photos_2001_2019_part3.csv \n",
1854
+ "13305 Heliconius_wing_old_photos_2001_2019_part3.csv \n",
1855
+ "\n",
1856
+ " zenodo_link Sequence \\\n",
1857
+ "13300 https://zenodo.org/record/2553977 13,566 \n",
1858
+ "13301 https://zenodo.org/record/2553977 13,566 \n",
1859
+ "13302 https://zenodo.org/record/2553977 13,715 \n",
1860
+ "13303 https://zenodo.org/record/2553977 13,715 \n",
1861
+ "13304 https://zenodo.org/record/2553977 13,819 \n",
1862
+ "13305 https://zenodo.org/record/2553977 13,819 \n",
1863
+ "\n",
1864
+ " Taxonomic_Name \\\n",
1865
+ "13300 Heliconius melpomene ssp. thelxiopeia \n",
1866
+ "13301 Heliconius melpomene ssp. thelxiopeia \n",
1867
+ "13302 Heliconius melpomene ssp. meriana \n",
1868
+ "13303 Heliconius melpomene ssp. meriana \n",
1869
+ "13304 Heliconius melpomene ssp. meriana \n",
1870
+ "13305 Heliconius melpomene ssp. meriana \n",
1871
+ "\n",
1872
+ " Locality Sample_accession ... file_type \\\n",
1873
+ "13300 Maripasoula ERS977708 ... jpg \n",
1874
+ "13301 Maripasoula ERS977708 ... jpg \n",
1875
+ "13302 N. Wakapou, Maripausala FR GUIANA ERS977704 ... jpg \n",
1876
+ "13303 N. Wakapou, Maripausala FR GUIANA ERS977704 ... jpg \n",
1877
+ "13304 N. Wakapou, Maripausala FR GUIANA ERS977703 ... jpg \n",
1878
+ "13305 N. Wakapou, Maripausala FR GUIANA ERS977703 ... jpg \n",
1879
+ "\n",
1880
+ " record_number species subspecies genus \\\n",
1881
+ "13300 2553977 Heliconius melpomene thelxiopeia Heliconius \n",
1882
+ "13301 2553977 Heliconius melpomene thelxiopeia Heliconius \n",
1883
+ "13302 2553977 Heliconius melpomene meriana Heliconius \n",
1884
+ "13303 2553977 Heliconius melpomene meriana Heliconius \n",
1885
+ "13304 2553977 Heliconius melpomene meriana Heliconius \n",
1886
+ "13305 2553977 Heliconius melpomene meriana Heliconius \n",
1887
+ "\n",
1888
+ " file_url hybrid_stat \\\n",
1889
+ "13300 https://zenodo.org/record/2553977/files/13566_... non-hybrid \n",
1890
+ "13301 https://zenodo.org/record/2553977/files/13566_... non-hybrid \n",
1891
+ "13302 https://zenodo.org/record/2553977/files/13715_... non-hybrid \n",
1892
+ "13303 https://zenodo.org/record/2553977/files/13715_... non-hybrid \n",
1893
+ "13304 https://zenodo.org/record/2553977/files/13819_... non-hybrid \n",
1894
+ "13305 https://zenodo.org/record/2553977/files/13819_... non-hybrid \n",
1895
+ "\n",
1896
+ " filename \\\n",
1897
+ "13300 26040_13566_H_m_thelxiopeia_V.JPG.jpg \n",
1898
+ "13301 26039_13566_H_m_thelxiopeia_D.JPG.jpg \n",
1899
+ "13302 26041_13715_H_m_meriana_D.JPG.jpg \n",
1900
+ "13303 26042_13715_H_m_meriana_V.JPG.jpg \n",
1901
+ "13304 26044_13819_H_m_meriana_V.JPG.jpg \n",
1902
+ "13305 26043_13819_H_m_meriana_D.JPG.jpg \n",
1903
+ "\n",
1904
+ " filepath \\\n",
1905
+ "13300 images/Heliconius melpomene ssp. thelxiopeia/2... \n",
1906
+ "13301 images/Heliconius melpomene ssp. thelxiopeia/2... \n",
1907
+ "13302 images/Heliconius melpomene ssp. meriana/26041... \n",
1908
+ "13303 images/Heliconius melpomene ssp. meriana/26042... \n",
1909
+ "13304 images/Heliconius melpomene ssp. meriana/26044... \n",
1910
+ "13305 images/Heliconius melpomene ssp. meriana/26043... \n",
1911
+ "\n",
1912
+ " md5 \n",
1913
+ "13300 b5ed68f937132cbbb04a81d550c9f17e \n",
1914
+ "13301 cb107e2d6a2c3c84b68bbf4e3cfa7af7 \n",
1915
+ "13302 8c77ecb2d8d878f8ac8b097ad361deda \n",
1916
+ "13303 fcf74c73537323bb90127cf92775ac08 \n",
1917
+ "13304 601b67512a8c25e5f25a9da89841e8c2 \n",
1918
+ "13305 fe4cf831c5203ad6c9010fc047b7fa10 \n",
1919
+ "\n",
1920
+ "[6 rows x 31 columns]"
1921
+ ]
1922
+ },
1923
+ "execution_count": 17,
1924
+ "metadata": {},
1925
+ "output_type": "execute_result"
1926
+ }
1927
+ ],
1928
+ "source": [
1929
+ "master.loc[master.Stage.notna()]"
1930
+ ]
1931
+ },
1932
+ {
1933
+ "cell_type": "code",
1934
+ "execution_count": 18,
1935
+ "metadata": {},
1936
+ "outputs": [
1937
+ {
1938
+ "data": {
1939
+ "text/plain": [
1940
+ "CAMID 820\n",
1941
+ "X 4447\n",
1942
+ "Image_name 4447\n",
1943
+ "View 2\n",
1944
+ "zenodo_name 4\n",
1945
+ "zenodo_link 4\n",
1946
+ "Sequence 820\n",
1947
+ "Taxonomic_Name 8\n",
1948
+ "Locality 0\n",
1949
+ "Sample_accession 0\n",
1950
+ "Collected_by 0\n",
1951
+ "Other_ID 0\n",
1952
+ "Date 160\n",
1953
+ "Dataset 1\n",
1954
+ "Store 10\n",
1955
+ "Brood 49\n",
1956
+ "Death_Date 0\n",
1957
+ "Cross_Type 30\n",
1958
+ "Stage 0\n",
1959
+ "Sex 2\n",
1960
+ "Unit_Type 1\n",
1961
+ "file_type 2\n",
1962
+ "record_number 4\n",
1963
+ "species 2\n",
1964
+ "subspecies 21\n",
1965
+ "genus 1\n",
1966
+ "file_url 4447\n",
1967
+ "hybrid_stat 2\n",
1968
+ "filename 4447\n",
1969
+ "filepath 4447\n",
1970
+ "md5 4447\n",
1971
+ "dtype: int64"
1972
+ ]
1973
+ },
1974
+ "execution_count": 18,
1975
+ "metadata": {},
1976
+ "output_type": "execute_result"
1977
+ }
1978
+ ],
1979
+ "source": [
1980
+ "master.loc[master.Cross_Type.notna()].nunique()"
1981
+ ]
1982
+ },
1983
+ {
1984
+ "cell_type": "code",
1985
+ "execution_count": 19,
1986
+ "metadata": {},
1987
+ "outputs": [
1988
+ {
1989
+ "data": {
1990
+ "text/plain": [
1991
+ "View\n",
1992
+ "dorsal 17224\n",
1993
+ "ventral 17156\n",
1994
+ "hindwing dorsal 254\n",
1995
+ "hindwing ventral 254\n",
1996
+ "forewing dorsal 252\n",
1997
+ "forewing ventral 252\n",
1998
+ "dorsal and ventral 18\n",
1999
+ "Name: count, dtype: int64"
2000
+ ]
2001
+ },
2002
+ "execution_count": 19,
2003
+ "metadata": {},
2004
+ "output_type": "execute_result"
2005
+ }
2006
+ ],
2007
+ "source": [
2008
+ "master.View.value_counts()"
2009
+ ]
2010
+ },
2011
+ {
2012
+ "cell_type": "code",
2013
+ "execution_count": 20,
2014
+ "metadata": {},
2015
+ "outputs": [
2016
+ {
2017
+ "data": {
2018
+ "text/plain": [
2019
+ "Sex\n",
2020
+ "Male 15904\n",
2021
+ "Female 11323\n",
2022
+ "Unknown 283\n",
2023
+ "Name: count, dtype: int64"
2024
+ ]
2025
+ },
2026
+ "execution_count": 20,
2027
+ "metadata": {},
2028
+ "output_type": "execute_result"
2029
+ }
2030
+ ],
2031
+ "source": [
2032
+ "master.Sex.value_counts()"
2033
+ ]
2034
+ },
2035
+ {
2036
+ "cell_type": "markdown",
2037
+ "metadata": {},
2038
+ "source": [
2039
+ "Generate master_licenses CSV file to re-run [`get_licenses.py`](https://huggingface.co/datasets/imageomics/Comparison-Subset-Jiggins/blob/main/scripts/get_licenses.py) for nicely formatted licensing info of the 29 included records.\n"
2040
+ ]
2041
+ },
2042
+ {
2043
+ "cell_type": "code",
2044
+ "execution_count": 24,
2045
+ "metadata": {},
2046
+ "outputs": [
2047
+ {
2048
+ "data": {
2049
+ "text/plain": [
2050
+ "(29, 2)"
2051
+ ]
2052
+ },
2053
+ "execution_count": 24,
2054
+ "metadata": {},
2055
+ "output_type": "execute_result"
2056
+ }
2057
+ ],
2058
+ "source": [
2059
+ "master_licenses = master[[\"record_number\", \"zenodo_link\"]]\n",
2060
+ "master_licenses = master_licenses.loc[~master_licenses.duplicated([\"record_number\", \"zenodo_link\"], keep = \"first\")]\n",
2061
+ "master_licenses.shape"
2062
+ ]
2063
+ },
2064
+ {
2065
+ "cell_type": "code",
2066
+ "execution_count": 25,
2067
+ "metadata": {},
2068
+ "outputs": [
2069
+ {
2070
+ "data": {
2071
+ "text/html": [
2072
+ "<div>\n",
2073
+ "<style scoped>\n",
2074
+ " .dataframe tbody tr th:only-of-type {\n",
2075
+ " vertical-align: middle;\n",
2076
+ " }\n",
2077
+ "\n",
2078
+ " .dataframe tbody tr th {\n",
2079
+ " vertical-align: top;\n",
2080
+ " }\n",
2081
+ "\n",
2082
+ " .dataframe thead th {\n",
2083
+ " text-align: right;\n",
2084
+ " }\n",
2085
+ "</style>\n",
2086
+ "<table border=\"1\" class=\"dataframe\">\n",
2087
+ " <thead>\n",
2088
+ " <tr style=\"text-align: right;\">\n",
2089
+ " <th></th>\n",
2090
+ " <th>record_number</th>\n",
2091
+ " <th>url</th>\n",
2092
+ " </tr>\n",
2093
+ " </thead>\n",
2094
+ " <tbody>\n",
2095
+ " <tr>\n",
2096
+ " <th>0</th>\n",
2097
+ " <td>4289223</td>\n",
2098
+ " <td>https://zenodo.org/record/4289223</td>\n",
2099
+ " </tr>\n",
2100
+ " <tr>\n",
2101
+ " <th>145</th>\n",
2102
+ " <td>4288311</td>\n",
2103
+ " <td>https://zenodo.org/record/4288311</td>\n",
2104
+ " </tr>\n",
2105
+ " </tbody>\n",
2106
+ "</table>\n",
2107
+ "</div>"
2108
+ ],
2109
+ "text/plain": [
2110
+ " record_number url\n",
2111
+ "0 4289223 https://zenodo.org/record/4289223\n",
2112
+ "145 4288311 https://zenodo.org/record/4288311"
2113
+ ]
2114
+ },
2115
+ "execution_count": 25,
2116
+ "metadata": {},
2117
+ "output_type": "execute_result"
2118
+ }
2119
+ ],
2120
+ "source": [
2121
+ "master_licenses.rename(columns = {\"zenodo_link\": \"url\"}, inplace = True)\n",
2122
+ "master_licenses.head(2)"
2123
+ ]
2124
+ },
2125
+ {
2126
+ "cell_type": "code",
2127
+ "execution_count": 26,
2128
+ "metadata": {},
2129
+ "outputs": [],
2130
+ "source": [
2131
+ "# Save to CSV to run through get licenses script\n",
2132
+ "master_licenses.to_csv(\"../metadata/master_licenses.csv\", index = False)"
2133
+ ]
2134
+ },
2135
+ {
2136
+ "cell_type": "markdown",
2137
+ "metadata": {},
2138
+ "source": [
2139
+ "## Make Heliconius Master Subset\n",
2140
+ "\n",
2141
+ "Now make the Heliconius master CSV, and check stats to update README."
2142
+ ]
2143
+ },
2144
+ {
2145
+ "cell_type": "code",
2146
+ "execution_count": 21,
2147
+ "metadata": {},
2148
+ "outputs": [
2149
+ {
2150
+ "data": {
2151
+ "text/plain": [
2152
+ "CAMID 10086\n",
2153
+ "X 29134\n",
2154
+ "Image_name 29134\n",
2155
+ "View 3\n",
2156
+ "zenodo_name 31\n",
2157
+ "zenodo_link 29\n",
2158
+ "Sequence 9008\n",
2159
+ "Taxonomic_Name 131\n",
2160
+ "Locality 471\n",
2161
+ "Sample_accession 1559\n",
2162
+ "Collected_by 12\n",
2163
+ "Other_ID 1865\n",
2164
+ "Date 773\n",
2165
+ "Dataset 7\n",
2166
+ "Store 121\n",
2167
+ "Brood 224\n",
2168
+ "Death_Date 79\n",
2169
+ "Cross_Type 30\n",
2170
+ "Stage 1\n",
2171
+ "Sex 3\n",
2172
+ "Unit_Type 4\n",
2173
+ "file_type 3\n",
2174
+ "record_number 29\n",
2175
+ "species 36\n",
2176
+ "subspecies 110\n",
2177
+ "genus 1\n",
2178
+ "file_url 29134\n",
2179
+ "hybrid_stat 2\n",
2180
+ "filename 29134\n",
2181
+ "filepath 29134\n",
2182
+ "md5 29134\n",
2183
+ "dtype: int64"
2184
+ ]
2185
+ },
2186
+ "execution_count": 21,
2187
+ "metadata": {},
2188
+ "output_type": "execute_result"
2189
+ }
2190
+ ],
2191
+ "source": [
2192
+ "heliconius_master = master.loc[master.genus.str.lower() == \"heliconius\"].copy()\n",
2193
+ "heliconius_master.nunique()"
2194
+ ]
2195
+ },
2196
+ {
2197
+ "cell_type": "code",
2198
+ "execution_count": 22,
2199
+ "metadata": {},
2200
+ "outputs": [
2201
+ {
2202
+ "data": {
2203
+ "text/plain": [
2204
+ "View\n",
2205
+ "dorsal 14202\n",
2206
+ "ventral 14135\n",
2207
+ "dorsal and ventral 18\n",
2208
+ "Name: count, dtype: int64"
2209
+ ]
2210
+ },
2211
+ "execution_count": 22,
2212
+ "metadata": {},
2213
+ "output_type": "execute_result"
2214
+ }
2215
+ ],
2216
+ "source": [
2217
+ "heliconius_master.View.value_counts()"
2218
+ ]
2219
+ },
2220
+ {
2221
+ "cell_type": "markdown",
2222
+ "metadata": {},
2223
+ "source": [
2224
+ "### Save Heliconius Subset to CSV"
2225
+ ]
2226
+ },
2227
+ {
2228
+ "cell_type": "code",
2229
+ "execution_count": 23,
2230
+ "metadata": {},
2231
+ "outputs": [],
2232
+ "source": [
2233
+ "heliconius_master.to_csv(\"../Jiggins_Heliconius_Master.csv\", index = False)"
2234
+ ]
2235
+ },
2236
+ {
2237
+ "cell_type": "markdown",
2238
+ "metadata": {},
2239
+ "source": [
2240
+ "## Make Dorsal Subset\n",
2241
+ "\n",
2242
+ "We'll now make a CSV of all dorsal images."
2243
+ ]
2244
+ },
2245
+ {
2246
+ "cell_type": "code",
2247
+ "execution_count": 24,
2248
+ "metadata": {},
2249
+ "outputs": [
2250
+ {
2251
+ "data": {
2252
+ "text/plain": [
2253
+ "CAMID 11746\n",
2254
+ "X 17748\n",
2255
+ "Image_name 17748\n",
2256
+ "View 4\n",
2257
+ "zenodo_name 31\n",
2258
+ "zenodo_link 29\n",
2259
+ "Sequence 10683\n",
2260
+ "Taxonomic_Name 358\n",
2261
+ "Locality 640\n",
2262
+ "Sample_accession 1552\n",
2263
+ "Collected_by 12\n",
2264
+ "Other_ID 2889\n",
2265
+ "Date 788\n",
2266
+ "Dataset 7\n",
2267
+ "Store 137\n",
2268
+ "Brood 215\n",
2269
+ "Death_Date 61\n",
2270
+ "Cross_Type 30\n",
2271
+ "Stage 1\n",
2272
+ "Sex 3\n",
2273
+ "Unit_Type 4\n",
2274
+ "file_type 3\n",
2275
+ "record_number 29\n",
2276
+ "species 241\n",
2277
+ "subspecies 152\n",
2278
+ "genus 92\n",
2279
+ "file_url 17748\n",
2280
+ "hybrid_stat 2\n",
2281
+ "filename 17748\n",
2282
+ "filepath 17748\n",
2283
+ "md5 17748\n",
2284
+ "dtype: int64"
2285
+ ]
2286
+ },
2287
+ "execution_count": 24,
2288
+ "metadata": {},
2289
+ "output_type": "execute_result"
2290
+ }
2291
+ ],
2292
+ "source": [
2293
+ "dorsal_views = [view for view in list(master.View.dropna().unique()) if \"dorsal\" in view]\n",
2294
+ "\n",
2295
+ "dorsal_master = master.loc[master[\"View\"].isin(dorsal_views)].copy()\n",
2296
+ "dorsal_master.nunique()"
2297
+ ]
2298
+ },
2299
+ {
2300
+ "cell_type": "code",
2301
+ "execution_count": 25,
2302
+ "metadata": {},
2303
+ "outputs": [
2304
+ {
2305
+ "data": {
2306
+ "text/plain": [
2307
+ "CAM_dupe\n",
2308
+ "False 15449\n",
2309
+ "True 2299\n",
2310
+ "Name: count, dtype: int64"
2311
+ ]
2312
+ },
2313
+ "execution_count": 25,
2314
+ "metadata": {},
2315
+ "output_type": "execute_result"
2316
+ }
2317
+ ],
2318
+ "source": [
2319
+ "dorsal_master[\"CAM_dupe\"] = dorsal_master.duplicated([\"CAMID\", \"file_type\"], keep = False)\n",
2320
+ "dorsal_master.CAM_dupe.value_counts()"
2321
+ ]
2322
+ },
2323
+ {
2324
+ "cell_type": "code",
2325
+ "execution_count": 26,
2326
+ "metadata": {},
2327
+ "outputs": [
2328
+ {
2329
+ "data": {
2330
+ "text/plain": [
2331
+ "CAM_dupe\n",
2332
+ "False 15431\n",
2333
+ "True 1793\n",
2334
+ "single-wing 506\n",
2335
+ "both-wings 18\n",
2336
+ "Name: count, dtype: int64"
2337
+ ]
2338
+ },
2339
+ "execution_count": 26,
2340
+ "metadata": {},
2341
+ "output_type": "execute_result"
2342
+ }
2343
+ ],
2344
+ "source": [
2345
+ "# Adding label for both wings alters counts, as in, some only have the double wing image\n",
2346
+ "dorsal_master.loc[dorsal_master[\"View\"].isin([\"forewing dorsal\", \"hindwing dorsal\"]), \"CAM_dupe\"] = \"single-wing\"\n",
2347
+ "dorsal_master.loc[dorsal_master[\"View\"] == \"dorsal and ventral\", \"CAM_dupe\"] = \"both-wings\"\n",
2348
+ "dorsal_master.CAM_dupe.value_counts()"
2349
+ ]
2350
+ },
2351
+ {
2352
+ "cell_type": "code",
2353
+ "execution_count": 27,
2354
+ "metadata": {},
2355
+ "outputs": [
2356
+ {
2357
+ "name": "stdout",
2358
+ "output_type": "stream",
2359
+ "text": [
2360
+ "881\n",
2361
+ "11446\n"
2362
+ ]
2363
+ },
2364
+ {
2365
+ "data": {
2366
+ "text/plain": [
2367
+ "13"
2368
+ ]
2369
+ },
2370
+ "execution_count": 27,
2371
+ "metadata": {},
2372
+ "output_type": "execute_result"
2373
+ }
2374
+ ],
2375
+ "source": [
2376
+ "print(dorsal_master.loc[dorsal_master[\"CAM_dupe\"] == True, \"CAMID\"].nunique())\n",
2377
+ "print(dorsal_master.loc[dorsal_master[\"CAM_dupe\"] == False, \"CAMID\"].nunique())\n",
2378
+ "dorsal_master.loc[dorsal_master[\"CAM_dupe\"] == True, \"record_number\"].nunique()"
2379
+ ]
2380
+ },
2381
+ {
2382
+ "cell_type": "code",
2383
+ "execution_count": 28,
2384
+ "metadata": {},
2385
+ "outputs": [
2386
+ {
2387
+ "data": {
2388
+ "text/plain": [
2389
+ "file_type\n",
2390
+ "raw 253\n",
2391
+ "jpg 253\n",
2392
+ "Name: count, dtype: int64"
2393
+ ]
2394
+ },
2395
+ "execution_count": 28,
2396
+ "metadata": {},
2397
+ "output_type": "execute_result"
2398
+ }
2399
+ ],
2400
+ "source": [
2401
+ "dorsal_master.loc[dorsal_master[\"CAM_dupe\"] == \"single-wing\", \"file_type\"].value_counts()"
2402
+ ]
2403
+ },
2404
+ {
2405
+ "cell_type": "code",
2406
+ "execution_count": 29,
2407
+ "metadata": {},
2408
+ "outputs": [
2409
+ {
2410
+ "data": {
2411
+ "text/plain": [
2412
+ "file_type\n",
2413
+ "jpg 17\n",
2414
+ "tif 1\n",
2415
+ "Name: count, dtype: int64"
2416
+ ]
2417
+ },
2418
+ "execution_count": 29,
2419
+ "metadata": {},
2420
+ "output_type": "execute_result"
2421
+ }
2422
+ ],
2423
+ "source": [
2424
+ "dorsal_master.loc[dorsal_master[\"CAM_dupe\"] == \"both-wings\", \"file_type\"].value_counts()"
2425
+ ]
2426
+ },
2427
+ {
2428
+ "cell_type": "code",
2429
+ "execution_count": 30,
2430
+ "metadata": {},
2431
+ "outputs": [
2432
+ {
2433
+ "data": {
2434
+ "text/plain": [
2435
+ "file_type\n",
2436
+ "jpg 1775\n",
2437
+ "tif 16\n",
2438
+ "raw 2\n",
2439
+ "Name: count, dtype: int64"
2440
+ ]
2441
+ },
2442
+ "execution_count": 30,
2443
+ "metadata": {},
2444
+ "output_type": "execute_result"
2445
+ }
2446
+ ],
2447
+ "source": [
2448
+ "dorsal_master.loc[dorsal_master[\"CAM_dupe\"] == True, \"file_type\"].value_counts()"
2449
+ ]
2450
+ },
2451
+ {
2452
+ "cell_type": "code",
2453
+ "execution_count": 31,
2454
+ "metadata": {},
2455
+ "outputs": [
2456
+ {
2457
+ "data": {
2458
+ "text/plain": [
2459
+ "file_type\n",
2460
+ "jpg 10700\n",
2461
+ "raw 4713\n",
2462
+ "tif 18\n",
2463
+ "Name: count, dtype: int64"
2464
+ ]
2465
+ },
2466
+ "execution_count": 31,
2467
+ "metadata": {},
2468
+ "output_type": "execute_result"
2469
+ }
2470
+ ],
2471
+ "source": [
2472
+ "dorsal_master.loc[dorsal_master[\"CAM_dupe\"] == False, \"file_type\"].value_counts()"
2473
+ ]
2474
+ },
2475
+ {
2476
+ "cell_type": "code",
2477
+ "execution_count": 32,
2478
+ "metadata": {},
2479
+ "outputs": [
2480
+ {
2481
+ "data": {
2482
+ "text/plain": [
2483
+ "False 10717\n",
2484
+ "True 2028\n",
2485
+ "Name: count, dtype: int64"
2486
+ ]
2487
+ },
2488
+ "execution_count": 32,
2489
+ "metadata": {},
2490
+ "output_type": "execute_result"
2491
+ }
2492
+ ],
2493
+ "source": [
2494
+ "dorsal_master.loc[dorsal_master[\"file_type\"] == \"jpg\"].duplicated(subset = \"CAMID\", keep = False).value_counts()"
2495
+ ]
2496
+ },
2497
+ {
2498
+ "cell_type": "code",
2499
+ "execution_count": 33,
2500
+ "metadata": {},
2501
+ "outputs": [
2502
+ {
2503
+ "data": {
2504
+ "text/plain": [
2505
+ "False 4714\n",
2506
+ "True 254\n",
2507
+ "Name: count, dtype: int64"
2508
+ ]
2509
+ },
2510
+ "execution_count": 33,
2511
+ "metadata": {},
2512
+ "output_type": "execute_result"
2513
+ }
2514
+ ],
2515
+ "source": [
2516
+ "dorsal_master.loc[dorsal_master[\"file_type\"] == \"raw\"].duplicated(subset = \"CAMID\", keep = False).value_counts()"
2517
+ ]
2518
+ },
2519
+ {
2520
+ "cell_type": "markdown",
2521
+ "metadata": {},
2522
+ "source": [
2523
+ "Generally speaking, it seems RAW images will be unique, as there is only one CAMID that gets duplicated across the raw images (2 photos of that specimen that are RAW) outside of the single wing views.\n",
2524
+ "\n",
2525
+ "### Save Dorsal Subset to CSV"
2526
+ ]
2527
+ },
2528
+ {
2529
+ "cell_type": "code",
2530
+ "execution_count": 34,
2531
+ "metadata": {},
2532
+ "outputs": [],
2533
+ "source": [
2534
+ "dorsal_master.to_csv(\"../Jiggins_Zenodo_dorsal_Img_Master.csv\", index = False)"
2535
+ ]
2536
+ },
2537
+ {
2538
+ "cell_type": "code",
2539
+ "execution_count": null,
2540
+ "metadata": {},
2541
+ "outputs": [],
2542
+ "source": []
2543
+ }
2544
+ ],
2545
+ "metadata": {
2546
+ "kernelspec": {
2547
+ "display_name": "std",
2548
+ "language": "python",
2549
+ "name": "python3"
2550
+ },
2551
+ "language_info": {
2552
+ "codemirror_mode": {
2553
+ "name": "ipython",
2554
+ "version": 3
2555
+ },
2556
+ "file_extension": ".py",
2557
+ "mimetype": "text/x-python",
2558
+ "name": "python",
2559
+ "nbconvert_exporter": "python",
2560
+ "pygments_lexer": "ipython3",
2561
+ "version": "3.11.3"
2562
+ }
2563
+ },
2564
+ "nbformat": 4,
2565
+ "nbformat_minor": 2
2566
+ }
notebooks/EDA-DL-0-1.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
notebooks/EDA-DL-0-2.ipynb ADDED
@@ -0,0 +1,843 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {},
7
+ "outputs": [],
8
+ "source": [
9
+ "import pandas as pd\n",
10
+ "import json"
11
+ ]
12
+ },
13
+ {
14
+ "cell_type": "code",
15
+ "execution_count": 2,
16
+ "metadata": {},
17
+ "outputs": [
18
+ {
19
+ "name": "stdout",
20
+ "output_type": "stream",
21
+ "text": [
22
+ "<class 'pandas.core.frame.DataFrame'>\n",
23
+ "RangeIndex: 50 entries, 0 to 49\n",
24
+ "Data columns (total 4 columns):\n",
25
+ " # Column Non-Null Count Dtype \n",
26
+ "--- ------ -------------- ----- \n",
27
+ " 0 File name 50 non-null object\n",
28
+ " 1 ID 49 non-null object\n",
29
+ " 2 Side 49 non-null object\n",
30
+ " 3 Unnamed: 3 49 non-null object\n",
31
+ "dtypes: object(4)\n",
32
+ "memory usage: 1.7+ KB\n"
33
+ ]
34
+ }
35
+ ],
36
+ "source": [
37
+ "# Record 4289223 is most of our initial 404s (ultimately just second most), \n",
38
+ "# looks like they align with 0.2.rachel.blow.mel.tim.ikiam.csv, so we'll check\n",
39
+ "fof_df = pd.read_csv(\"../metadata/deduplication/Zenodo_meta_files/0.2.rachel.blow.mel.tim.ikiam.csv\", low_memory = False)\n",
40
+ "fof_df.info(show_counts=True)"
41
+ ]
42
+ },
43
+ {
44
+ "cell_type": "code",
45
+ "execution_count": 3,
46
+ "metadata": {},
47
+ "outputs": [
48
+ {
49
+ "data": {
50
+ "text/html": [
51
+ "<div>\n",
52
+ "<style scoped>\n",
53
+ " .dataframe tbody tr th:only-of-type {\n",
54
+ " vertical-align: middle;\n",
55
+ " }\n",
56
+ "\n",
57
+ " .dataframe tbody tr th {\n",
58
+ " vertical-align: top;\n",
59
+ " }\n",
60
+ "\n",
61
+ " .dataframe thead th {\n",
62
+ " text-align: right;\n",
63
+ " }\n",
64
+ "</style>\n",
65
+ "<table border=\"1\" class=\"dataframe\">\n",
66
+ " <thead>\n",
67
+ " <tr style=\"text-align: right;\">\n",
68
+ " <th></th>\n",
69
+ " <th>File name</th>\n",
70
+ " <th>ID</th>\n",
71
+ " <th>Side</th>\n",
72
+ " <th>Unnamed: 3</th>\n",
73
+ " </tr>\n",
74
+ " </thead>\n",
75
+ " <tbody>\n",
76
+ " <tr>\n",
77
+ " <th>0</th>\n",
78
+ " <td>CAM028501d.JPG</td>\n",
79
+ " <td>CAM028501</td>\n",
80
+ " <td>dorsal</td>\n",
81
+ " <td>d.JPG</td>\n",
82
+ " </tr>\n",
83
+ " <tr>\n",
84
+ " <th>1</th>\n",
85
+ " <td>CAM028501v.JPG</td>\n",
86
+ " <td>CAM028501</td>\n",
87
+ " <td>ventral</td>\n",
88
+ " <td>v.JPG</td>\n",
89
+ " </tr>\n",
90
+ " <tr>\n",
91
+ " <th>2</th>\n",
92
+ " <td>CAM028502d.JPG</td>\n",
93
+ " <td>CAM028502</td>\n",
94
+ " <td>dorsal</td>\n",
95
+ " <td>d.JPG</td>\n",
96
+ " </tr>\n",
97
+ " <tr>\n",
98
+ " <th>3</th>\n",
99
+ " <td>CAM028502v.JPG</td>\n",
100
+ " <td>CAM028502</td>\n",
101
+ " <td>ventral</td>\n",
102
+ " <td>v.JPG</td>\n",
103
+ " </tr>\n",
104
+ " <tr>\n",
105
+ " <th>4</th>\n",
106
+ " <td>CAM028503d.JPG</td>\n",
107
+ " <td>CAM028503</td>\n",
108
+ " <td>dorsal</td>\n",
109
+ " <td>d.JPG</td>\n",
110
+ " </tr>\n",
111
+ " </tbody>\n",
112
+ "</table>\n",
113
+ "</div>"
114
+ ],
115
+ "text/plain": [
116
+ " File name ID Side Unnamed: 3\n",
117
+ "0 CAM028501d.JPG CAM028501 dorsal d.JPG\n",
118
+ "1 CAM028501v.JPG CAM028501 ventral v.JPG\n",
119
+ "2 CAM028502d.JPG CAM028502 dorsal d.JPG\n",
120
+ "3 CAM028502v.JPG CAM028502 ventral v.JPG\n",
121
+ "4 CAM028503d.JPG CAM028503 dorsal d.JPG"
122
+ ]
123
+ },
124
+ "execution_count": 3,
125
+ "metadata": {},
126
+ "output_type": "execute_result"
127
+ }
128
+ ],
129
+ "source": [
130
+ "fof_df.head()"
131
+ ]
132
+ },
133
+ {
134
+ "cell_type": "markdown",
135
+ "metadata": {},
136
+ "source": [
137
+ "These don't have a URL, but it could be reconstructed from the record number. Let's check if these are the files that had the 404 error from that record."
138
+ ]
139
+ },
140
+ {
141
+ "cell_type": "code",
142
+ "execution_count": 4,
143
+ "metadata": {},
144
+ "outputs": [
145
+ {
146
+ "data": {
147
+ "text/html": [
148
+ "<div>\n",
149
+ "<style scoped>\n",
150
+ " .dataframe tbody tr th:only-of-type {\n",
151
+ " vertical-align: middle;\n",
152
+ " }\n",
153
+ "\n",
154
+ " .dataframe tbody tr th {\n",
155
+ " vertical-align: top;\n",
156
+ " }\n",
157
+ "\n",
158
+ " .dataframe thead th {\n",
159
+ " text-align: right;\n",
160
+ " }\n",
161
+ "</style>\n",
162
+ "<table border=\"1\" class=\"dataframe\">\n",
163
+ " <thead>\n",
164
+ " <tr style=\"text-align: right;\">\n",
165
+ " <th></th>\n",
166
+ " <th>Image</th>\n",
167
+ " <th>file_url</th>\n",
168
+ " <th>record_number</th>\n",
169
+ " <th>dataset</th>\n",
170
+ " <th>CAMID</th>\n",
171
+ " <th>Response_status</th>\n",
172
+ " </tr>\n",
173
+ " </thead>\n",
174
+ " <tbody>\n",
175
+ " <tr>\n",
176
+ " <th>0</th>\n",
177
+ " <td>Heliconius melpomene ssp. plesseni x malleti/5...</td>\n",
178
+ " <td>https://zenodo.org/record/3082688/files/CAM017...</td>\n",
179
+ " <td>3082688</td>\n",
180
+ " <td>Patricio Salazar</td>\n",
181
+ " <td>CAM017505</td>\n",
182
+ " <td>404</td>\n",
183
+ " </tr>\n",
184
+ " <tr>\n",
185
+ " <th>1</th>\n",
186
+ " <td>Heliconius erato ssp. notabilis x lativitta/54...</td>\n",
187
+ " <td>https://zenodo.org/record/3082688/files/CAM017...</td>\n",
188
+ " <td>3082688</td>\n",
189
+ " <td>Patricio Salazar</td>\n",
190
+ " <td>CAM017693</td>\n",
191
+ " <td>404</td>\n",
192
+ " </tr>\n",
193
+ " <tr>\n",
194
+ " <th>2</th>\n",
195
+ " <td>Heliconius erato ssp. notabilis x lativitta/55...</td>\n",
196
+ " <td>https://zenodo.org/record/3082688/files/CAM017...</td>\n",
197
+ " <td>3082688</td>\n",
198
+ " <td>Patricio Salazar</td>\n",
199
+ " <td>CAM017821</td>\n",
200
+ " <td>404</td>\n",
201
+ " </tr>\n",
202
+ " <tr>\n",
203
+ " <th>3</th>\n",
204
+ " <td>Heliconius melpomene ssp. plesseni x malleti/1...</td>\n",
205
+ " <td>https://zenodo.org/record/1748277/files/CAM017...</td>\n",
206
+ " <td>1748277</td>\n",
207
+ " <td>Patricio Salazar</td>\n",
208
+ " <td>CAM017932</td>\n",
209
+ " <td>404</td>\n",
210
+ " </tr>\n",
211
+ " <tr>\n",
212
+ " <th>4</th>\n",
213
+ " <td>Heliconius melpomene ssp. plesseni x malleti/1...</td>\n",
214
+ " <td>https://zenodo.org/record/1748277/files/CAM017...</td>\n",
215
+ " <td>1748277</td>\n",
216
+ " <td>Patricio Salazar</td>\n",
217
+ " <td>CAM017971</td>\n",
218
+ " <td>404</td>\n",
219
+ " </tr>\n",
220
+ " </tbody>\n",
221
+ "</table>\n",
222
+ "</div>"
223
+ ],
224
+ "text/plain": [
225
+ " Image \\\n",
226
+ "0 Heliconius melpomene ssp. plesseni x malleti/5... \n",
227
+ "1 Heliconius erato ssp. notabilis x lativitta/54... \n",
228
+ "2 Heliconius erato ssp. notabilis x lativitta/55... \n",
229
+ "3 Heliconius melpomene ssp. plesseni x malleti/1... \n",
230
+ "4 Heliconius melpomene ssp. plesseni x malleti/1... \n",
231
+ "\n",
232
+ " file_url record_number \\\n",
233
+ "0 https://zenodo.org/record/3082688/files/CAM017... 3082688 \n",
234
+ "1 https://zenodo.org/record/3082688/files/CAM017... 3082688 \n",
235
+ "2 https://zenodo.org/record/3082688/files/CAM017... 3082688 \n",
236
+ "3 https://zenodo.org/record/1748277/files/CAM017... 1748277 \n",
237
+ "4 https://zenodo.org/record/1748277/files/CAM017... 1748277 \n",
238
+ "\n",
239
+ " dataset CAMID Response_status \n",
240
+ "0 Patricio Salazar CAM017505 404 \n",
241
+ "1 Patricio Salazar CAM017693 404 \n",
242
+ "2 Patricio Salazar CAM017821 404 \n",
243
+ "3 Patricio Salazar CAM017932 404 \n",
244
+ "4 Patricio Salazar CAM017971 404 "
245
+ ]
246
+ },
247
+ "execution_count": 4,
248
+ "metadata": {},
249
+ "output_type": "execute_result"
250
+ }
251
+ ],
252
+ "source": [
253
+ "ERROR_PATH = \"../metadata/deduplication/Jiggins_Zenodo_Img_Master_3477891Patch_error_log_(readable).json\"\n",
254
+ "with open(ERROR_PATH, \"r\") as error_file:\n",
255
+ " errors = json.loads(error_file.read())\n",
256
+ "\n",
257
+ "error_df = pd.DataFrame(data = errors)\n",
258
+ "error_df.head()"
259
+ ]
260
+ },
261
+ {
262
+ "cell_type": "code",
263
+ "execution_count": 5,
264
+ "metadata": {},
265
+ "outputs": [
266
+ {
267
+ "name": "stdout",
268
+ "output_type": "stream",
269
+ "text": [
270
+ "23\n",
271
+ "0\n"
272
+ ]
273
+ }
274
+ ],
275
+ "source": [
276
+ "rec_4289223_df = error_df.loc[error_df[\"record_number\"] == \"4289223\"]\n",
277
+ "\n",
278
+ "missing_camids = []\n",
279
+ "for camid in list(rec_4289223_df[\"CAMID\"].unique()):\n",
280
+ " if camid not in list(fof_df.ID):\n",
281
+ " missing_camids.append(camid)\n",
282
+ "\n",
283
+ "print(rec_4289223_df.CAMID.nunique())\n",
284
+ "print(len(missing_camids))"
285
+ ]
286
+ },
287
+ {
288
+ "cell_type": "markdown",
289
+ "metadata": {},
290
+ "source": [
291
+ "Looks like they're all captured in this CSV, so we can check their URLs?"
292
+ ]
293
+ },
294
+ {
295
+ "cell_type": "code",
296
+ "execution_count": 6,
297
+ "metadata": {},
298
+ "outputs": [
299
+ {
300
+ "data": {
301
+ "text/plain": [
302
+ "['https://zenodo.org/record/4289223/files/CAM028509v.JPG',\n",
303
+ " 'https://zenodo.org/record/4289223/files/CAM028504d.JPG',\n",
304
+ " 'https://zenodo.org/record/4289223/files/CAM028508v.JPG',\n",
305
+ " 'https://zenodo.org/record/4289223/files/CAM028509d.JPG',\n",
306
+ " 'https://zenodo.org/record/4289223/files/CAM028502v.JPG',\n",
307
+ " 'https://zenodo.org/record/4289223/files/CAM028513v.CR2',\n",
308
+ " 'https://zenodo.org/record/4289223/files/CAM028514d.JPG']"
309
+ ]
310
+ },
311
+ "execution_count": 6,
312
+ "metadata": {},
313
+ "output_type": "execute_result"
314
+ }
315
+ ],
316
+ "source": [
317
+ "list(rec_4289223_df.file_url.sample(7))"
318
+ ]
319
+ },
320
+ {
321
+ "cell_type": "markdown",
322
+ "metadata": {},
323
+ "source": [
324
+ "These are listed in the CSV, but do not show up on the [record page](https://zenodo.org/records/4289223)."
325
+ ]
326
+ },
327
+ {
328
+ "cell_type": "markdown",
329
+ "metadata": {},
330
+ "source": [
331
+ "We saw in `EDA-DL-0-1.ipynb` that none of the error images were in the multimedia file from record 3477891, so we don't have a clear patch. All error records were saved to a CSV through that notebook."
332
+ ]
333
+ },
334
+ {
335
+ "cell_type": "code",
336
+ "execution_count": 7,
337
+ "metadata": {},
338
+ "outputs": [
339
+ {
340
+ "name": "stdout",
341
+ "output_type": "stream",
342
+ "text": [
343
+ "Index(['Image', 'file_url', 'record_number', 'dataset', 'CAMID',\n",
344
+ " 'Response_status', 'filename', 'view'],\n",
345
+ " dtype='object')\n"
346
+ ]
347
+ }
348
+ ],
349
+ "source": [
350
+ "error_df = pd.read_csv(\"../metadata/deduplication/Jiggins_Zenodo_Img_Master_3477891Patch_error_log.csv\", low_memory = False)\n",
351
+ "print(error_df.columns)\n",
352
+ "\n",
353
+ "master = pd.read_csv(\"../metadata/Jiggins_Zenodo_Img_Master_3477891Patch.csv\", low_memory = False)"
354
+ ]
355
+ },
356
+ {
357
+ "cell_type": "code",
358
+ "execution_count": 8,
359
+ "metadata": {},
360
+ "outputs": [
361
+ {
362
+ "data": {
363
+ "text/html": [
364
+ "<div>\n",
365
+ "<style scoped>\n",
366
+ " .dataframe tbody tr th:only-of-type {\n",
367
+ " vertical-align: middle;\n",
368
+ " }\n",
369
+ "\n",
370
+ " .dataframe tbody tr th {\n",
371
+ " vertical-align: top;\n",
372
+ " }\n",
373
+ "\n",
374
+ " .dataframe thead th {\n",
375
+ " text-align: right;\n",
376
+ " }\n",
377
+ "</style>\n",
378
+ "<table border=\"1\" class=\"dataframe\">\n",
379
+ " <thead>\n",
380
+ " <tr style=\"text-align: right;\">\n",
381
+ " <th></th>\n",
382
+ " <th>Image</th>\n",
383
+ " <th>file_url</th>\n",
384
+ " <th>record_number</th>\n",
385
+ " <th>dataset</th>\n",
386
+ " <th>CAMID</th>\n",
387
+ " <th>Response_status</th>\n",
388
+ " <th>filename</th>\n",
389
+ " <th>view</th>\n",
390
+ " </tr>\n",
391
+ " </thead>\n",
392
+ " <tbody>\n",
393
+ " <tr>\n",
394
+ " <th>5</th>\n",
395
+ " <td>Heliconius melpomene ssp. malleti/14972_CAM028...</td>\n",
396
+ " <td>https://zenodo.org/record/4289223/files/CAM028...</td>\n",
397
+ " <td>4289223</td>\n",
398
+ " <td>Cambridge Collection</td>\n",
399
+ " <td>CAM028501</td>\n",
400
+ " <td>404</td>\n",
401
+ " <td>14972_CAM028501v.JPG</td>\n",
402
+ " <td>ventral</td>\n",
403
+ " </tr>\n",
404
+ " <tr>\n",
405
+ " <th>6</th>\n",
406
+ " <td>Heliconius melpomene ssp. malleti/14971_CAM028...</td>\n",
407
+ " <td>https://zenodo.org/record/4289223/files/CAM028...</td>\n",
408
+ " <td>4289223</td>\n",
409
+ " <td>Cambridge Collection</td>\n",
410
+ " <td>CAM028501</td>\n",
411
+ " <td>404</td>\n",
412
+ " <td>14971_CAM028501d.JPG</td>\n",
413
+ " <td>dorsal</td>\n",
414
+ " </tr>\n",
415
+ " <tr>\n",
416
+ " <th>7</th>\n",
417
+ " <td>Heliconius melpomene ssp. malleti/14973_CAM028...</td>\n",
418
+ " <td>https://zenodo.org/record/4289223/files/CAM028...</td>\n",
419
+ " <td>4289223</td>\n",
420
+ " <td>Cambridge Collection</td>\n",
421
+ " <td>CAM028502</td>\n",
422
+ " <td>404</td>\n",
423
+ " <td>14973_CAM028502d.JPG</td>\n",
424
+ " <td>dorsal</td>\n",
425
+ " </tr>\n",
426
+ " <tr>\n",
427
+ " <th>8</th>\n",
428
+ " <td>Heliconius melpomene ssp. malleti/14974_CAM028...</td>\n",
429
+ " <td>https://zenodo.org/record/4289223/files/CAM028...</td>\n",
430
+ " <td>4289223</td>\n",
431
+ " <td>Cambridge Collection</td>\n",
432
+ " <td>CAM028502</td>\n",
433
+ " <td>404</td>\n",
434
+ " <td>14974_CAM028502v.JPG</td>\n",
435
+ " <td>ventral</td>\n",
436
+ " </tr>\n",
437
+ " <tr>\n",
438
+ " <th>9</th>\n",
439
+ " <td>Heliconius melpomene ssp. plesseni/14975_CAM02...</td>\n",
440
+ " <td>https://zenodo.org/record/4289223/files/CAM028...</td>\n",
441
+ " <td>4289223</td>\n",
442
+ " <td>Cambridge Collection</td>\n",
443
+ " <td>CAM028503</td>\n",
444
+ " <td>404</td>\n",
445
+ " <td>14975_CAM028503d.JPG</td>\n",
446
+ " <td>dorsal</td>\n",
447
+ " </tr>\n",
448
+ " </tbody>\n",
449
+ "</table>\n",
450
+ "</div>"
451
+ ],
452
+ "text/plain": [
453
+ " Image \\\n",
454
+ "5 Heliconius melpomene ssp. malleti/14972_CAM028... \n",
455
+ "6 Heliconius melpomene ssp. malleti/14971_CAM028... \n",
456
+ "7 Heliconius melpomene ssp. malleti/14973_CAM028... \n",
457
+ "8 Heliconius melpomene ssp. malleti/14974_CAM028... \n",
458
+ "9 Heliconius melpomene ssp. plesseni/14975_CAM02... \n",
459
+ "\n",
460
+ " file_url record_number \\\n",
461
+ "5 https://zenodo.org/record/4289223/files/CAM028... 4289223 \n",
462
+ "6 https://zenodo.org/record/4289223/files/CAM028... 4289223 \n",
463
+ "7 https://zenodo.org/record/4289223/files/CAM028... 4289223 \n",
464
+ "8 https://zenodo.org/record/4289223/files/CAM028... 4289223 \n",
465
+ "9 https://zenodo.org/record/4289223/files/CAM028... 4289223 \n",
466
+ "\n",
467
+ " dataset CAMID Response_status filename \\\n",
468
+ "5 Cambridge Collection CAM028501 404 14972_CAM028501v.JPG \n",
469
+ "6 Cambridge Collection CAM028501 404 14971_CAM028501d.JPG \n",
470
+ "7 Cambridge Collection CAM028502 404 14973_CAM028502d.JPG \n",
471
+ "8 Cambridge Collection CAM028502 404 14974_CAM028502v.JPG \n",
472
+ "9 Cambridge Collection CAM028503 404 14975_CAM028503d.JPG \n",
473
+ "\n",
474
+ " view \n",
475
+ "5 ventral \n",
476
+ "6 dorsal \n",
477
+ "7 dorsal \n",
478
+ "8 ventral \n",
479
+ "9 dorsal "
480
+ ]
481
+ },
482
+ "execution_count": 8,
483
+ "metadata": {},
484
+ "output_type": "execute_result"
485
+ }
486
+ ],
487
+ "source": [
488
+ "error_42 = error_df.loc[error_df[\"record_number\"] == 4289223].copy()\n",
489
+ "error_42.head()"
490
+ ]
491
+ },
492
+ {
493
+ "cell_type": "code",
494
+ "execution_count": 9,
495
+ "metadata": {},
496
+ "outputs": [],
497
+ "source": [
498
+ "def get_x(filename):\n",
499
+ " return int(filename.split(\"_\")[0])"
500
+ ]
501
+ },
502
+ {
503
+ "cell_type": "code",
504
+ "execution_count": 10,
505
+ "metadata": {},
506
+ "outputs": [
507
+ {
508
+ "data": {
509
+ "text/html": [
510
+ "<div>\n",
511
+ "<style scoped>\n",
512
+ " .dataframe tbody tr th:only-of-type {\n",
513
+ " vertical-align: middle;\n",
514
+ " }\n",
515
+ "\n",
516
+ " .dataframe tbody tr th {\n",
517
+ " vertical-align: top;\n",
518
+ " }\n",
519
+ "\n",
520
+ " .dataframe thead th {\n",
521
+ " text-align: right;\n",
522
+ " }\n",
523
+ "</style>\n",
524
+ "<table border=\"1\" class=\"dataframe\">\n",
525
+ " <thead>\n",
526
+ " <tr style=\"text-align: right;\">\n",
527
+ " <th></th>\n",
528
+ " <th>CAMID</th>\n",
529
+ " <th>X</th>\n",
530
+ " <th>Image_name</th>\n",
531
+ " <th>View</th>\n",
532
+ " <th>zenodo_name</th>\n",
533
+ " <th>zenodo_link</th>\n",
534
+ " <th>Sequence</th>\n",
535
+ " <th>Taxonomic_Name</th>\n",
536
+ " <th>Locality</th>\n",
537
+ " <th>Sample_accession</th>\n",
538
+ " <th>...</th>\n",
539
+ " <th>Stage</th>\n",
540
+ " <th>Sex</th>\n",
541
+ " <th>Unit_Type</th>\n",
542
+ " <th>file_type</th>\n",
543
+ " <th>record_number</th>\n",
544
+ " <th>species</th>\n",
545
+ " <th>subspecies</th>\n",
546
+ " <th>genus</th>\n",
547
+ " <th>file_url</th>\n",
548
+ " <th>hybrid_stat</th>\n",
549
+ " </tr>\n",
550
+ " </thead>\n",
551
+ " <tbody>\n",
552
+ " <tr>\n",
553
+ " <th>24194</th>\n",
554
+ " <td>CAM028501</td>\n",
555
+ " <td>14972</td>\n",
556
+ " <td>CAM028501v.JPG</td>\n",
557
+ " <td>ventral</td>\n",
558
+ " <td>0.2.rachel.blow.mel.tim.ikiam.csv</td>\n",
559
+ " <td>https://zenodo.org/record/4289223</td>\n",
560
+ " <td>28,501</td>\n",
561
+ " <td>Heliconius melpomene ssp. malleti</td>\n",
562
+ " <td>Río Pusuno</td>\n",
563
+ " <td>NaN</td>\n",
564
+ " <td>...</td>\n",
565
+ " <td>NaN</td>\n",
566
+ " <td>Male</td>\n",
567
+ " <td>Wild</td>\n",
568
+ " <td>jpg</td>\n",
569
+ " <td>4289223</td>\n",
570
+ " <td>Heliconius melpomene</td>\n",
571
+ " <td>malleti</td>\n",
572
+ " <td>Heliconius</td>\n",
573
+ " <td>https://zenodo.org/record/4289223/files/CAM028...</td>\n",
574
+ " <td>non-hybrid</td>\n",
575
+ " </tr>\n",
576
+ " <tr>\n",
577
+ " <th>24195</th>\n",
578
+ " <td>CAM028501</td>\n",
579
+ " <td>14971</td>\n",
580
+ " <td>CAM028501d.JPG</td>\n",
581
+ " <td>dorsal</td>\n",
582
+ " <td>0.2.rachel.blow.mel.tim.ikiam.csv</td>\n",
583
+ " <td>https://zenodo.org/record/4289223</td>\n",
584
+ " <td>28,501</td>\n",
585
+ " <td>Heliconius melpomene ssp. malleti</td>\n",
586
+ " <td>Río Pusuno</td>\n",
587
+ " <td>NaN</td>\n",
588
+ " <td>...</td>\n",
589
+ " <td>NaN</td>\n",
590
+ " <td>Male</td>\n",
591
+ " <td>Wild</td>\n",
592
+ " <td>jpg</td>\n",
593
+ " <td>4289223</td>\n",
594
+ " <td>Heliconius melpomene</td>\n",
595
+ " <td>malleti</td>\n",
596
+ " <td>Heliconius</td>\n",
597
+ " <td>https://zenodo.org/record/4289223/files/CAM028...</td>\n",
598
+ " <td>non-hybrid</td>\n",
599
+ " </tr>\n",
600
+ " <tr>\n",
601
+ " <th>24196</th>\n",
602
+ " <td>CAM028502</td>\n",
603
+ " <td>14973</td>\n",
604
+ " <td>CAM028502d.JPG</td>\n",
605
+ " <td>dorsal</td>\n",
606
+ " <td>0.2.rachel.blow.mel.tim.ikiam.csv</td>\n",
607
+ " <td>https://zenodo.org/record/4289223</td>\n",
608
+ " <td>28,502</td>\n",
609
+ " <td>Heliconius melpomene ssp. malleti</td>\n",
610
+ " <td>Río Pusuno</td>\n",
611
+ " <td>NaN</td>\n",
612
+ " <td>...</td>\n",
613
+ " <td>NaN</td>\n",
614
+ " <td>Male</td>\n",
615
+ " <td>Wild</td>\n",
616
+ " <td>jpg</td>\n",
617
+ " <td>4289223</td>\n",
618
+ " <td>Heliconius melpomene</td>\n",
619
+ " <td>malleti</td>\n",
620
+ " <td>Heliconius</td>\n",
621
+ " <td>https://zenodo.org/record/4289223/files/CAM028...</td>\n",
622
+ " <td>non-hybrid</td>\n",
623
+ " </tr>\n",
624
+ " <tr>\n",
625
+ " <th>24197</th>\n",
626
+ " <td>CAM028502</td>\n",
627
+ " <td>14974</td>\n",
628
+ " <td>CAM028502v.JPG</td>\n",
629
+ " <td>ventral</td>\n",
630
+ " <td>0.2.rachel.blow.mel.tim.ikiam.csv</td>\n",
631
+ " <td>https://zenodo.org/record/4289223</td>\n",
632
+ " <td>28,502</td>\n",
633
+ " <td>Heliconius melpomene ssp. malleti</td>\n",
634
+ " <td>Río Pusuno</td>\n",
635
+ " <td>NaN</td>\n",
636
+ " <td>...</td>\n",
637
+ " <td>NaN</td>\n",
638
+ " <td>Male</td>\n",
639
+ " <td>Wild</td>\n",
640
+ " <td>jpg</td>\n",
641
+ " <td>4289223</td>\n",
642
+ " <td>Heliconius melpomene</td>\n",
643
+ " <td>malleti</td>\n",
644
+ " <td>Heliconius</td>\n",
645
+ " <td>https://zenodo.org/record/4289223/files/CAM028...</td>\n",
646
+ " <td>non-hybrid</td>\n",
647
+ " </tr>\n",
648
+ " <tr>\n",
649
+ " <th>24198</th>\n",
650
+ " <td>CAM028503</td>\n",
651
+ " <td>14975</td>\n",
652
+ " <td>CAM028503d.JPG</td>\n",
653
+ " <td>dorsal</td>\n",
654
+ " <td>0.2.rachel.blow.mel.tim.ikiam.csv</td>\n",
655
+ " <td>https://zenodo.org/record/4289223</td>\n",
656
+ " <td>28,503</td>\n",
657
+ " <td>Heliconius melpomene ssp. plesseni</td>\n",
658
+ " <td>Huaymayaco</td>\n",
659
+ " <td>NaN</td>\n",
660
+ " <td>...</td>\n",
661
+ " <td>NaN</td>\n",
662
+ " <td>Male</td>\n",
663
+ " <td>Wild</td>\n",
664
+ " <td>jpg</td>\n",
665
+ " <td>4289223</td>\n",
666
+ " <td>Heliconius melpomene</td>\n",
667
+ " <td>plesseni</td>\n",
668
+ " <td>Heliconius</td>\n",
669
+ " <td>https://zenodo.org/record/4289223/files/CAM028...</td>\n",
670
+ " <td>non-hybrid</td>\n",
671
+ " </tr>\n",
672
+ " </tbody>\n",
673
+ "</table>\n",
674
+ "<p>5 rows × 28 columns</p>\n",
675
+ "</div>"
676
+ ],
677
+ "text/plain": [
678
+ " CAMID X Image_name View \\\n",
679
+ "24194 CAM028501 14972 CAM028501v.JPG ventral \n",
680
+ "24195 CAM028501 14971 CAM028501d.JPG dorsal \n",
681
+ "24196 CAM028502 14973 CAM028502d.JPG dorsal \n",
682
+ "24197 CAM028502 14974 CAM028502v.JPG ventral \n",
683
+ "24198 CAM028503 14975 CAM028503d.JPG dorsal \n",
684
+ "\n",
685
+ " zenodo_name zenodo_link \\\n",
686
+ "24194 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n",
687
+ "24195 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n",
688
+ "24196 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n",
689
+ "24197 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n",
690
+ "24198 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n",
691
+ "\n",
692
+ " Sequence Taxonomic_Name Locality \\\n",
693
+ "24194 28,501 Heliconius melpomene ssp. malleti Río Pusuno \n",
694
+ "24195 28,501 Heliconius melpomene ssp. malleti Río Pusuno \n",
695
+ "24196 28,502 Heliconius melpomene ssp. malleti Río Pusuno \n",
696
+ "24197 28,502 Heliconius melpomene ssp. malleti Río Pusuno \n",
697
+ "24198 28,503 Heliconius melpomene ssp. plesseni Huaymayaco \n",
698
+ "\n",
699
+ " Sample_accession ... Stage Sex Unit_Type file_type record_number \\\n",
700
+ "24194 NaN ... NaN Male Wild jpg 4289223 \n",
701
+ "24195 NaN ... NaN Male Wild jpg 4289223 \n",
702
+ "24196 NaN ... NaN Male Wild jpg 4289223 \n",
703
+ "24197 NaN ... NaN Male Wild jpg 4289223 \n",
704
+ "24198 NaN ... NaN Male Wild jpg 4289223 \n",
705
+ "\n",
706
+ " species subspecies genus \\\n",
707
+ "24194 Heliconius melpomene malleti Heliconius \n",
708
+ "24195 Heliconius melpomene malleti Heliconius \n",
709
+ "24196 Heliconius melpomene malleti Heliconius \n",
710
+ "24197 Heliconius melpomene malleti Heliconius \n",
711
+ "24198 Heliconius melpomene plesseni Heliconius \n",
712
+ "\n",
713
+ " file_url hybrid_stat \n",
714
+ "24194 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n",
715
+ "24195 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n",
716
+ "24196 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n",
717
+ "24197 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n",
718
+ "24198 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n",
719
+ "\n",
720
+ "[5 rows x 28 columns]"
721
+ ]
722
+ },
723
+ "execution_count": 10,
724
+ "metadata": {},
725
+ "output_type": "execute_result"
726
+ }
727
+ ],
728
+ "source": [
729
+ "error_42[\"X\"] = error_42[\"filename\"].apply(get_x)\n",
730
+ "\n",
731
+ "master_42 = master.loc[master[\"X\"].isin(list(error_42[\"X\"]))].copy()\n",
732
+ "master_42.head()"
733
+ ]
734
+ },
735
+ {
736
+ "cell_type": "code",
737
+ "execution_count": 11,
738
+ "metadata": {},
739
+ "outputs": [
740
+ {
741
+ "data": {
742
+ "text/html": [
743
+ "<div>\n",
744
+ "<style scoped>\n",
745
+ " .dataframe tbody tr th:only-of-type {\n",
746
+ " vertical-align: middle;\n",
747
+ " }\n",
748
+ "\n",
749
+ " .dataframe tbody tr th {\n",
750
+ " vertical-align: top;\n",
751
+ " }\n",
752
+ "\n",
753
+ " .dataframe thead th {\n",
754
+ " text-align: right;\n",
755
+ " }\n",
756
+ "</style>\n",
757
+ "<table border=\"1\" class=\"dataframe\">\n",
758
+ " <thead>\n",
759
+ " <tr style=\"text-align: right;\">\n",
760
+ " <th></th>\n",
761
+ " <th>CAMID</th>\n",
762
+ " <th>X</th>\n",
763
+ " <th>Image_name</th>\n",
764
+ " <th>View</th>\n",
765
+ " <th>zenodo_name</th>\n",
766
+ " <th>zenodo_link</th>\n",
767
+ " <th>Sequence</th>\n",
768
+ " <th>Taxonomic_Name</th>\n",
769
+ " <th>Locality</th>\n",
770
+ " <th>Sample_accession</th>\n",
771
+ " <th>...</th>\n",
772
+ " <th>Stage</th>\n",
773
+ " <th>Sex</th>\n",
774
+ " <th>Unit_Type</th>\n",
775
+ " <th>file_type</th>\n",
776
+ " <th>record_number</th>\n",
777
+ " <th>species</th>\n",
778
+ " <th>subspecies</th>\n",
779
+ " <th>genus</th>\n",
780
+ " <th>file_url</th>\n",
781
+ " <th>hybrid_stat</th>\n",
782
+ " </tr>\n",
783
+ " </thead>\n",
784
+ " <tbody>\n",
785
+ " </tbody>\n",
786
+ "</table>\n",
787
+ "<p>0 rows × 28 columns</p>\n",
788
+ "</div>"
789
+ ],
790
+ "text/plain": [
791
+ "Empty DataFrame\n",
792
+ "Columns: [CAMID, X, Image_name, View, zenodo_name, zenodo_link, Sequence, Taxonomic_Name, Locality, Sample_accession, Collected_by, Other_ID, Date, Dataset, Store, Brood, Death_Date, Cross_Type, Stage, Sex, Unit_Type, file_type, record_number, species, subspecies, genus, file_url, hybrid_stat]\n",
793
+ "Index: []\n",
794
+ "\n",
795
+ "[0 rows x 28 columns]"
796
+ ]
797
+ },
798
+ "execution_count": 11,
799
+ "metadata": {},
800
+ "output_type": "execute_result"
801
+ }
802
+ ],
803
+ "source": [
804
+ "master.loc[(master[\"Image_name\"].isin(list(master_42.Image_name.unique()))) & (~master[\"record_number\"] == 4289223)]"
805
+ ]
806
+ },
807
+ {
808
+ "cell_type": "markdown",
809
+ "metadata": {},
810
+ "source": [
811
+ "Can't align these elsewhere based on `Image_name` either."
812
+ ]
813
+ },
814
+ {
815
+ "cell_type": "code",
816
+ "execution_count": null,
817
+ "metadata": {},
818
+ "outputs": [],
819
+ "source": []
820
+ }
821
+ ],
822
+ "metadata": {
823
+ "kernelspec": {
824
+ "display_name": "std",
825
+ "language": "python",
826
+ "name": "python3"
827
+ },
828
+ "language_info": {
829
+ "codemirror_mode": {
830
+ "name": "ipython",
831
+ "version": 3
832
+ },
833
+ "file_extension": ".py",
834
+ "mimetype": "text/x-python",
835
+ "name": "python",
836
+ "nbconvert_exporter": "python",
837
+ "pygments_lexer": "ipython3",
838
+ "version": "3.11.3"
839
+ }
840
+ },
841
+ "nbformat": 4,
842
+ "nbformat_minor": 2
843
+ }
notebooks/EDA-DL-0-3.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
scripts/download_jiggins_subset.py CHANGED
@@ -1,7 +1,11 @@
1
- # Modified code from https://huggingface.co/datasets/imageomics/Comparison-Subset-Jiggins/blob/main/scripts/download_jiggins_subset.py
2
- # For downloading Jiggins images from any of the master CSV files
3
- # Generates Checksum file for all images download
4
- # logs image download in json file
 
 
 
 
5
 
6
  import requests
7
  import shutil
@@ -12,9 +16,26 @@ from checksum import get_checksums
12
 
13
  from tqdm import tqdm
14
  import os
 
 
15
  import argparse
16
 
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  def parse_args():
19
  parser = argparse.ArgumentParser()
20
  parser.add_argument("--csv", required=True, help="Path to CSV file with urls.", nargs="?")
@@ -23,52 +44,122 @@ def parse_args():
23
  return parser.parse_args()
24
 
25
 
26
- def update_log(log_data, index, image, url, response_code):
27
  # log status
28
  log_entry = {}
29
  log_entry["Image"] = image
30
- log_entry["zenodo_link"] = url
31
- log_entry["Response_status"] = response_code
 
 
 
32
  log_data[index] = log_entry
33
 
34
  return log_data
35
 
36
 
37
- def download_images(csv_path, image_folder, log_filepath):
38
- #load csv
39
- jiggins_data = pd.read_csv(csv_path)
 
 
 
 
 
40
  log_data = {}
 
41
 
42
  for i in tqdm(range(0, len(jiggins_data))) :
 
43
  species = jiggins_data["Taxonomic_Name"][i]
44
  image_name = jiggins_data["X"][i].astype(str) + "_" + jiggins_data["Image_name"][i]
 
45
 
46
- #download the image from url is not already downloaded
 
47
  if os.path.exists(f"{image_folder}/{species}/{image_name}") != True:
48
  #get image from url
49
- url = jiggins_data["zenodo_link"][i]
50
- response = requests.get(url, stream=True)
51
-
52
- # log status
53
- log_data = update_log(log_data,
54
- index = i,
55
- image = species + "/" + image_name,
56
- url = url,
57
- response_code = response.status_code
58
- )
59
-
60
- #create the species appropriate folder if necessary
61
- if os.path.exists(f"{image_folder}/{species}") != True:
62
- os.makedirs(f"{image_folder}/{species}", exist_ok=False)
63
 
64
  #download the image
65
- if response.status_code == 200:
66
- with open(f"{image_folder}/{species}/{image_name}", "wb") as out_file:
67
- shutil.copyfileobj(response.raw, out_file)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  del response
69
 
70
- with open(log_filepath, "w") as log_file:
71
- json.dump(log_data, log_file, indent = 4)
 
 
72
 
73
  return
74
 
@@ -79,20 +170,32 @@ def main():
79
  csv_path = args.csv #path to our csv with urls to download images from
80
  image_folder = args.output #folder where dataset will be downloaded to
81
 
82
- # log file location
83
  log_filepath = csv_path.split(".")[0] + "_log.json"
 
 
 
 
 
 
 
 
 
 
 
 
84
 
85
  #dowload images from urls
86
- download_images(csv_path, image_folder, log_filepath)
87
 
88
  # generate checksums and save CSV to same folder as CSV used for download
89
  checksum_path = csv_path.split(".")[0] + "_checksums.csv"
90
  get_checksums(image_folder, checksum_path)
91
 
92
  print(f"Images downloaded from {csv_path} to {image_folder}.")
93
- print(f"Checksums recorded in {checksum_path} and download log is in {log_filepath}.")
94
 
95
  return
96
 
97
  if __name__ == "__main__":
98
- main()
 
1
+ # Built on Michelle's download script: https://huggingface.co/datasets/imageomics/Comparison-Subset-Jiggins/blob/977a934e1eef18f6b6152da430ac83ba6f7bd30f/download_jiggins_subset.py
2
+ # with modification of David's redo loop: https://github.com/Imageomics/data-fwg/blob/anomaly-data-challenge/HDR-anomaly-data-challenge/notebooks/download_images.ipynb
3
+ # and expanded logging and file checks. Further added checksum calculation for all downloaded images at end.
4
+
5
+ # Script to download Jiggins images from any of the master CSV files.
6
+ # Generates Checksum file for all images downloaded (<master filename>_checksums.csv).
7
+ # Logs image downloads and failures in json files (<master filename>_log.json & <master filename>_error_log.json).
8
+ # Logs record numbers and response codes as strings, not int64.
9
 
10
  import requests
11
  import shutil
 
16
 
17
  from tqdm import tqdm
18
  import os
19
+ import sys
20
+ import time
21
  import argparse
22
 
23
 
24
+ EXPECTED_COLS = ["CAMID",
25
+ "X",
26
+ "Image_name",
27
+ "file_url",
28
+ "Taxonomic_Name",
29
+ "record_number",
30
+ "Dataset"
31
+ ]
32
+
33
+ REDO_CODE_LIST = [429, 500, 502, 503, 504]
34
+
35
+ # Reset to appropriate index if download gets interrupted.
36
+ STARTING_INDEX = 0
37
+
38
+
39
  def parse_args():
40
  parser = argparse.ArgumentParser()
41
  parser.add_argument("--csv", required=True, help="Path to CSV file with urls.", nargs="?")
 
44
  return parser.parse_args()
45
 
46
 
47
+ def log_response(log_data, index, image, url, record_number, dataset, cam_id, response_code):
48
  # log status
49
  log_entry = {}
50
  log_entry["Image"] = image
51
+ log_entry["file_url"] = url
52
+ log_entry["record_number"] = str(record_number) #int64 has problems sometimes
53
+ log_entry["dataset"] = dataset
54
+ log_entry["CAMID"] = cam_id
55
+ log_entry["Response_status"] = str(response_code)
56
  log_data[index] = log_entry
57
 
58
  return log_data
59
 
60
 
61
+ def update_log(log, index, filepath):
62
+ # save logs
63
+ with open(filepath, "a") as log_file:
64
+ json.dump(log[index], log_file, indent = 4)
65
+ log_file.write("\n")
66
+
67
+
68
+ def download_images(jiggins_data, image_folder, log_filepath, error_log_filepath):
69
  log_data = {}
70
+ log_errors = {}
71
 
72
  for i in tqdm(range(0, len(jiggins_data))) :
73
+ # species will really be <Genus> <species> ssp. <subspecies>, where subspecies indicated
74
  species = jiggins_data["Taxonomic_Name"][i]
75
  image_name = jiggins_data["X"][i].astype(str) + "_" + jiggins_data["Image_name"][i]
76
+ record_number = jiggins_data["record_number"][i]
77
 
78
+ # download the image from url if not already downloaded
79
+ # Will attempt to download everything in CSV (image_name is unique: <X>_<Image_name>), unless download restarted
80
  if os.path.exists(f"{image_folder}/{species}/{image_name}") != True:
81
  #get image from url
82
+ url = jiggins_data["file_url"][i]
83
+ dataset = jiggins_data["Dataset"][i]
84
+ cam_id = jiggins_data["CAMID"][i]
 
 
 
 
 
 
 
 
 
 
 
85
 
86
  #download the image
87
+ redo = True
88
+ max_redos = 2
89
+ while redo and max_redos > 0:
90
+ try:
91
+ response = requests.get(url, stream=True)
92
+ except Exception as e:
93
+ redo = True
94
+ max_redos -= 1
95
+ if max_redos <= 0:
96
+ log_errors = log_response(log_errors,
97
+ index = i,
98
+ image = species + "/" + image_name,
99
+ url = url,
100
+ record_number = record_number,
101
+ dataset = dataset,
102
+ cam_id = cam_id,
103
+ response_code = str(e))
104
+ update_log(log = log_errors, index = i, filepath = error_log_filepath)
105
+
106
+ if response.status_code == 200:
107
+ redo = False
108
+ # log status
109
+ log_data = log_response(log_data,
110
+ index = i,
111
+ image = species + "/" + image_name,
112
+ url = url,
113
+ record_number = record_number,
114
+ dataset = dataset,
115
+ cam_id = cam_id,
116
+ response_code = response.status_code
117
+ )
118
+ update_log(log = log_data, index = i, filepath = log_filepath)
119
+
120
+ #create the species appropriate folder if necessary
121
+ if os.path.exists(f"{image_folder}/{species}") != True:
122
+ os.makedirs(f"{image_folder}/{species}", exist_ok=False)
123
+
124
+ # save image to appropriate folder
125
+ with open(f"{image_folder}/{species}/{image_name}", "wb") as out_file:
126
+ shutil.copyfileobj(response.raw, out_file)
127
+
128
+ # check for too many requests
129
+ elif response.status_code in REDO_CODE_LIST:
130
+ redo = True
131
+ max_redos -= 1
132
+ if max_redos <= 0:
133
+ log_errors = log_response(log_errors,
134
+ index = i,
135
+ image = species + "/" + image_name,
136
+ url = url,
137
+ record_number = record_number,
138
+ dataset = dataset,
139
+ cam_id = cam_id,
140
+ response_code = response.status_code)
141
+ update_log(log = log_errors, index = i, filepath = error_log_filepath)
142
+
143
+ else:
144
+ time.sleep(1)
145
+ else: #other fail, eg. 404
146
+ redo = False
147
+ log_errors = log_response(log_errors,
148
+ index = i,
149
+ image = species + "/" + image_name,
150
+ url = url,
151
+ record_number = record_number,
152
+ dataset = dataset,
153
+ cam_id = cam_id,
154
+ response_code = response.status_code)
155
+ update_log(log = log_errors, index = i, filepath = error_log_filepath)
156
+
157
  del response
158
 
159
+ else:
160
+ if i > STARTING_INDEX:
161
+ # No need to print if download is restarted due to interruption (set STARTING_INDEX accordingly).
162
+ print(f"duplicate image: {jiggins_data['X']}, {jiggins_data['Image_name']}, from record {record_number}")
163
 
164
  return
165
 
 
170
  csv_path = args.csv #path to our csv with urls to download images from
171
  image_folder = args.output #folder where dataset will be downloaded to
172
 
173
+ # log file location (folder of source CSV)
174
  log_filepath = csv_path.split(".")[0] + "_log.json"
175
+ error_log_filepath = csv_path.split(".")[0] + "_error_log.json"
176
+
177
+ #load csv
178
+ jiggins_data = pd.read_csv(csv_path, low_memory = False)
179
+
180
+ # Check for required columns
181
+ missing_cols = []
182
+ for col in EXPECTED_COLS:
183
+ if col not in list(jiggins_data.columns):
184
+ missing_cols.append(col)
185
+ if len(missing_cols) > 0:
186
+ sys.exit(f"The CSV is missing column(s): {missing_cols}")
187
 
188
  #dowload images from urls
189
+ download_images(jiggins_data, image_folder, log_filepath, error_log_filepath)
190
 
191
  # generate checksums and save CSV to same folder as CSV used for download
192
  checksum_path = csv_path.split(".")[0] + "_checksums.csv"
193
  get_checksums(image_folder, checksum_path)
194
 
195
  print(f"Images downloaded from {csv_path} to {image_folder}.")
196
+ print(f"Checksums recorded in {checksum_path} and download logs are in {log_filepath} and {error_log_filepath}.")
197
 
198
  return
199
 
200
  if __name__ == "__main__":
201
+ main()