{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import json" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(42143, 3)" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "checksums = pd.read_csv(\"../metadata/Jiggins_Zenodo_Img_Master_3477891Patch_checksums.csv\", low_memory=False)\n", "checksums.shape" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[{'Image': 'Heliconius melpomene ssp. plesseni x malleti/5213_CAM017505_v.JPG',\n", " 'file_url': 'https://zenodo.org/record/3082688/files/CAM017505_v.JPG',\n", " 'record_number': '3082688',\n", " 'dataset': 'Patricio Salazar',\n", " 'CAMID': 'CAM017505',\n", " 'Response_status': '404'},\n", " {'Image': 'Heliconius erato ssp. notabilis x lativitta/5450_CAM017693_d.JPG',\n", " 'file_url': 'https://zenodo.org/record/3082688/files/CAM017693_d.JPG',\n", " 'record_number': '3082688',\n", " 'dataset': 'Patricio Salazar',\n", " 'CAMID': 'CAM017693',\n", " 'Response_status': '404'},\n", " {'Image': 'Heliconius erato ssp. notabilis x lativitta/5589_CAM017821_d.JPG',\n", " 'file_url': 'https://zenodo.org/record/3082688/files/CAM017821_d.JPG',\n", " 'record_number': '3082688',\n", " 'dataset': 'Patricio Salazar',\n", " 'CAMID': 'CAM017821',\n", " 'Response_status': '404'},\n", " {'Image': 'Heliconius melpomene ssp. plesseni x malleti/16983_CAM017932_v_whitestandard.JPG',\n", " 'file_url': 'https://zenodo.org/record/1748277/files/CAM017932_v_whitestandard.JPG',\n", " 'record_number': '1748277',\n", " 'dataset': 'Patricio Salazar',\n", " 'CAMID': 'CAM017932',\n", " 'Response_status': '404'},\n", " {'Image': 'Heliconius melpomene ssp. plesseni x malleti/17136_CAM017971_d_whitestandard.CR2',\n", " 'file_url': 'https://zenodo.org/record/1748277/files/CAM017971_d_whitestandard.CR2',\n", " 'record_number': '1748277',\n", " 'dataset': 'Patricio Salazar',\n", " 'CAMID': 'CAM017971',\n", " 'Response_status': '404'}]" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ERROR_PATH = \"../metadata/Jiggins_Zenodo_Img_Master_3477891Patch_error_log_(readable).json\"\n", "with open(ERROR_PATH, \"r\") as error_file:\n", " errors = json.loads(error_file.read())\n", "errors[:5]" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Imagefile_urlrecord_numberdatasetCAMIDResponse_status
0Heliconius melpomene ssp. plesseni x malleti/5...https://zenodo.org/record/3082688/files/CAM017...3082688Patricio SalazarCAM017505404
1Heliconius erato ssp. notabilis x lativitta/54...https://zenodo.org/record/3082688/files/CAM017...3082688Patricio SalazarCAM017693404
2Heliconius erato ssp. notabilis x lativitta/55...https://zenodo.org/record/3082688/files/CAM017...3082688Patricio SalazarCAM017821404
3Heliconius melpomene ssp. plesseni x malleti/1...https://zenodo.org/record/1748277/files/CAM017...1748277Patricio SalazarCAM017932404
4Heliconius melpomene ssp. plesseni x malleti/1...https://zenodo.org/record/1748277/files/CAM017...1748277Patricio SalazarCAM017971404
\n", "
" ], "text/plain": [ " Image \\\n", "0 Heliconius melpomene ssp. plesseni x malleti/5... \n", "1 Heliconius erato ssp. notabilis x lativitta/54... \n", "2 Heliconius erato ssp. notabilis x lativitta/55... \n", "3 Heliconius melpomene ssp. plesseni x malleti/1... \n", "4 Heliconius melpomene ssp. plesseni x malleti/1... \n", "\n", " file_url record_number \\\n", "0 https://zenodo.org/record/3082688/files/CAM017... 3082688 \n", "1 https://zenodo.org/record/3082688/files/CAM017... 3082688 \n", "2 https://zenodo.org/record/3082688/files/CAM017... 3082688 \n", "3 https://zenodo.org/record/1748277/files/CAM017... 1748277 \n", "4 https://zenodo.org/record/1748277/files/CAM017... 1748277 \n", "\n", " dataset CAMID Response_status \n", "0 Patricio Salazar CAM017505 404 \n", "1 Patricio Salazar CAM017693 404 \n", "2 Patricio Salazar CAM017821 404 \n", "3 Patricio Salazar CAM017932 404 \n", "4 Patricio Salazar CAM017971 404 " ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "error_df = pd.DataFrame(data = errors)\n", "error_df.head()" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Image 2666\n", "file_url 2666\n", "record_number 7\n", "dataset 3\n", "CAMID 612\n", "Response_status 1\n", "dtype: int64" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "error_df.nunique()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "These are all 404 Errors concentrated in 7 Records." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(2725, 6)" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "error_df.shape" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We have some duplicated from the earlier round (we had 59 recorded in `second_Jiggins_Zenodo_Img_Master_3477891Patch_error_log.csv`); the way the download script was written it didn't ignore previous errors when we had to restart it, so let's check on the duplicated full entries before looking at full numbers (though 2666 is the full number of failed URLs).\n", "\n", "Our total number of expected images is 44809, so when we remove the errors (2666), we'd exepct 42143 images, which is the count in our image folder (measured in `checksums`)." ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Image 2666\n", "file_url 2666\n", "record_number 7\n", "dataset 3\n", "CAMID 612\n", "Response_status 1\n", "dtype: int64" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "error_df[\"dupe_errors\"] = error_df.duplicated(subset = list(error_df.columns), keep = \"first\")\n", "\n", "error_df = error_df.loc[~error_df[\"dupe_errors\"]]\n", "error_df = error_df[list(error_df.columns)[:-1]]\n", "error_df.nunique()" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(2666, 6)" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "error_df.shape" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "record_number\n", "4287444 2600\n", "4289223 47\n", "4288250 7\n", "5561246 6\n", "3082688 3\n", "1748277 2\n", "2813153 1\n", "Name: count, dtype: int64" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "error_df.record_number.value_counts()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "404 errors are concentrated in [record 42389223](https://zenodo.org/records/4289223) and [record 4287444](https://zenodo.org/records/4287444)." ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Imagefile_urlrecord_numberdatasetCAMIDResponse_status
50Heliconius timareta ssp. timareta/15017_CAM028...https://zenodo.org/record/4289223/files/CAM028...4289223Cambridge CollectionCAM028523404
42Heliconius melpomene ssp. malleti/15009_CAM028...https://zenodo.org/record/4289223/files/CAM028...4289223Cambridge CollectionCAM028519404
37Heliconius melpomene ssp. malleti/15003_CAM028...https://zenodo.org/record/4289223/files/CAM028...4289223Cambridge CollectionCAM028516404
51Heliconius timareta ssp. timareta/15016_CAM028...https://zenodo.org/record/4289223/files/CAM028...4289223Cambridge CollectionCAM028523404
8Heliconius melpomene ssp. malleti/14974_CAM028...https://zenodo.org/record/4289223/files/CAM028...4289223Cambridge CollectionCAM028502404
\n", "
" ], "text/plain": [ " Image \\\n", "50 Heliconius timareta ssp. timareta/15017_CAM028... \n", "42 Heliconius melpomene ssp. malleti/15009_CAM028... \n", "37 Heliconius melpomene ssp. malleti/15003_CAM028... \n", "51 Heliconius timareta ssp. timareta/15016_CAM028... \n", "8 Heliconius melpomene ssp. malleti/14974_CAM028... \n", "\n", " file_url record_number \\\n", "50 https://zenodo.org/record/4289223/files/CAM028... 4289223 \n", "42 https://zenodo.org/record/4289223/files/CAM028... 4289223 \n", "37 https://zenodo.org/record/4289223/files/CAM028... 4289223 \n", "51 https://zenodo.org/record/4289223/files/CAM028... 4289223 \n", "8 https://zenodo.org/record/4289223/files/CAM028... 4289223 \n", "\n", " dataset CAMID Response_status \n", "50 Cambridge Collection CAM028523 404 \n", "42 Cambridge Collection CAM028519 404 \n", "37 Cambridge Collection CAM028516 404 \n", "51 Cambridge Collection CAM028523 404 \n", "8 Cambridge Collection CAM028502 404 " ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "error_df.loc[error_df[\"record_number\"] == \"4289223\"].sample(5)" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Image 47\n", "file_url 47\n", "record_number 1\n", "dataset 1\n", "CAMID 23\n", "Response_status 1\n", "dtype: int64" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "error_df.loc[error_df[\"record_number\"] == \"4289223\"].nunique()" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'Heliconius melpomene ssp. malleti/14972_CAM028501v.JPG'" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "error_df.loc[error_df[\"record_number\"] == \"4289223\", \"Image\"].values[0]" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array(['CAM028501', 'CAM028502', 'CAM028503', 'CAM028504', 'CAM028505',\n", " 'CAM028506', 'CAM028507', 'CAM028508', 'CAM028509', 'CAM028510',\n", " 'CAM028511', 'CAM028512', 'CAM028513', 'CAM028514', 'CAM028515',\n", " 'CAM028516', 'CAM028517', 'CAM028518', 'CAM028519', 'CAM028520',\n", " 'CAM028521', 'CAM028522', 'CAM028523'], dtype=object)" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "error_df.loc[error_df[\"record_number\"] == \"4289223\", \"CAMID\"].unique()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "It seems like these might be from [0.2.rachel.blow.mel.tim.ikiam.csv](https://zenodo.org/records/4289223/files/0.2.rachel.blow.mel.tim.ikiam.csv?download=1)." ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Imagefile_urlrecord_numberdatasetCAMIDResponse_status
880Eunica pusilla/32902_CAM044045_v.JPGhttps://zenodo.org/record/4287444/files/CAM044...4287444NaNCAM044045404
1184Caligo eurilochus/33209_CAM044119_fwv.CR2https://zenodo.org/record/4287444/files/CAM044...4287444NaNCAM044119404
974Pyrrhogyra edocia/32997_CAM044071_v.CR2https://zenodo.org/record/4287444/files/CAM044...4287444NaNCAM044071404
1659Memphis mora/33722_CAM044260_v.JPGhttps://zenodo.org/record/4287444/files/CAM044...4287444Heliconiine Butterfly Collection Records from ...CAM044260404
1845Archaeoprepona demophon/33909_CAM044311_v.CR2https://zenodo.org/record/4287444/files/CAM044...4287444Heliconiine Butterfly Collection Records from ...CAM044311404
\n", "
" ], "text/plain": [ " Image \\\n", "880 Eunica pusilla/32902_CAM044045_v.JPG \n", "1184 Caligo eurilochus/33209_CAM044119_fwv.CR2 \n", "974 Pyrrhogyra edocia/32997_CAM044071_v.CR2 \n", "1659 Memphis mora/33722_CAM044260_v.JPG \n", "1845 Archaeoprepona demophon/33909_CAM044311_v.CR2 \n", "\n", " file_url record_number \\\n", "880 https://zenodo.org/record/4287444/files/CAM044... 4287444 \n", "1184 https://zenodo.org/record/4287444/files/CAM044... 4287444 \n", "974 https://zenodo.org/record/4287444/files/CAM044... 4287444 \n", "1659 https://zenodo.org/record/4287444/files/CAM044... 4287444 \n", "1845 https://zenodo.org/record/4287444/files/CAM044... 4287444 \n", "\n", " dataset CAMID \\\n", "880 NaN CAM044045 \n", "1184 NaN CAM044119 \n", "974 NaN CAM044071 \n", "1659 Heliconiine Butterfly Collection Records from ... CAM044260 \n", "1845 Heliconiine Butterfly Collection Records from ... CAM044311 \n", "\n", " Response_status \n", "880 404 \n", "1184 404 \n", "974 404 \n", "1659 404 \n", "1845 404 " ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "error_df.loc[error_df[\"record_number\"] == \"4287444\"].sample(5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We have some RAW files in this record (likely each has a raw and a jpg version). This is the vast majority of our 404s.\n", "\n", "These don't see to actaully be in the [record](https://zenodo.org/records/4287444) though." ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Image 2600\n", "file_url 2600\n", "record_number 1\n", "dataset 1\n", "CAMID 579\n", "Response_status 1\n", "dtype: int64" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "error_df.loc[error_df[\"record_number\"] == \"4287444\"].nunique()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Is it possible some of these were recorded as part of this \"batch 2\" but are actually from batch 1 and that's why they're not there? \n", "\n", "Let's check the meta file `batch2.Peru.image.names.Zenodo.xlsx` (opened in Numbers and exported to CSV first, dropped `Zenodo` from name)." ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
File nameIDSideUnnamed: 3Unnamed: 4
0CAM043500_d.CR2CAM043500dorsalNaNNaN
1CAM043500_d.JPGCAM043500dorsalNaNNaN
2CAM043500_v.CR2CAM043500ventralNaNNaN
3CAM043500_v.JPGCAM043500ventralNaNNaN
4CAM043502_d.CR2CAM043502dorsalNaNNaN
\n", "
" ], "text/plain": [ " File name ID Side Unnamed: 3 Unnamed: 4\n", "0 CAM043500_d.CR2 CAM043500 dorsal NaN NaN\n", "1 CAM043500_d.JPG CAM043500 dorsal NaN NaN\n", "2 CAM043500_v.CR2 CAM043500 ventral NaN NaN\n", "3 CAM043500_v.JPG CAM043500 ventral NaN NaN\n", "4 CAM043502_d.CR2 CAM043502 dorsal NaN NaN" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "rec_4287444 = pd.read_csv(\"../metadata/Zenodo_meta_files/batch2.Peru.image.names.csv\", low_memory = True)\n", "rec_4287444.head()" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 3924 entries, 0 to 3923\n", "Data columns (total 3 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 File name 3924 non-null object\n", " 1 ID 3924 non-null object\n", " 2 Side 3924 non-null object\n", "dtypes: object(3)\n", "memory usage: 92.1+ KB\n", "None\n" ] }, { "data": { "text/plain": [ "File name 3924\n", "ID 880\n", "Side 6\n", "dtype: int64" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "rec_4287444 = rec_4287444[list(rec_4287444.columns)[:3]]\n", "print(rec_4287444.info(show_counts=True))\n", "rec_4287444.nunique()" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
File nameIDSide
2848CAM044260_d.CR2CAM044260dorsal
2849CAM044260_d.JPGCAM044260dorsal
2850CAM044260_v.CR2CAM044260ventral
2851CAM044260_v.JPGCAM044260ventral
\n", "
" ], "text/plain": [ " File name ID Side\n", "2848 CAM044260_d.CR2 CAM044260 dorsal\n", "2849 CAM044260_d.JPG CAM044260 dorsal\n", "2850 CAM044260_v.CR2 CAM044260 ventral\n", "2851 CAM044260_v.JPG CAM044260 ventral" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "rec_4287444.loc[rec_4287444[\"ID\"] == \"CAM044260\"]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Clear check that `CAM044260_v.JPG` exists as a file in the metadata, but it isn't actually in the files of the Zenodo record." ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
filepathfilenamemd5
0images/Eresia eunice/30847_CAM043490_d.CR230847_CAM043490_d.CR2d8827750eebd70652d3e5fb9e3957bfa
1images/Eresia eunice/35854_CAM044114_v.JPG35854_CAM044114_v.JPG46a4abed9e88709b10a0257fc1d89e59
2images/Eresia eunice/36158_CAM044195_v.JPG36158_CAM044195_v.JPGa61633734b2478de40e5f554c266b700
3images/Eresia eunice/30849_CAM043490_v.CR230849_CAM043490_v.CR2c998c4d5b5cadcd788f7847c3bdd9aec
4images/Eresia eunice/36157_CAM044195_v.CR236157_CAM044195_v.CR24876c7e954e6990a5541be6a2cea32a1
\n", "
" ], "text/plain": [ " filepath filename \\\n", "0 images/Eresia eunice/30847_CAM043490_d.CR2 30847_CAM043490_d.CR2 \n", "1 images/Eresia eunice/35854_CAM044114_v.JPG 35854_CAM044114_v.JPG \n", "2 images/Eresia eunice/36158_CAM044195_v.JPG 36158_CAM044195_v.JPG \n", "3 images/Eresia eunice/30849_CAM043490_v.CR2 30849_CAM043490_v.CR2 \n", "4 images/Eresia eunice/36157_CAM044195_v.CR2 36157_CAM044195_v.CR2 \n", "\n", " md5 \n", "0 d8827750eebd70652d3e5fb9e3957bfa \n", "1 46a4abed9e88709b10a0257fc1d89e59 \n", "2 a61633734b2478de40e5f554c266b700 \n", "3 c998c4d5b5cadcd788f7847c3bdd9aec \n", "4 4876c7e954e6990a5541be6a2cea32a1 " ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "checksums.head()" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [], "source": [ "def get_filename(image_path):\n", " return image_path.split(\"/\")[1]\n", "\n", "error_df[\"filename\"] = error_df[\"Image\"].apply(get_filename)" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "2666" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "missing_filenames = []\n", "\n", "for filename in list(error_df.filename.unique()):\n", " if filename not in list(checksums.filename.unique()):\n", " missing_filenames.append(filename)\n", "\n", "len(missing_filenames)" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [], "source": [ "def get_camid(filename):\n", " return filename.split(\"_\")[1]\n", "\n", "checksums[\"CAMID\"] = checksums[\"filename\"].apply(get_camid)" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "view\n", "dorsal 20955\n", "ventral 20880\n", "unknown 308\n", "Name: count, dtype: int64" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "def get_view(filename):\n", " if \"v\" in filename:\n", " return \"ventral\"\n", " elif \"d\" in filename:\n", " return \"dorsal\"\n", " else:\n", " return \"unknown\"\n", "\n", "checksums[\"view\"] = checksums[\"filename\"].apply(get_view)\n", "checksums.view.value_counts()" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "view\n", "dorsal 1334\n", "ventral 1332\n", "Name: count, dtype: int64" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "error_df[\"view\"] = error_df[\"filename\"].apply(get_view)\n", "error_df.view.value_counts()" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "We have 23 missing CAMIDs\n", "We have 0 missing sides among CAMIDs that are included\n" ] } ], "source": [ "missing_camids = []\n", "missing_sides = []\n", "\n", "for id in list(error_df.CAMID.unique()):\n", " if id not in list(checksums.CAMID.unique()):\n", " missing_camids.append(id)\n", " else:\n", " checksums_temp_views = (checksums.loc[checksums[\"CAMID\"] == id, \"view\"].unique())\n", " error_temp_views = list(error_df.loc[error_df[\"CAMID\"] == id, \"view\"].unique())\n", " for view in error_temp_views:\n", " if view not in checksums_temp_views:\n", " missing_sides.append(id + \"_\" + view)\n", "\n", "print(f\"We have {len(missing_camids)} missing CAMIDs\")\n", "print(f\"We have {len(missing_sides)} missing sides among CAMIDs that are included\")" ] }, { "cell_type": "code", "execution_count": 31, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['CAM028501',\n", " 'CAM028502',\n", " 'CAM028503',\n", " 'CAM028504',\n", " 'CAM028505',\n", " 'CAM028506',\n", " 'CAM028507',\n", " 'CAM028508',\n", " 'CAM028509',\n", " 'CAM028510',\n", " 'CAM028511',\n", " 'CAM028512',\n", " 'CAM028513',\n", " 'CAM028514',\n", " 'CAM028515',\n", " 'CAM028516',\n", " 'CAM028517',\n", " 'CAM028518',\n", " 'CAM028519',\n", " 'CAM028520',\n", " 'CAM028521',\n", " 'CAM028522',\n", " 'CAM028523']" ] }, "execution_count": 31, "metadata": {}, "output_type": "execute_result" } ], "source": [ "missing_camids" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "None of these appear to be in [record 4287444](https://zenodo.org/records/4287444)...Let's see if they're in the master file under any other records..." ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [], "source": [ "master = pd.read_csv(\"../Jiggins_Zenodo_Img_Master_3477891Patch.csv\", low_memory = False)" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "record_number\n", "4289223 24\n", "Name: count, dtype: int64" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "missing_cam_master = master.loc[master[\"CAMID\"].isin(missing_camids)]\n", "missing_cam_master = missing_cam_master.loc[missing_cam_master.duplicated(\"CAMID\", keep = \"first\")]\n", "\n", "missing_cam_master[\"record_number\"].value_counts()" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [], "source": [ "# how are there 24??\n", "for camid in list(missing_cam_master.CAMID):\n", " if camid not in missing_camids:\n", " print(camid)\n", "\n", "for camid in missing_camids:\n", " if camid not in list(missing_cam_master.CAMID):\n", " print(\"missing not in master\", camid)" ] }, { "cell_type": "code", "execution_count": 38, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
CAMIDXImage_nameViewzenodo_namezenodo_linkSequenceTaxonomic_NameLocalitySample_accession...StageSexUnit_Typefile_typerecord_numberspeciessubspeciesgenusfile_urlhybrid_stat
24195CAM02850114971CAM028501d.JPGdorsal0.2.rachel.blow.mel.tim.ikiam.csvhttps://zenodo.org/record/428922328,501Heliconius melpomene ssp. malletiRío PusunoNaN...NaNMaleWildjpg4289223Heliconius melpomenemalletiHeliconiushttps://zenodo.org/record/4289223/files/CAM028...non-hybrid
24197CAM02850214974CAM028502v.JPGventral0.2.rachel.blow.mel.tim.ikiam.csvhttps://zenodo.org/record/428922328,502Heliconius melpomene ssp. malletiRío PusunoNaN...NaNMaleWildjpg4289223Heliconius melpomenemalletiHeliconiushttps://zenodo.org/record/4289223/files/CAM028...non-hybrid
24199CAM02850314976CAM028503v.JPGventral0.2.rachel.blow.mel.tim.ikiam.csvhttps://zenodo.org/record/428922328,503Heliconius melpomene ssp. plesseniHuaymayacoNaN...NaNMaleWildjpg4289223Heliconius melpomeneplesseniHeliconiushttps://zenodo.org/record/4289223/files/CAM028...non-hybrid
24201CAM02850414978CAM028504v.JPGventral0.2.rachel.blow.mel.tim.ikiam.csvhttps://zenodo.org/record/428922328,504Heliconius melpomene ssp. plesseniHuaymayacoNaN...NaNMaleWildjpg4289223Heliconius melpomeneplesseniHeliconiushttps://zenodo.org/record/4289223/files/CAM028...non-hybrid
24203CAM02850514979CAM028505d.JPGdorsal0.2.rachel.blow.mel.tim.ikiam.csvhttps://zenodo.org/record/428922328,505Heliconius melpomene ssp. plesseniHuaymayacoNaN...NaNMaleWildjpg4289223Heliconius melpomeneplesseniHeliconiushttps://zenodo.org/record/4289223/files/CAM028...non-hybrid
24205CAM02850614982CAM028506v.JPGventral0.2.rachel.blow.mel.tim.ikiam.csvhttps://zenodo.org/record/428922328,506Heliconius erato ssp. notabilisHuaymayacoNaN...NaNMaleWildjpg4289223Heliconius eratonotabilisHeliconiushttps://zenodo.org/record/4289223/files/CAM028...non-hybrid
24207CAM02850714984CAM028507v.JPGventral0.2.rachel.blow.mel.tim.ikiam.csvhttps://zenodo.org/record/428922328,507Heliconius timareta ssp. timaretaHuaymayacoNaN...NaNMaleWildjpg4289223Heliconius timaretatimaretaHeliconiushttps://zenodo.org/record/4289223/files/CAM028...non-hybrid
24209CAM02850814986CAM028508v.JPGventral0.2.rachel.blow.mel.tim.ikiam.csvhttps://zenodo.org/record/428922328,508Heliconius melpomene ssp. plesseniHuaymayacoNaN...NaNMaleWildjpg4289223Heliconius melpomeneplesseniHeliconiushttps://zenodo.org/record/4289223/files/CAM028...non-hybrid
24211CAM02850914988CAM028509v.JPGventral0.2.rachel.blow.mel.tim.ikiam.csvhttps://zenodo.org/record/428922328,509Heliconius melpomene ssp. plesseniHuaymayacoNaN...NaNMaleWildjpg4289223Heliconius melpomeneplesseniHeliconiushttps://zenodo.org/record/4289223/files/CAM028...non-hybrid
24213CAM02851014990CAM028510v.JPGventral0.2.rachel.blow.mel.tim.ikiam.csvhttps://zenodo.org/record/428922328,510Heliconius melpomene ssp. plesseniHuaymayacoNaN...NaNMaleWildjpg4289223Heliconius melpomeneplesseniHeliconiushttps://zenodo.org/record/4289223/files/CAM028...non-hybrid
24215CAM02851114991CAM028511d.JPGdorsal0.2.rachel.blow.mel.tim.ikiam.csvhttps://zenodo.org/record/428922328,511Heliconius melpomene ssp. plesseniHuaymayacoNaN...NaNMaleWildjpg4289223Heliconius melpomeneplesseniHeliconiushttps://zenodo.org/record/4289223/files/CAM028...non-hybrid
24217CAM02851214993CAM028512d.JPGdorsal0.2.rachel.blow.mel.tim.ikiam.csvhttps://zenodo.org/record/428922328,512Heliconius melpomene ssp. plesseniHuaymayacoNaN...NaNMaleWildjpg4289223Heliconius melpomeneplesseniHeliconiushttps://zenodo.org/record/4289223/files/CAM028...non-hybrid
24219CAM02851314997CAM028513v.JPGventral0.2.rachel.blow.mel.tim.ikiam.csvhttps://zenodo.org/record/428922328,513Heliconius melpomene ssp. plesseniHuaymayacoNaN...NaNMaleWildjpg4289223Heliconius melpomeneplesseniHeliconiushttps://zenodo.org/record/4289223/files/CAM028...non-hybrid
24220CAM02851314995CAM028513d.JPGdorsal0.2.rachel.blow.mel.tim.ikiam.csvhttps://zenodo.org/record/428922328,513Heliconius melpomene ssp. plesseniHuaymayacoNaN...NaNMaleWildjpg4289223Heliconius melpomeneplesseniHeliconiushttps://zenodo.org/record/4289223/files/CAM028...non-hybrid
24222CAM02851414998CAM028514d.JPGdorsal0.2.rachel.blow.mel.tim.ikiam.csvhttps://zenodo.org/record/428922328,514Heliconius melpomene ssp. malletiReserva Narupa, bridgeNaN...NaNMaleWildjpg4289223Heliconius melpomenemalletiHeliconiushttps://zenodo.org/record/4289223/files/CAM028...non-hybrid
24224CAM02851515000CAM028515d.JPGdorsal0.2.rachel.blow.mel.tim.ikiam.csvhttps://zenodo.org/record/428922328,515Heliconius elevatus ssp. willmottiRío PusunoNaN...NaNMaleWildjpg4289223Heliconius elevatuswillmottiHeliconiushttps://zenodo.org/record/4289223/files/CAM028...non-hybrid
24226CAM02851615003CAM028516v.JPGventral0.2.rachel.blow.mel.tim.ikiam.csvhttps://zenodo.org/record/428922328,516Heliconius melpomene ssp. malletiReserva Narupa, bridgeNaN...NaNMaleWildjpg4289223Heliconius melpomenemalletiHeliconiushttps://zenodo.org/record/4289223/files/CAM028...non-hybrid
24228CAM02851715005CAM028517v.JPGventral0.2.rachel.blow.mel.tim.ikiam.csvhttps://zenodo.org/record/428922328,517Heliconius timareta ssp. ssp.nov.PReserva Narupa, bridgeNaN...NaNMaleWildjpg4289223Heliconius timaretassp.nov.PHeliconiushttps://zenodo.org/record/4289223/files/CAM028...non-hybrid
24230CAM02851815006CAM028518d.JPGdorsal0.2.rachel.blow.mel.tim.ikiam.csvhttps://zenodo.org/record/428922328,518Heliconius melpomene ssp. malletiReserva Narupa, bridgeNaN...NaNMaleWildjpg4289223Heliconius melpomenemalletiHeliconiushttps://zenodo.org/record/4289223/files/CAM028...non-hybrid
24232CAM02851915008CAM028519d.JPGdorsal0.2.rachel.blow.mel.tim.ikiam.csvhttps://zenodo.org/record/428922328,519Heliconius melpomene ssp. malletiShitigNaN...NaNMaleWildjpg4289223Heliconius melpomenemalletiHeliconiushttps://zenodo.org/record/4289223/files/CAM028...non-hybrid
24234CAM02852015011CAM028520v.JPGventral0.2.rachel.blow.mel.tim.ikiam.csvhttps://zenodo.org/record/428922328,520Heliconius timareta ssp. ssp.nov.PReserva Narupa, bridgeNaN...NaNMaleWildjpg4289223Heliconius timaretassp.nov.PHeliconiushttps://zenodo.org/record/4289223/files/CAM028...non-hybrid
24236CAM02852115012CAM028521d.JPGdorsal0.2.rachel.blow.mel.tim.ikiam.csvhttps://zenodo.org/record/428922328,521Heliconius melpomene ssp. plesseniHuaymayacoNaN...NaNFemaleWildjpg4289223Heliconius melpomeneplesseniHeliconiushttps://zenodo.org/record/4289223/files/CAM028...non-hybrid
24238CAM02852215015CAM028522v.JPGventral0.2.rachel.blow.mel.tim.ikiam.csvhttps://zenodo.org/record/428922328,522Heliconius timareta ssp. timaretaHuaymayacoNaN...NaNFemaleWildjpg4289223Heliconius timaretatimaretaHeliconiushttps://zenodo.org/record/4289223/files/CAM028...non-hybrid
24240CAM02852315016CAM028523d.JPGdorsal0.2.rachel.blow.mel.tim.ikiam.csvhttps://zenodo.org/record/428922328,523Heliconius timareta ssp. timaretaHuaymayacoNaN...NaNFemaleWildjpg4289223Heliconius timaretatimaretaHeliconiushttps://zenodo.org/record/4289223/files/CAM028...non-hybrid
\n", "

24 rows × 28 columns

\n", "
" ], "text/plain": [ " CAMID X Image_name View \\\n", "24195 CAM028501 14971 CAM028501d.JPG dorsal \n", "24197 CAM028502 14974 CAM028502v.JPG ventral \n", "24199 CAM028503 14976 CAM028503v.JPG ventral \n", "24201 CAM028504 14978 CAM028504v.JPG ventral \n", "24203 CAM028505 14979 CAM028505d.JPG dorsal \n", "24205 CAM028506 14982 CAM028506v.JPG ventral \n", "24207 CAM028507 14984 CAM028507v.JPG ventral \n", "24209 CAM028508 14986 CAM028508v.JPG ventral \n", "24211 CAM028509 14988 CAM028509v.JPG ventral \n", "24213 CAM028510 14990 CAM028510v.JPG ventral \n", "24215 CAM028511 14991 CAM028511d.JPG dorsal \n", "24217 CAM028512 14993 CAM028512d.JPG dorsal \n", "24219 CAM028513 14997 CAM028513v.JPG ventral \n", "24220 CAM028513 14995 CAM028513d.JPG dorsal \n", "24222 CAM028514 14998 CAM028514d.JPG dorsal \n", "24224 CAM028515 15000 CAM028515d.JPG dorsal \n", "24226 CAM028516 15003 CAM028516v.JPG ventral \n", "24228 CAM028517 15005 CAM028517v.JPG ventral \n", "24230 CAM028518 15006 CAM028518d.JPG dorsal \n", "24232 CAM028519 15008 CAM028519d.JPG dorsal \n", "24234 CAM028520 15011 CAM028520v.JPG ventral \n", "24236 CAM028521 15012 CAM028521d.JPG dorsal \n", "24238 CAM028522 15015 CAM028522v.JPG ventral \n", "24240 CAM028523 15016 CAM028523d.JPG dorsal \n", "\n", " zenodo_name zenodo_link \\\n", "24195 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n", "24197 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n", "24199 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n", "24201 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n", "24203 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n", "24205 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n", "24207 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n", "24209 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n", "24211 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n", "24213 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n", "24215 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n", "24217 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n", "24219 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n", "24220 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n", "24222 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n", "24224 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n", "24226 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n", "24228 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n", "24230 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n", "24232 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n", "24234 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n", "24236 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n", "24238 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n", "24240 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n", "\n", " Sequence Taxonomic_Name Locality \\\n", "24195 28,501 Heliconius melpomene ssp. malleti Río Pusuno \n", "24197 28,502 Heliconius melpomene ssp. malleti Río Pusuno \n", "24199 28,503 Heliconius melpomene ssp. plesseni Huaymayaco \n", "24201 28,504 Heliconius melpomene ssp. plesseni Huaymayaco \n", "24203 28,505 Heliconius melpomene ssp. plesseni Huaymayaco \n", "24205 28,506 Heliconius erato ssp. notabilis Huaymayaco \n", "24207 28,507 Heliconius timareta ssp. timareta Huaymayaco \n", "24209 28,508 Heliconius melpomene ssp. plesseni Huaymayaco \n", "24211 28,509 Heliconius melpomene ssp. plesseni Huaymayaco \n", "24213 28,510 Heliconius melpomene ssp. plesseni Huaymayaco \n", "24215 28,511 Heliconius melpomene ssp. plesseni Huaymayaco \n", "24217 28,512 Heliconius melpomene ssp. plesseni Huaymayaco \n", "24219 28,513 Heliconius melpomene ssp. plesseni Huaymayaco \n", "24220 28,513 Heliconius melpomene ssp. plesseni Huaymayaco \n", "24222 28,514 Heliconius melpomene ssp. malleti Reserva Narupa, bridge \n", "24224 28,515 Heliconius elevatus ssp. willmotti Río Pusuno \n", "24226 28,516 Heliconius melpomene ssp. malleti Reserva Narupa, bridge \n", "24228 28,517 Heliconius timareta ssp. ssp.nov.P Reserva Narupa, bridge \n", "24230 28,518 Heliconius melpomene ssp. malleti Reserva Narupa, bridge \n", "24232 28,519 Heliconius melpomene ssp. malleti Shitig \n", "24234 28,520 Heliconius timareta ssp. ssp.nov.P Reserva Narupa, bridge \n", "24236 28,521 Heliconius melpomene ssp. plesseni Huaymayaco \n", "24238 28,522 Heliconius timareta ssp. timareta Huaymayaco \n", "24240 28,523 Heliconius timareta ssp. timareta Huaymayaco \n", "\n", " Sample_accession ... Stage Sex Unit_Type file_type record_number \\\n", "24195 NaN ... NaN Male Wild jpg 4289223 \n", "24197 NaN ... NaN Male Wild jpg 4289223 \n", "24199 NaN ... NaN Male Wild jpg 4289223 \n", "24201 NaN ... NaN Male Wild jpg 4289223 \n", "24203 NaN ... NaN Male Wild jpg 4289223 \n", "24205 NaN ... NaN Male Wild jpg 4289223 \n", "24207 NaN ... NaN Male Wild jpg 4289223 \n", "24209 NaN ... NaN Male Wild jpg 4289223 \n", "24211 NaN ... NaN Male Wild jpg 4289223 \n", "24213 NaN ... NaN Male Wild jpg 4289223 \n", "24215 NaN ... NaN Male Wild jpg 4289223 \n", "24217 NaN ... NaN Male Wild jpg 4289223 \n", "24219 NaN ... NaN Male Wild jpg 4289223 \n", "24220 NaN ... NaN Male Wild jpg 4289223 \n", "24222 NaN ... NaN Male Wild jpg 4289223 \n", "24224 NaN ... NaN Male Wild jpg 4289223 \n", "24226 NaN ... NaN Male Wild jpg 4289223 \n", "24228 NaN ... NaN Male Wild jpg 4289223 \n", "24230 NaN ... NaN Male Wild jpg 4289223 \n", "24232 NaN ... NaN Male Wild jpg 4289223 \n", "24234 NaN ... NaN Male Wild jpg 4289223 \n", "24236 NaN ... NaN Female Wild jpg 4289223 \n", "24238 NaN ... NaN Female Wild jpg 4289223 \n", "24240 NaN ... NaN Female Wild jpg 4289223 \n", "\n", " species subspecies genus \\\n", "24195 Heliconius melpomene malleti Heliconius \n", "24197 Heliconius melpomene malleti Heliconius \n", "24199 Heliconius melpomene plesseni Heliconius \n", "24201 Heliconius melpomene plesseni Heliconius \n", "24203 Heliconius melpomene plesseni Heliconius \n", "24205 Heliconius erato notabilis Heliconius \n", "24207 Heliconius timareta timareta Heliconius \n", "24209 Heliconius melpomene plesseni Heliconius \n", "24211 Heliconius melpomene plesseni Heliconius \n", "24213 Heliconius melpomene plesseni Heliconius \n", "24215 Heliconius melpomene plesseni Heliconius \n", "24217 Heliconius melpomene plesseni Heliconius \n", "24219 Heliconius melpomene plesseni Heliconius \n", "24220 Heliconius melpomene plesseni Heliconius \n", "24222 Heliconius melpomene malleti Heliconius \n", "24224 Heliconius elevatus willmotti Heliconius \n", "24226 Heliconius melpomene malleti Heliconius \n", "24228 Heliconius timareta ssp.nov.P Heliconius \n", "24230 Heliconius melpomene malleti Heliconius \n", "24232 Heliconius melpomene malleti Heliconius \n", "24234 Heliconius timareta ssp.nov.P Heliconius \n", "24236 Heliconius melpomene plesseni Heliconius \n", "24238 Heliconius timareta timareta Heliconius \n", "24240 Heliconius timareta timareta Heliconius \n", "\n", " file_url hybrid_stat \n", "24195 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n", "24197 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n", "24199 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n", "24201 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n", "24203 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n", "24205 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n", "24207 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n", "24209 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n", "24211 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n", "24213 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n", "24215 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n", "24217 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n", "24219 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n", "24220 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n", "24222 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n", "24224 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n", "24226 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n", "24228 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n", "24230 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n", "24232 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n", "24234 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n", "24236 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n", "24238 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n", "24240 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n", "\n", "[24 rows x 28 columns]" ] }, "execution_count": 38, "metadata": {}, "output_type": "execute_result" } ], "source": [ "missing_cam_master" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "somehow `CAM028513` was duplicated..." ] }, { "cell_type": "code", "execution_count": 40, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
CAMIDXImage_nameViewzenodo_namezenodo_linkSequenceTaxonomic_NameLocalitySample_accession...StageSexUnit_Typefile_typerecord_numberspeciessubspeciesgenusfile_urlhybrid_stat
24219CAM02851314997CAM028513v.JPGventral0.2.rachel.blow.mel.tim.ikiam.csvhttps://zenodo.org/record/428922328,513Heliconius melpomene ssp. plesseniHuaymayacoNaN...NaNMaleWildjpg4289223Heliconius melpomeneplesseniHeliconiushttps://zenodo.org/record/4289223/files/CAM028...non-hybrid
24220CAM02851314995CAM028513d.JPGdorsal0.2.rachel.blow.mel.tim.ikiam.csvhttps://zenodo.org/record/428922328,513Heliconius melpomene ssp. plesseniHuaymayacoNaN...NaNMaleWildjpg4289223Heliconius melpomeneplesseniHeliconiushttps://zenodo.org/record/4289223/files/CAM028...non-hybrid
\n", "

2 rows × 28 columns

\n", "
" ], "text/plain": [ " CAMID X Image_name View \\\n", "24219 CAM028513 14997 CAM028513v.JPG ventral \n", "24220 CAM028513 14995 CAM028513d.JPG dorsal \n", "\n", " zenodo_name zenodo_link \\\n", "24219 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n", "24220 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n", "\n", " Sequence Taxonomic_Name Locality \\\n", "24219 28,513 Heliconius melpomene ssp. plesseni Huaymayaco \n", "24220 28,513 Heliconius melpomene ssp. plesseni Huaymayaco \n", "\n", " Sample_accession ... Stage Sex Unit_Type file_type record_number \\\n", "24219 NaN ... NaN Male Wild jpg 4289223 \n", "24220 NaN ... NaN Male Wild jpg 4289223 \n", "\n", " species subspecies genus \\\n", "24219 Heliconius melpomene plesseni Heliconius \n", "24220 Heliconius melpomene plesseni Heliconius \n", "\n", " file_url hybrid_stat \n", "24219 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n", "24220 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n", "\n", "[2 rows x 28 columns]" ] }, "execution_count": 40, "metadata": {}, "output_type": "execute_result" } ], "source": [ "missing_cam_master.loc[missing_cam_master[\"CAMID\"] == \"CAM028513\"]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Was this record recorded in the record 3477891 patch file? David said that file resolved many of his failed downloads.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Pull in record 3477891 multimedia file\n", "\n", "Need to run some functions to get more info from columns" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [], "source": [ "import numpy as np" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "record_number\n", "2707828 1276\n", "2714333 1113\n", "2686762 986\n", "2684906 863\n", "2677821 703\n", "2702457 276\n", "2682458 158\n", "2682669 124\n", "2552371 91\n", "2550097 50\n", "2553977 22\n", "2813153 20\n", "Name: count, dtype: int64" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ "media_rec_3477891 = pd.read_csv(\"../metadata/Zenodo_meta_files/multimedia__(rec_3477891).csv\", low_memory=False)\n", "\n", "def get_link_filename(identifier):\n", " if \"zenodo\" not in identifier:\n", " link_list = identifier.split(\"com/\")\n", " link_list[0] = np.nan\n", " else:\n", " link_list = identifier.split(\"/files/\")\n", " # link is first part, filename at end\n", " return pd.Series(link_list)\n", "\n", "def get_record_number(zenodo_link):\n", " if type(zenodo_link) != float:\n", " link = zenodo_link.split(\"record/\")\n", " return link[1]\n", "\n", "media_rec_3477891[[\"zenodo_link\", \"Image_name\"]] = media_rec_3477891[\"identifier\"].apply(get_link_filename)\n", "media_rec_3477891[\"record_number\"] = media_rec_3477891[\"zenodo_link\"].apply(get_record_number)\n", "\n", "def get_camid(image_name):\n", " if \"_\" in image_name:\n", " return image_name.split(\"_\")[0]\n", " else:\n", " # We have at least one record with image name that doesn't have CAMID (the non-zenodo record)\n", " return np.nan\n", "\n", "media_rec_3477891[\"CAMID\"] = media_rec_3477891[\"Image_name\"].apply(get_camid)\n", "media_rec_3477891[\"record_number\"].value_counts()" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2813153 is in the multimedia file from record 477891\n" ] } ], "source": [ "for record_num in list(error_df.record_number.unique()):\n", " if record_num in list(media_rec_3477891.record_number.unique()):\n", " print(f\"{record_num} is in the multimedia file from record 3477891\")" ] }, { "cell_type": "code", "execution_count": 43, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(20, 8)" ] }, "execution_count": 43, "metadata": {}, "output_type": "execute_result" } ], "source": [ "media_rec_3477891.loc[media_rec_3477891[\"record_number\"] == \"2813153\"].shape" ] }, { "cell_type": "code", "execution_count": 48, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
coreidtypeidentifierlicensezenodo_linkImage_namerecord_numberCAMID
\n", "
" ], "text/plain": [ "Empty DataFrame\n", "Columns: [coreid, type, identifier, license, zenodo_link, Image_name, record_number, CAMID]\n", "Index: []" ] }, "execution_count": 48, "metadata": {}, "output_type": "execute_result" } ], "source": [ "cam = error_df.loc[error_df[\"record_number\"] == \"2813153\", \"CAMID\"].values[0]\n", "media_rec_3477891.loc[(media_rec_3477891[\"record_number\"] == \"2813153\") & (media_rec_3477891[\"CAMID\"] == cam)]" ] }, { "cell_type": "code", "execution_count": 50, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CAM041882\n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
coreidtypeidentifierlicensezenodo_linkImage_namerecord_numberCAMID
\n", "
" ], "text/plain": [ "Empty DataFrame\n", "Columns: [coreid, type, identifier, license, zenodo_link, Image_name, record_number, CAMID]\n", "Index: []" ] }, "execution_count": 50, "metadata": {}, "output_type": "execute_result" } ], "source": [ "print(cam)\n", "media_rec_3477891.loc[media_rec_3477891[\"CAMID\"] == cam]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Looks like that `CAMID` isn't in the extra file, so no recovery there." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Record numbers (and their number of images) that had 404 errors:\n", "```\n", "record_number\n", "4287444 2600\n", "4289223 47\n", "4288250 7\n", "5561246 6\n", "3082688 3\n", "1748277 2\n", "2813153 1\n", "```\n", "The one record number covered only had 1 entry.\n", "\n", "Let's check by `CAMID`." ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
coreidtypeidentifierlicensezenodo_linkImage_namerecord_numberCAMID
\n", "
" ], "text/plain": [ "Empty DataFrame\n", "Columns: [coreid, type, identifier, license, zenodo_link, Image_name, record_number, CAMID]\n", "Index: []" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "media_rec_3477891.loc[media_rec_3477891[\"CAMID\"].isin(missing_camids)]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Check for `CAMID`s of any of the images in the error list." ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
coreidtypeidentifierlicensezenodo_linkImage_namerecord_numberCAMID
\n", "
" ], "text/plain": [ "Empty DataFrame\n", "Columns: [coreid, type, identifier, license, zenodo_link, Image_name, record_number, CAMID]\n", "Index: []" ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "media_rec_3477891.loc[media_rec_3477891[\"CAMID\"].isin(list(error_df[\"CAMID\"].unique()))]\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Nope, these images seem to be missing...\n", "\n", "Should check that the images listed in the master file line up with those in the `batch2.Peru.image.names.csv`.\n", "\n", "There were 3924 images listed in that file, with 880 unique IDs. There are 2600 download errors listed for this record (record 4287444), with 579 unique CAMIDs. If we reduce the master file to just entries from this record, we have " ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "((3788, 28),\n", " CAMID 848\n", " X 3788\n", " Image_name 3788\n", " View 6\n", " zenodo_name 1\n", " zenodo_link 1\n", " Sequence 848\n", " Taxonomic_Name 84\n", " Locality 112\n", " Sample_accession 0\n", " Collected_by 0\n", " Other_ID 848\n", " Date 13\n", " Dataset 1\n", " Store 13\n", " Brood 0\n", " Death_Date 0\n", " Cross_Type 0\n", " Stage 0\n", " Sex 0\n", " Unit_Type 0\n", " file_type 2\n", " record_number 1\n", " species 84\n", " subspecies 0\n", " genus 46\n", " file_url 3788\n", " hybrid_stat 0\n", " dtype: int64)" ] }, "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ "master.loc[master[\"record_number\"] == 4287444].shape, master.loc[master[\"record_number\"] == 4287444].nunique()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Master file has less images than suggested by the CSV from the record, and suggests we successfully downloaded 1188 images covering 269 unique IDs.\n", "\n", "This matches expectations (see below)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Check on Succsessful Downloads" ] }, { "cell_type": "code", "execution_count": 32, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Imagefile_urlrecord_numberdatasetCAMIDResponse_status
0Greta annette/9290_CAM008455_d.JPGhttps://zenodo.org/record/2684906/files/CAM008...2684906Heliconiine Butterfly Collection Records from ...CAM008455200
1Greta annette/46076_CAM008455_d.JPGhttps://zenodo.org/record/2684906/files/CAM008...3477891Heliconiine Butterfly Collection Records from ...CAM008455200
2Greta nero/46078_CAM008456_v.JPGhttps://zenodo.org/record/2684906/files/CAM008...3477891Heliconiine Butterfly Collection Records from ...CAM008456200
3Greta nero/46077_CAM008456_d.JPGhttps://zenodo.org/record/2684906/files/CAM008...3477891Heliconiine Butterfly Collection Records from ...CAM008456200
4Greta nero/9291_CAM008456_d.JPGhttps://zenodo.org/record/2684906/files/CAM008...2684906Heliconiine Butterfly Collection Records from ...CAM008456200
\n", "
" ], "text/plain": [ " Image \\\n", "0 Greta annette/9290_CAM008455_d.JPG \n", "1 Greta annette/46076_CAM008455_d.JPG \n", "2 Greta nero/46078_CAM008456_v.JPG \n", "3 Greta nero/46077_CAM008456_d.JPG \n", "4 Greta nero/9291_CAM008456_d.JPG \n", "\n", " file_url record_number \\\n", "0 https://zenodo.org/record/2684906/files/CAM008... 2684906 \n", "1 https://zenodo.org/record/2684906/files/CAM008... 3477891 \n", "2 https://zenodo.org/record/2684906/files/CAM008... 3477891 \n", "3 https://zenodo.org/record/2684906/files/CAM008... 3477891 \n", "4 https://zenodo.org/record/2684906/files/CAM008... 2684906 \n", "\n", " dataset CAMID \\\n", "0 Heliconiine Butterfly Collection Records from ... CAM008455 \n", "1 Heliconiine Butterfly Collection Records from ... CAM008455 \n", "2 Heliconiine Butterfly Collection Records from ... CAM008456 \n", "3 Heliconiine Butterfly Collection Records from ... CAM008456 \n", "4 Heliconiine Butterfly Collection Records from ... CAM008456 \n", "\n", " Response_status \n", "0 200 \n", "1 200 \n", "2 200 \n", "3 200 \n", "4 200 " ] }, "execution_count": 32, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LOG_PATH = \"../metadata/Jiggins_Zenodo_Img_Master_3477891Patch_log_(readable).json\"\n", "\n", "with open(LOG_PATH, \"r\") as log_file:\n", " logs = json.loads(log_file.read())\n", "\n", "log_df = pd.DataFrame(data = logs)\n", "log_df.head()" ] }, { "cell_type": "code", "execution_count": 33, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 33846 entries, 0 to 33845\n", "Data columns (total 6 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Image 33846 non-null object\n", " 1 file_url 33846 non-null object\n", " 2 record_number 33846 non-null object\n", " 3 dataset 26627 non-null object\n", " 4 CAMID 33846 non-null object\n", " 5 Response_status 33846 non-null object\n", "dtypes: object(6)\n", "memory usage: 1.5+ MB\n" ] } ], "source": [ "log_df.info(show_counts=True)" ] }, { "cell_type": "code", "execution_count": 34, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Image 33846\n", "file_url 29917\n", "record_number 25\n", "dataset 6\n", "CAMID 9115\n", "Response_status 1\n", "dtype: int64" ] }, "execution_count": 34, "metadata": {}, "output_type": "execute_result" } ], "source": [ "log_df.nunique()" ] }, { "cell_type": "code", "execution_count": 36, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Image 1188\n", "file_url 1188\n", "record_number 1\n", "dataset 1\n", "CAMID 269\n", "Response_status 1\n", "dtype: int64" ] }, "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ "log_df.loc[log_df[\"record_number\"] == \"4287444\"].nunique()" ] }, { "cell_type": "code", "execution_count": 38, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Imagefile_urlrecord_numberdatasetCAMIDResponse_status
27729Pyrrhogyra otolais/32012_CAM043820_d.JPGhttps://zenodo.org/record/4287444/files/CAM043...4287444Heliconiine Butterfly Collection Records from ...CAM043820200
27053Rhetus periander/31301_CAM043629_v.CR2https://zenodo.org/record/4287444/files/CAM043...4287444Heliconiine Butterfly Collection Records from ...CAM043629200
26944Morpho helenor/31191_CAM043603_hwd.CR2https://zenodo.org/record/4287444/files/CAM043...4287444Heliconiine Butterfly Collection Records from ...CAM043603200
27124Eunica pusilla/31381_CAM043650_v.CR2https://zenodo.org/record/4287444/files/CAM043...4287444Heliconiine Butterfly Collection Records from ...CAM043650200
26833Temenis laothoe/31066_CAM043567_v.JPGhttps://zenodo.org/record/4287444/files/CAM043...4287444Heliconiine Butterfly Collection Records from ...CAM043567200
\n", "
" ], "text/plain": [ " Image \\\n", "27729 Pyrrhogyra otolais/32012_CAM043820_d.JPG \n", "27053 Rhetus periander/31301_CAM043629_v.CR2 \n", "26944 Morpho helenor/31191_CAM043603_hwd.CR2 \n", "27124 Eunica pusilla/31381_CAM043650_v.CR2 \n", "26833 Temenis laothoe/31066_CAM043567_v.JPG \n", "\n", " file_url record_number \\\n", "27729 https://zenodo.org/record/4287444/files/CAM043... 4287444 \n", "27053 https://zenodo.org/record/4287444/files/CAM043... 4287444 \n", "26944 https://zenodo.org/record/4287444/files/CAM043... 4287444 \n", "27124 https://zenodo.org/record/4287444/files/CAM043... 4287444 \n", "26833 https://zenodo.org/record/4287444/files/CAM043... 4287444 \n", "\n", " dataset CAMID \\\n", "27729 Heliconiine Butterfly Collection Records from ... CAM043820 \n", "27053 Heliconiine Butterfly Collection Records from ... CAM043629 \n", "26944 Heliconiine Butterfly Collection Records from ... CAM043603 \n", "27124 Heliconiine Butterfly Collection Records from ... CAM043650 \n", "26833 Heliconiine Butterfly Collection Records from ... CAM043567 \n", "\n", " Response_status \n", "27729 200 \n", "27053 200 \n", "26944 200 \n", "27124 200 \n", "26833 200 " ] }, "execution_count": 38, "metadata": {}, "output_type": "execute_result" } ], "source": [ "log_df.loc[log_df[\"record_number\"] == \"4287444\"].sample(5)" ] }, { "cell_type": "code", "execution_count": 41, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Dataset\n", "Heliconiine Butterfly Collection Records from University of Cambridge 3228\n", "Name: count, dtype: int64" ] }, "execution_count": 41, "metadata": {}, "output_type": "execute_result" } ], "source": [ "master.loc[master[\"record_number\"] == 4287444, \"Dataset\"].value_counts()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This is the name on [records 3477891](https://zenodo.org/records/3477891), not record 4287444." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Save Error Record as CSV\n", "\n", "We'll save the error record as a CSV in case of future efforts, but re-alignment seems unlikely. We'll keep only the master file records that were successfully downloaded (still the vast majority)." ] }, { "cell_type": "code", "execution_count": 51, "metadata": {}, "outputs": [], "source": [ "error_df.to_csv(\"../metadata/Jiggins_Zenodo_Img_Master_3477891Patch_error_log.csv\", index = False)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "std", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.3" } }, "nbformat": 4, "nbformat_minor": 2 }