{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Scan sessions\n",
    "Sessions are scanned to generate maps between image files and their EXIF dates. Those maps can later be used to get the closest Lapse images for a given Motion image for frame differencing or other comparison methods."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The autoreload extension is already loaded. To reload it, use:\n",
      "  %reload_ext autoreload\n"
     ]
    }
   ],
   "source": [
    "%load_ext autoreload\n",
    "%autoreload 2\n",
    "\n",
    "from tqdm.notebook import tqdm\n",
    "import os\n",
    "from datetime import datetime\n",
    "\n",
    "from py.Dataset import Dataset\n",
    "from py.DatasetStatistics import DatasetStatistics\n",
    "from py.Session import Session\n",
    "from py.FileUtils import list_folders, list_jpegs_recursive"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Found 32 sessions\n"
     ]
    }
   ],
   "source": [
    "DIR = '/home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/'\n",
    "\n",
    "ds = Dataset(DIR)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['Beaver_01', 'Marten_01', 'Raccoon_01', 'Reddeer_01', 'Roedeer_01', 'Wildboar_01', 'Badger_02', 'Beaver_02', 'Fox_02', 'Marten_02', 'Raccoon_02', 'Rat_02', 'Reddeer_02', 'Roedeer_02', 'Badger_03', 'Fox_03', 'Raccoon_03', 'Reddeer_03', 'Wildboar_03', 'Badger_04', 'Rat_04', 'Reddeer_04', 'Wildboar_04', 'Badger_05', 'Beaver_05', 'Ermine_05', 'Fox_05', 'Marten_05', 'Raccoon_05', 'Reddeer_05', 'Roedeer_05', 'Wildboar_05']\n"
     ]
    }
   ],
   "source": [
    "print(ds.get_sessions())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Sessions can be created from the dataset. On instancing, the session looks for previous session scans in the session_scans folder and loads them automatically if found."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Session 'Raccoon_05' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session05-VIELAAS_Raccoon_05\n",
      "Loaded scans.\n"
     ]
    }
   ],
   "source": [
    "session = ds.create_session(\"Raccoon_05\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "If the session has not been scanned:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning motion dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 845/845 [00:16<00:00, 51.74it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning lapse dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 626/626 [00:13<00:00, 47.86it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Creating lapse map...\n",
      "Saving...\n",
      "Saved session_scans/Rat_02/lapse_dates.pickle\n",
      "Saved session_scans/Rat_02/motion_dates.pickle\n",
      "Saved session_scans/Rat_02/lapse_map.pickle\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\n"
     ]
    }
   ],
   "source": [
    "session.scan()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Duplicates and inconsistent duplicates\n",
    "The following functions checks for consistent and inconsistent (deviant) duplicates in the session. Duplicates are two or more images with the same EXIF date. Duplicates are inconsistent when they show different scenes (estimated by comparing the JPEG file size) despite being taken at the same time (and, supposedly, the same place)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1088/1088 [00:00<00:00, 41156.23it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 1088 lapse dates\n",
      "* 1 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 1 deviant duplicates: [datetime.datetime(2021, 6, 5, 14, 0)]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\n"
     ]
    }
   ],
   "source": [
    "total, total_duplicates, _, deviants = session.check_lapse_duplicates()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[datetime.datetime(2021, 6, 5, 14, 0)]"
      ]
     },
     "execution_count": 72,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "deviants"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Open and compare the duplicate images for the same date."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "#1 /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session05-VIELAAS_Raccoon_05/Lapse/2021_06_05_14h_517.jpg\n",
      "#2 /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session05-VIELAAS_Raccoon_05/Lapse/2021_06_05_14h_518.jpg\n"
     ]
    }
   ],
   "source": [
    "session.open_images_for_date(datetime(2021, 6, 5, 14, 0))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Stats\n",
    "\n",
    "| Session | Total lapse dates | Duplicates | Multiples | Inconsistent Duplicates |\n",
    "| --- | --- | --- | --- | --- |\n",
    "| Beaver_01 | 1734 | 0 | 0 | 0 |\n",
    "| Marten_01 | 1733 | 729 | 0 | 108 |\n",
    "| Raccoon_01 | 850 | 0 | 0 | 0 |\n",
    "| Reddeer_01 | 1628 | 0 | 0 | 0 |\n",
    "| Roedeer_01 | 1353 | 27 | 0 | 0 |\n",
    "| Wildboar_01 | 1732 | 0 | 0 | 0 |\n",
    "| Badger_02 | 1728 | 0 | 0 | 0 |\n",
    "| Beaver_02 | 1727 | 0 | 0 | 0 |\n",
    "| Fox_02 | 957 | 0 | 0 | 0 |\n",
    "| Marten_02 | 1726 | 0 | 0 | 0 |\n",
    "| Raccoon_02 | 1639 | 0 | 0 | 0 |\n",
    "| Rat_02 | 578 | 48 | 0 | 0 |\n",
    "| Reddeer_02 | 1635 | 0 | 0 | 0 |\n",
    "| Roedeer_02 | 888 | 0 | 0 | 0 |\n",
    "| Badger_03 | 46 | 0 | 0 | 0 |\n",
    "| Fox_03 | 34 | 1 | 1 | 1 |\n",
    "| Raccoon_03 | 35 | 0 | 0 | 0 |\n",
    "| Reddeer_03 | 1027 | 0 | 0 | 0 |\n",
    "| Wildboar_03 | 46 | 0 | 0 | 0 |\n",
    "| Badger_04 | 56 | 0 | 0 | 0 |\n",
    "| Rat_04 | 39 | 0 | 0 | 0 |\n",
    "| Reddeer_04 | 46 | 0 | 0 | 0 |\n",
    "| Wildboar_04 | 39 | 0 | 0 | 0 |\n",
    "| Badger_05 | 1105 | 69 | 0 | 1 |\n",
    "| Beaver_05 | 1105 | 216 | 0 | 0 |\n",
    "| Ermine_05 | 867 | 0 | 0 | 0 |\n",
    "| Fox_05 | 1083 | 0 | 0 | 0 |\n",
    "| Marten_05 | 888 | 2 | 0 | 2 |\n",
    "| Raccoon_05 | 1088 | 1 | 0 | 1 |\n",
    "| Reddeer_05 | 1078 | 0 | 0 | 0 |\n",
    "| Roedeer_05 | 1090 | 0 | 0 | 0 |\n",
    "| Wildboar_05 | 902 | 1 | 0 | 1 |\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Session 'Beaver_01' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session01-VIELAAS_Beaver_01\n",
      "Loaded scans.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1734/1734 [00:00<00:00, 792430.06it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 1734 lapse dates\n",
      "* 0 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 0 deviant duplicates: []\n",
      "| Beaver_01 | 1734 | 0 | 0 | 0 |\n",
      "Session 'Marten_01' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session01-VIELAAS_Marten_01\n",
      "Loaded scans.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1733/1733 [00:00<00:00, 3852.62it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 1733 lapse dates\n",
      "* 729 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 108 deviant duplicates: [datetime.datetime(2021, 6, 17, 23, 0), datetime.datetime(2021, 6, 18, 0, 0), datetime.datetime(2021, 6, 18, 1, 0), datetime.datetime(2021, 6, 18, 2, 0), datetime.datetime(2021, 6, 18, 3, 0), datetime.datetime(2021, 6, 18, 4, 0), datetime.datetime(2021, 6, 18, 5, 0), datetime.datetime(2021, 6, 18, 6, 0), datetime.datetime(2021, 6, 18, 7, 0), datetime.datetime(2021, 6, 18, 8, 0), datetime.datetime(2021, 6, 18, 9, 0), datetime.datetime(2021, 6, 18, 10, 0), datetime.datetime(2021, 6, 18, 11, 0), datetime.datetime(2021, 6, 18, 12, 0), datetime.datetime(2021, 6, 18, 13, 0), datetime.datetime(2021, 6, 18, 14, 0), datetime.datetime(2021, 6, 18, 15, 0), datetime.datetime(2021, 6, 18, 16, 0), datetime.datetime(2021, 6, 18, 17, 0), datetime.datetime(2021, 6, 18, 18, 0), datetime.datetime(2021, 6, 18, 19, 0), datetime.datetime(2021, 6, 18, 20, 0), datetime.datetime(2021, 6, 18, 21, 0), datetime.datetime(2021, 6, 18, 22, 0), datetime.datetime(2021, 6, 18, 23, 0), datetime.datetime(2021, 6, 19, 0, 0), datetime.datetime(2021, 6, 19, 1, 0), datetime.datetime(2021, 6, 19, 2, 0), datetime.datetime(2021, 6, 19, 3, 0), datetime.datetime(2021, 6, 19, 4, 0), datetime.datetime(2021, 6, 19, 5, 0), datetime.datetime(2021, 6, 19, 6, 0), datetime.datetime(2021, 6, 19, 7, 0), datetime.datetime(2021, 6, 19, 8, 0), datetime.datetime(2021, 6, 19, 9, 0), datetime.datetime(2021, 6, 19, 10, 0), datetime.datetime(2021, 6, 19, 11, 0), datetime.datetime(2021, 6, 19, 12, 0), datetime.datetime(2021, 6, 19, 13, 0), datetime.datetime(2021, 6, 19, 14, 0), datetime.datetime(2021, 6, 19, 15, 0), datetime.datetime(2021, 6, 19, 16, 0), datetime.datetime(2021, 6, 19, 17, 0), datetime.datetime(2021, 6, 19, 18, 0), datetime.datetime(2021, 6, 19, 19, 0), datetime.datetime(2021, 6, 19, 20, 0), datetime.datetime(2021, 6, 19, 21, 0), datetime.datetime(2021, 6, 19, 22, 0), datetime.datetime(2021, 6, 19, 23, 0), datetime.datetime(2021, 6, 20, 0, 0), datetime.datetime(2021, 6, 20, 1, 0), datetime.datetime(2021, 6, 20, 2, 0), datetime.datetime(2021, 6, 20, 3, 0), datetime.datetime(2021, 6, 20, 4, 0), datetime.datetime(2021, 6, 20, 5, 0), datetime.datetime(2021, 6, 20, 6, 0), datetime.datetime(2021, 6, 20, 7, 0), datetime.datetime(2021, 6, 20, 8, 0), datetime.datetime(2021, 6, 20, 9, 0), datetime.datetime(2021, 6, 20, 10, 0), datetime.datetime(2021, 6, 20, 11, 0), datetime.datetime(2021, 6, 20, 12, 0), datetime.datetime(2021, 6, 20, 13, 0), datetime.datetime(2021, 6, 20, 14, 0), datetime.datetime(2021, 6, 20, 15, 0), datetime.datetime(2021, 6, 20, 16, 0), datetime.datetime(2021, 6, 20, 17, 0), datetime.datetime(2021, 6, 20, 18, 0), datetime.datetime(2021, 6, 20, 19, 0), datetime.datetime(2021, 6, 20, 20, 0), datetime.datetime(2021, 6, 20, 21, 0), datetime.datetime(2021, 6, 20, 22, 0), datetime.datetime(2021, 6, 20, 23, 0), datetime.datetime(2021, 6, 21, 0, 0), datetime.datetime(2021, 6, 21, 1, 0), datetime.datetime(2021, 6, 21, 2, 0), datetime.datetime(2021, 6, 21, 3, 0), datetime.datetime(2021, 6, 21, 4, 0), datetime.datetime(2021, 6, 21, 5, 0), datetime.datetime(2021, 6, 21, 6, 0), datetime.datetime(2021, 6, 21, 7, 0), datetime.datetime(2021, 6, 21, 8, 0), datetime.datetime(2021, 6, 21, 9, 0), datetime.datetime(2021, 6, 21, 10, 0), datetime.datetime(2021, 6, 21, 11, 0), datetime.datetime(2021, 6, 21, 12, 0), datetime.datetime(2021, 6, 21, 13, 0), datetime.datetime(2021, 6, 21, 14, 0), datetime.datetime(2021, 6, 21, 15, 0), datetime.datetime(2021, 6, 21, 16, 0), datetime.datetime(2021, 6, 21, 17, 0), datetime.datetime(2021, 6, 21, 18, 0), datetime.datetime(2021, 6, 21, 19, 0), datetime.datetime(2021, 6, 21, 20, 0), datetime.datetime(2021, 6, 21, 21, 0), datetime.datetime(2021, 6, 21, 22, 0), datetime.datetime(2021, 6, 21, 23, 0), datetime.datetime(2021, 6, 22, 0, 0), datetime.datetime(2021, 6, 22, 1, 0), datetime.datetime(2021, 6, 22, 2, 0), datetime.datetime(2021, 6, 22, 3, 0), datetime.datetime(2021, 6, 22, 4, 0), datetime.datetime(2021, 6, 22, 5, 0), datetime.datetime(2021, 6, 22, 6, 0), datetime.datetime(2021, 6, 22, 7, 0), datetime.datetime(2021, 6, 22, 8, 0), datetime.datetime(2021, 6, 22, 9, 0), datetime.datetime(2021, 6, 22, 10, 0)]\n",
      "| Marten_01 | 1733 | 729 | 0 | 108 |\n",
      "Session 'Raccoon_01' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session01-VIELAAS_Raccoon_01\n",
      "Loaded scans.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 850/850 [00:00<00:00, 1510020.50it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 850 lapse dates\n",
      "* 0 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 0 deviant duplicates: []\n",
      "| Raccoon_01 | 850 | 0 | 0 | 0 |\n",
      "Session 'Reddeer_01' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session01-VIELAAS_Reddeer_01\n",
      "Session not scanned. Run session.scan() to create scan files\n",
      "Scanning motion dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 9380/9380 [04:08<00:00, 37.78it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning lapse dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1628/1628 [00:37<00:00, 43.07it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Creating lapse map...\n",
      "Saving...\n",
      "Saved session_scans/Reddeer_01/lapse_dates.pickle\n",
      "Saved session_scans/Reddeer_01/motion_dates.pickle\n",
      "Saved session_scans/Reddeer_01/lapse_map.pickle\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1628/1628 [00:00<00:00, 1938764.03it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 1628 lapse dates\n",
      "* 0 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 0 deviant duplicates: []\n",
      "| Reddeer_01 | 1628 | 0 | 0 | 0 |\n",
      "Session 'Roedeer_01' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session01-VIELAAS_Roedeer_01\n",
      "Session not scanned. Run session.scan() to create scan files\n",
      "Scanning motion dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 38820/38820 [18:29<00:00, 35.00it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning lapse dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1380/1380 [00:33<00:00, 41.40it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Creating lapse map...\n",
      "Saving...\n",
      "Saved session_scans/Roedeer_01/lapse_dates.pickle\n",
      "Saved session_scans/Roedeer_01/motion_dates.pickle\n",
      "Saved session_scans/Roedeer_01/lapse_map.pickle\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1353/1353 [00:00<00:00, 72058.48it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 1353 lapse dates\n",
      "* 27 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 0 deviant duplicates: []\n",
      "| Roedeer_01 | 1353 | 27 | 0 | 0 |\n",
      "Session 'Wildboar_01' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session01-VIELAAS_Wildboar_01\n",
      "Session not scanned. Run session.scan() to create scan files\n",
      "Scanning motion dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 2895/2895 [01:25<00:00, 34.00it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning lapse dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1732/1732 [00:41<00:00, 41.44it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Creating lapse map...\n",
      "Saving...\n",
      "Saved session_scans/Wildboar_01/lapse_dates.pickle\n",
      "Saved session_scans/Wildboar_01/motion_dates.pickle\n",
      "Saved session_scans/Wildboar_01/lapse_map.pickle\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1732/1732 [00:00<00:00, 603316.55it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 1732 lapse dates\n",
      "* 0 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 0 deviant duplicates: []\n",
      "| Wildboar_01 | 1732 | 0 | 0 | 0 |\n",
      "Session 'Badger_02' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session02-VIELAAS_Badger_02\n",
      "Loaded scans.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1728/1728 [00:00<00:00, 689343.48it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 1728 lapse dates\n",
      "* 0 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 0 deviant duplicates: []\n",
      "| Badger_02 | 1728 | 0 | 0 | 0 |\n",
      "Session 'Beaver_02' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session02-VIELAAS_Beaver_02\n",
      "Session not scanned. Run session.scan() to create scan files\n",
      "Scanning motion dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 2890/2890 [01:16<00:00, 37.72it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning lapse dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1727/1727 [00:43<00:00, 39.28it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Creating lapse map...\n",
      "Saving...\n",
      "Saved session_scans/Beaver_02/lapse_dates.pickle\n",
      "Saved session_scans/Beaver_02/motion_dates.pickle\n",
      "Saved session_scans/Beaver_02/lapse_map.pickle\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1727/1727 [00:00<00:00, 733228.36it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 1727 lapse dates\n",
      "* 0 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 0 deviant duplicates: []\n",
      "| Beaver_02 | 1727 | 0 | 0 | 0 |\n",
      "Session 'Fox_02' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session02-VIELAAS_Fox_02\n",
      "Session not scanned. Run session.scan() to create scan files\n",
      "Scanning motion dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1110/1110 [00:28<00:00, 38.46it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning lapse dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 957/957 [00:27<00:00, 35.11it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Creating lapse map...\n",
      "Saving...\n",
      "Saved session_scans/Fox_02/lapse_dates.pickle\n",
      "Saved session_scans/Fox_02/motion_dates.pickle\n",
      "Saved session_scans/Fox_02/lapse_map.pickle\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 957/957 [00:00<00:00, 134642.05it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 957 lapse dates\n",
      "* 0 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 0 deviant duplicates: []\n",
      "| Fox_02 | 957 | 0 | 0 | 0 |\n",
      "Session 'Marten_02' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session02-VIELAAS_Marten_02\n",
      "Loaded scans.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1726/1726 [00:00<00:00, 1315292.28it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 1726 lapse dates\n",
      "* 0 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 0 deviant duplicates: []\n",
      "| Marten_02 | 1726 | 0 | 0 | 0 |\n",
      "Session 'Raccoon_02' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session02-VIELAAS_Raccoon_02\n",
      "Session not scanned. Run session.scan() to create scan files\n",
      "Scanning motion dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 332/332 [00:06<00:00, 49.31it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning lapse dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1639/1639 [00:35<00:00, 46.32it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Creating lapse map...\n",
      "Saving...\n",
      "Saved session_scans/Raccoon_02/lapse_dates.pickle\n",
      "Saved session_scans/Raccoon_02/motion_dates.pickle\n",
      "Saved session_scans/Raccoon_02/lapse_map.pickle\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1639/1639 [00:00<00:00, 1118344.60it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 1639 lapse dates\n",
      "* 0 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 0 deviant duplicates: []\n",
      "| Raccoon_02 | 1639 | 0 | 0 | 0 |\n",
      "Session 'Rat_02' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session02-VIELAAS_Rat_02\n",
      "Loaded scans.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 578/578 [00:00<00:00, 11164.62it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 578 lapse dates\n",
      "* 48 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 0 deviant duplicates: []\n",
      "| Rat_02 | 578 | 48 | 0 | 0 |\n",
      "Session 'Reddeer_02' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session02-VIELAAS_Reddeer_02\n",
      "Session not scanned. Run session.scan() to create scan files\n",
      "Scanning motion dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 675/675 [00:17<00:00, 39.35it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning lapse dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1635/1635 [00:38<00:00, 42.67it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Creating lapse map...\n",
      "Saving...\n",
      "Saved session_scans/Reddeer_02/lapse_dates.pickle\n",
      "Saved session_scans/Reddeer_02/motion_dates.pickle\n",
      "Saved session_scans/Reddeer_02/lapse_map.pickle\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1635/1635 [00:00<00:00, 1200365.31it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 1635 lapse dates\n",
      "* 0 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 0 deviant duplicates: []\n",
      "| Reddeer_02 | 1635 | 0 | 0 | 0 |\n",
      "Session 'Roedeer_02' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session02-VIELAAS_Roedeer_02\n",
      "Session not scanned. Run session.scan() to create scan files\n",
      "Scanning motion dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 2770/2770 [00:51<00:00, 53.39it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning lapse dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 888/888 [00:20<00:00, 42.57it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Creating lapse map...\n",
      "Saving...\n",
      "Saved session_scans/Roedeer_02/lapse_dates.pickle\n",
      "Saved session_scans/Roedeer_02/motion_dates.pickle\n",
      "Saved session_scans/Roedeer_02/lapse_map.pickle\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 888/888 [00:00<00:00, 892533.42it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 888 lapse dates\n",
      "* 0 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 0 deviant duplicates: []\n",
      "| Roedeer_02 | 888 | 0 | 0 | 0 |\n",
      "Session 'Badger_03' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session03-VIELAAS_Badger_03\n",
      "Session not scanned. Run session.scan() to create scan files\n",
      "Scanning motion dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 4245/4245 [01:02<00:00, 67.84it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning lapse dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 46/46 [00:00<00:00, 146.82it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Creating lapse map...\n",
      "Saving...\n",
      "Saved session_scans/Badger_03/lapse_dates.pickle\n",
      "Saved session_scans/Badger_03/motion_dates.pickle\n",
      "Saved session_scans/Badger_03/lapse_map.pickle\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 46/46 [00:00<00:00, 299593.14it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 46 lapse dates\n",
      "* 0 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 0 deviant duplicates: []\n",
      "| Badger_03 | 46 | 0 | 0 | 0 |\n",
      "Session 'Fox_03' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session03-VIELAAS_Fox_03\n",
      "Session not scanned. Run session.scan() to create scan files\n",
      "Scanning motion dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 5495/5495 [01:20<00:00, 68.18it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning lapse dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 38/38 [00:00<00:00, 130.40it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Creating lapse map...\n",
      "Saving...\n",
      "Saved session_scans/Fox_03/lapse_dates.pickle\n",
      "Saved session_scans/Fox_03/motion_dates.pickle\n",
      "Saved session_scans/Fox_03/lapse_map.pickle\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 34/34 [00:00<00:00, 37876.85it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 34 lapse dates\n",
      "* 1 duplicates\n",
      "* 1 multiples (more than two files per date)\n",
      "* 1 deviant duplicates: [datetime.datetime(2021, 6, 1, 10, 0)]\n",
      "| Fox_03 | 34 | 1 | 1 | 1 |\n",
      "Session 'Raccoon_03' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session03-VIELAAS_Raccoon_03\n",
      "Session not scanned. Run session.scan() to create scan files\n",
      "Scanning motion dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 475/475 [00:05<00:00, 79.66it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning lapse dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 35/35 [00:00<00:00, 123.96it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Creating lapse map...\n",
      "Saving...\n",
      "Saved session_scans/Raccoon_03/lapse_dates.pickle\n",
      "Saved session_scans/Raccoon_03/motion_dates.pickle\n",
      "Saved session_scans/Raccoon_03/lapse_map.pickle\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 35/35 [00:00<00:00, 133942.19it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 35 lapse dates\n",
      "* 0 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 0 deviant duplicates: []\n",
      "| Raccoon_03 | 35 | 0 | 0 | 0 |\n",
      "Session 'Reddeer_03' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session03-VIELAAS_Reddeer_03\n",
      "Session not scanned. Run session.scan() to create scan files\n",
      "Scanning motion dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1770/1770 [00:50<00:00, 35.24it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning lapse dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1027/1027 [00:22<00:00, 45.08it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Creating lapse map...\n",
      "Saving...\n",
      "Saved session_scans/Reddeer_03/lapse_dates.pickle\n",
      "Saved session_scans/Reddeer_03/motion_dates.pickle\n",
      "Saved session_scans/Reddeer_03/lapse_map.pickle\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1027/1027 [00:00<00:00, 1474178.72it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 1027 lapse dates\n",
      "* 0 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 0 deviant duplicates: []\n",
      "| Reddeer_03 | 1027 | 0 | 0 | 0 |\n",
      "Session 'Wildboar_03' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session03-VIELAAS_Wildboar_03\n",
      "Session not scanned. Run session.scan() to create scan files\n",
      "Scanning motion dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 515/515 [00:06<00:00, 77.99it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning lapse dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 46/46 [00:00<00:00, 148.00it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Creating lapse map...\n",
      "Saving...\n",
      "Saved session_scans/Wildboar_03/lapse_dates.pickle\n",
      "Saved session_scans/Wildboar_03/motion_dates.pickle\n",
      "Saved session_scans/Wildboar_03/lapse_map.pickle\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 46/46 [00:00<00:00, 354014.65it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 46 lapse dates\n",
      "* 0 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 0 deviant duplicates: []\n",
      "| Wildboar_03 | 46 | 0 | 0 | 0 |\n",
      "Session 'Badger_04' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session04-VIELAAS_Badger_04\n",
      "Session not scanned. Run session.scan() to create scan files\n",
      "Scanning motion dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 480/480 [00:06<00:00, 78.13it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning lapse dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 56/56 [00:00<00:00, 148.72it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Creating lapse map...\n",
      "Saving...\n",
      "Saved session_scans/Badger_04/lapse_dates.pickle\n",
      "Saved session_scans/Badger_04/motion_dates.pickle\n",
      "Saved session_scans/Badger_04/lapse_map.pickle\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 56/56 [00:00<00:00, 302681.73it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 56 lapse dates\n",
      "* 0 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 0 deviant duplicates: []\n",
      "| Badger_04 | 56 | 0 | 0 | 0 |\n",
      "Session 'Rat_04' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session04-VIELAAS_Rat_04\n",
      "Session not scanned. Run session.scan() to create scan files\n",
      "Scanning motion dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 640/640 [00:08<00:00, 77.00it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning lapse dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 39/39 [00:00<00:00, 161.61it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Creating lapse map...\n",
      "Saving...\n",
      "Saved session_scans/Rat_04/lapse_dates.pickle\n",
      "Saved session_scans/Rat_04/motion_dates.pickle\n",
      "Saved session_scans/Rat_04/lapse_map.pickle\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 39/39 [00:00<00:00, 351025.44it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 39 lapse dates\n",
      "* 0 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 0 deviant duplicates: []\n",
      "| Rat_04 | 39 | 0 | 0 | 0 |\n",
      "Session 'Reddeer_04' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session04-VIELAAS_Reddeer_04\n",
      "Session not scanned. Run session.scan() to create scan files\n",
      "Scanning motion dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1690/1690 [00:23<00:00, 71.78it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning lapse dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 46/46 [00:00<00:00, 159.03it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Creating lapse map...\n",
      "Saving...\n",
      "Saved session_scans/Reddeer_04/lapse_dates.pickle\n",
      "Saved session_scans/Reddeer_04/motion_dates.pickle\n",
      "Saved session_scans/Reddeer_04/lapse_map.pickle\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 46/46 [00:00<00:00, 363348.37it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 46 lapse dates\n",
      "* 0 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 0 deviant duplicates: []\n",
      "| Reddeer_04 | 46 | 0 | 0 | 0 |\n",
      "Session 'Wildboar_04' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session04-VIELAAS_Wildboar_04\n",
      "Session not scanned. Run session.scan() to create scan files\n",
      "Scanning motion dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 2250/2250 [00:31<00:00, 71.76it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning lapse dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 39/39 [00:00<00:00, 137.72it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Creating lapse map...\n",
      "Saving...\n",
      "Saved session_scans/Wildboar_04/lapse_dates.pickle\n",
      "Saved session_scans/Wildboar_04/motion_dates.pickle\n",
      "Saved session_scans/Wildboar_04/lapse_map.pickle\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 39/39 [00:00<00:00, 206277.25it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 39 lapse dates\n",
      "* 0 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 0 deviant duplicates: []\n",
      "| Wildboar_04 | 39 | 0 | 0 | 0 |\n",
      "Session 'Badger_05' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session05-VIELAAS_Badger_05\n",
      "Session not scanned. Run session.scan() to create scan files\n",
      "Scanning motion dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 3860/3860 [02:03<00:00, 31.33it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning lapse dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1174/1174 [00:27<00:00, 42.37it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Creating lapse map...\n",
      "Saving...\n",
      "Saved session_scans/Badger_05/lapse_dates.pickle\n",
      "Saved session_scans/Badger_05/motion_dates.pickle\n",
      "Saved session_scans/Badger_05/lapse_map.pickle\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1105/1105 [00:00<00:00, 34186.81it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 1105 lapse dates\n",
      "* 69 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 1 deviant duplicates: [datetime.datetime(2021, 6, 1, 14, 0)]\n",
      "| Badger_05 | 1105 | 69 | 0 | 1 |\n",
      "Session 'Beaver_05' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session05-VIELAAS_Beaver_05\n",
      "Session not scanned. Run session.scan() to create scan files\n",
      "Scanning motion dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 2415/2415 [01:12<00:00, 33.33it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning lapse dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1321/1321 [00:33<00:00, 39.14it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Creating lapse map...\n",
      "Saving...\n",
      "Saved session_scans/Beaver_05/lapse_dates.pickle\n",
      "Saved session_scans/Beaver_05/motion_dates.pickle\n",
      "Saved session_scans/Beaver_05/lapse_map.pickle\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1105/1105 [00:00<00:00, 8703.20it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 1105 lapse dates\n",
      "* 216 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 0 deviant duplicates: []\n",
      "| Beaver_05 | 1105 | 216 | 0 | 0 |\n",
      "Session 'Ermine_05' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session05-VIELAAS_Ermine_05\n",
      "Session not scanned. Run session.scan() to create scan files\n",
      "Scanning motion dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 2380/2380 [01:08<00:00, 34.56it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning lapse dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 867/867 [00:20<00:00, 43.27it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Creating lapse map...\n",
      "Saving...\n",
      "Saved session_scans/Ermine_05/lapse_dates.pickle\n",
      "Saved session_scans/Ermine_05/motion_dates.pickle\n",
      "Saved session_scans/Ermine_05/lapse_map.pickle\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 867/867 [00:00<00:00, 946502.23it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 867 lapse dates\n",
      "* 0 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 0 deviant duplicates: []\n",
      "| Ermine_05 | 867 | 0 | 0 | 0 |\n",
      "Session 'Fox_05' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session05-VIELAAS_Fox_05\n",
      "Session not scanned. Run session.scan() to create scan files\n",
      "Scanning motion dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 753/753 [00:22<00:00, 34.10it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning lapse dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1083/1083 [00:25<00:00, 41.94it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Creating lapse map...\n",
      "Saving...\n",
      "Saved session_scans/Fox_05/lapse_dates.pickle\n",
      "Saved session_scans/Fox_05/motion_dates.pickle\n",
      "Saved session_scans/Fox_05/lapse_map.pickle\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1083/1083 [00:00<00:00, 1333655.68it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 1083 lapse dates\n",
      "* 0 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 0 deviant duplicates: []\n",
      "| Fox_05 | 1083 | 0 | 0 | 0 |\n",
      "Session 'Marten_05' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session05-VIELAAS_Marten_05\n",
      "Session not scanned. Run session.scan() to create scan files\n",
      "Scanning motion dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 16170/16170 [07:54<00:00, 34.10it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning lapse dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 890/890 [00:20<00:00, 43.81it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Creating lapse map...\n",
      "Saving...\n",
      "Saved session_scans/Marten_05/lapse_dates.pickle\n",
      "Saved session_scans/Marten_05/motion_dates.pickle\n",
      "Saved session_scans/Marten_05/lapse_map.pickle\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 888/888 [00:00<00:00, 144127.47it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 888 lapse dates\n",
      "* 2 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 2 deviant duplicates: [datetime.datetime(2021, 6, 1, 12, 0), datetime.datetime(2021, 6, 13, 4, 0)]\n",
      "| Marten_05 | 888 | 2 | 0 | 2 |\n",
      "Session 'Raccoon_05' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session05-VIELAAS_Raccoon_05\n",
      "Session not scanned. Run session.scan() to create scan files\n",
      "Scanning motion dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1600/1600 [00:45<00:00, 34.82it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning lapse dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1089/1089 [00:24<00:00, 44.23it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Creating lapse map...\n",
      "Saving...\n",
      "Saved session_scans/Raccoon_05/lapse_dates.pickle\n",
      "Saved session_scans/Raccoon_05/motion_dates.pickle\n",
      "Saved session_scans/Raccoon_05/lapse_map.pickle\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1088/1088 [00:00<00:00, 683144.12it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 1088 lapse dates\n",
      "* 1 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 1 deviant duplicates: [datetime.datetime(2021, 6, 5, 14, 0)]\n",
      "| Raccoon_05 | 1088 | 1 | 0 | 1 |\n",
      "Session 'Reddeer_05' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session05-VIELAAS_Reddeer_05\n",
      "Session not scanned. Run session.scan() to create scan files\n",
      "Scanning motion dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 18251/18251 [07:50<00:00, 38.81it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning lapse dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1078/1078 [00:24<00:00, 43.29it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Creating lapse map...\n",
      "Saving...\n",
      "Saved session_scans/Reddeer_05/lapse_dates.pickle\n",
      "Saved session_scans/Reddeer_05/motion_dates.pickle\n",
      "Saved session_scans/Reddeer_05/lapse_map.pickle\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1078/1078 [00:00<00:00, 2044984.04it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 1078 lapse dates\n",
      "* 0 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 0 deviant duplicates: []\n",
      "| Reddeer_05 | 1078 | 0 | 0 | 0 |\n",
      "Session 'Roedeer_05' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session05-VIELAAS_Roedeer_05\n",
      "Loaded scans.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1090/1090 [00:00<00:00, 1023000.98it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 1090 lapse dates\n",
      "* 0 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 0 deviant duplicates: []\n",
      "| Roedeer_05 | 1090 | 0 | 0 | 0 |\n",
      "Session 'Wildboar_05' at folder: /home/AMMOD_data/camera_traps/BayerWald/Vielkadaver-Projekt/VIELAAS_Spring_Session05-VIELAAS_Wildboar_05\n",
      "Session not scanned. Run session.scan() to create scan files\n",
      "Scanning motion dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 22263/22263 [10:24<00:00, 35.63it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Scanning lapse dates...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 903/903 [00:21<00:00, 42.06it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Creating lapse map...\n",
      "Saving...\n",
      "Saved session_scans/Wildboar_05/lapse_dates.pickle\n",
      "Saved session_scans/Wildboar_05/motion_dates.pickle\n",
      "Saved session_scans/Wildboar_05/lapse_map.pickle\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 902/902 [00:00<00:00, 442642.12it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 902 lapse dates\n",
      "* 1 duplicates\n",
      "* 0 multiples (more than two files per date)\n",
      "* 1 deviant duplicates: [datetime.datetime(2021, 6, 13, 15, 0)]\n",
      "| Wildboar_05 | 902 | 1 | 0 | 1 |\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\n"
     ]
    }
   ],
   "source": [
    "# code for generating the markup for the table above\n",
    "\n",
    "out_file = None\n",
    "\n",
    "for sess_name in ds.get_sessions():\n",
    "    session = ds.create_session(sess_name)\n",
    "    if not session.scanned:\n",
    "        session.scan()\n",
    "    total, total_duplicates, total_multiples, deviants = session.check_lapse_duplicates()\n",
    "    out = f\"| {sess_name} | {total} | {total_duplicates} | {total_multiples} | {len(deviants)} |\"\n",
    "    print(out)\n",
    "    if out_file is not None:\n",
    "        with open(out_file, \"a\") as f:\n",
    "            f.write(f\"{out}\\n\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
  },
  "kernelspec": {
   "display_name": "Python 3.6.9 64-bit",
   "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.6.9"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
