In preparation for the Mothbox team’s big expedition doing a vertical transect over 5 days on cerro Hoya, I went and beefed up a lot of the software and firmware for the mothboxes. As always all the code is free and open for you to use!
Ill start with some practical new things and then move to some fun scripts.
AI Software
- Moon Information:
- I created a script that uses the open source astropy library to calculate the positions of the sun, moon, and earth when given a specific date and geolocation to provide a calculation of the percentage of moon being illuminated. So now we can experiment with the effectiveness of different attractor lights under different times when they are either competing or replacing the natural orientation marker, the moon.
- 0.0 is a new moon .999999 is a full moon, .5 is a half moon
- Weather Information
- of course the insects might not be using the moon to navigate if it is super cloudy outside! So i looked into how we can get weather data incorporated as well.
- I found the Meteostat library and started figuring out how to use it. Their documentation is a bit funky and has some dead links, and the examples aren’t too thorough. But from playing around i figured out how to include weather data onto any CSV that has an event-date, lat and lon column.
- One weakness is that in places with fewer weather stations, you may be getting your weather data from stations farther away to the point where it may not be super relevant. I am implementing a feature to also provide a column for “distance to nearest weather station” for extra analysis.
- it can give us tons of stuff like hourly windspeed and direction, humidity, pressure, and COCO which is a code for the condition that translates to “clear” “cloudy” etc…
-
Post Processing and organization
- in our set of post-processing scripts, we made them so they can all easily match up with DarwinCORE standards for this type of data so we can add and share datasets to things like GBIF.
- other tweaks like, make sure ground height is only a number (float or int) and strips away other non-numerical info
- does parentID, eventID, occurenceID in the way darwincode wants it
- creates more human accessible, but globally unique datasetID formatted like “DEPLOYMENTNAME_oid_OID”
- Adds attractor_location value
-
Fake Ground Truth Detector
- in dealing with our own terabytes of insect data while developing software, things got messy sometimes! I made scripts that helped go through and streamline our process for training and crunching data to pull different types of data apart from each other.
-
Direct JSON to YOLO dataset generator.
- For training our detector, we would usually have to have an intermediate step where we create vast folders of yolo.txt data. I made a utility script that can look at our entire dataset
- find ground truth data
- create yolo.txt files
- organize all of the data into a specified training set
- For training our detector, we would usually have to have an intermediate step where we create vast folders of yolo.txt data. I made a utility script that can look at our entire dataset
-
ID and Detector scripts now
- run faster
- split human and bot data
- automatically generate organized thumbnails of all the detections
- have their data display in the user interface incredibly smoothly now!
Fun Software
-
Music Mothifier
- Over new years I worked on ways to share datasets of insects in fun interesting ways. One thing I made was the “Music Mothifier.” Video Here
- Basically I was looking for ways to take real field data and use it to generate fun weird music videos to any kind of audio you put in. It uses the librosa Python library to separate the harmonics and percussive elements of an audio sample. It then displays up to 500 insects in the background depending on the overall audio volume, And then there are 12 larger insects placed in the foreground in full color which beat to different intensities of different chromatic notes being played at a given time in the audio.
- For this first test, i tried it with the fitting music of Black Moth Super Rainbow. This is based on that data set I processed to make the t-shirts, From September 3rd 2024 on Mount totumas cloud forest in Panama.@mount.totumas
-
Mothpacker
- I also created several scripts that allow you to take a whole dataset of insects and display them in fun neat ways. This let us create a whole clothing line of fun weird fashion based on some captured insect data we are using to raise funds (so far have made $140! that’s half the cost of another mothbox!).
- you can order your mothfashion right now! https://mothbox.printify.me/
- I also created several scripts that allow you to take a whole dataset of insects and display them in fun neat ways. This let us create a whole clothing line of fun weird fashion based on some captured insect data we are using to raise funds (so far have made $140! that’s half the cost of another mothbox!).
-
Moth Zinemaker
- an addition to the above script is one that will arrange them on printable pages so you can easily turn any dataset into a physical zine! You can even opt to export them so they print at 100% scale. In that way you can get a kind of tangible feel for how many critters were detected in a specific night or location!
- an addition to the above script is one that will arrange them on printable pages so you can easily turn any dataset into a physical zine! You can even opt to export them so they print at 100% scale. In that way you can get a kind of tangible feel for how many critters were detected in a specific night or location!
Pi Firmware updates
For the past 8 months we had been using firmware 4.12,but the time came to finally update a couple things that had been lacking. I have now updated the firmware TWICE to the current working firmware version, 4.14. It features
- 10 % more pixels!
- There is a problem with the pi4’s where they can’t handle the FULL resolution of the arducam owlsight 64mp camera. Now the script automatically IDs if you are using a pi4 or pi5, and automatically bumps up your resolution to the FULL resolution
- exposure time is 3x faster (less rolling shutter blur on moving insects)
- weird error where every sixth image was SLIGHTLY brighter than others has been fixed
- automatically does not save any non-standard ascii characters to anything (no accents)
- Got rid of potential error where the Takephoto script could keep running to the point where it fills up all the memory of the mothbox and shuts it down.
- improved backup scripts to manage large numbers of files better and deal with space filling up.
- backup scripts also backup logs
- creates an EXTRA wakeup call before the mothbox shuts down to avoid skipping a new wakeup time if the wakeups and timings overlapped.