228 points · by maverickleopard · 5y ago · 152 comments
I have a valid reason to outlaw humour.
Because of you comment 3 things have happened.
1) I snorted, causing my hot tea to use my nostrils as an emergency exit.
2) My nose became a tea tap.
3) My screen and keyboard, bless them, are covered with tea. My shame in cleaning it up is indescribable.
Bravo.
Closely related (though not quite the identical problem): https://www.johndcook.com/blog/2010/03/30/statistical-rule-o...
Applying that directly, we would estimate that the odds of a fly in your house being marked are less than 150%, which tells us that you should be taking larger samples.
(With only two marked flies, this estimate will always be less informative than the fact that you sampled n flies -- it will tell you that the population is probably greater than 2/3 of n, while the sampling procedure tells you that the population is necessarily at least n+2. But as you mark more flies, the estimate will be more informative.)
By the rule of three, we estimate the probability that a fly in your house is marked at p < 3/100.
We can also model the probability that a fly in your house is marked as 100/n, where n is the number of flies in your house.
Then 100/n < 3/100 and n > 100*100/3 = 3,333. There are probably more than 3333 flies in your house.
The next day, same story. The flies were now appearing throughout the day. They all looked the same. Where the hell were they coming from? The windows were still closed. I kept vacuuming.
Eventually things were starting to get very irritating. I hunted for an entry point for days without finding anything and the flies just kept on appearing. I was pretty good at vacuuming flies by this point.
By day six I spotted a group of them hanging out near my Kentia palm. Aha! A fly had laid eggs in the soil of the plant. I had no idea that it was a suitable food source for larvae. Needless to say I quickly filled it with gravel and I guess that's the story of how I became a qualified Fly Detective.
Catch one in a cup or plastic bag and stick it in the freezer for about 10 minutes. When you take it out it will look dead, but it's not (unless you leave it in too long.) Being careful not to rip it's wings off, tie a small string or fishing line to one of it's legs.
In a few minutes it will thaw and start to walk around, and then start to fly. You can now walk it around the park like you were carrying a balloon.
https://space.stackexchange.com/questions/9261/how-many-soli...
Oh, no.... The date on that post is 2015... "recently"... I'm old...
Your error is in stating "if we assume the captured serial numbers are randomly distributed" - you're assuming they're -uniformly- distributed. Randomly distributed != uniformly distributed.
Their method would give you 125 as a guess. It's including the known info (i.e., adding "m") to take into account the fact that they're not necessarily evenly distributed.
On that note, if you continued to get tanks at low numbers (3, 4, 6, etc), averaging gets -less- accurate, because that 99 becomes more and more of an outlier. Their method gets MORE accurate, again, because they're taking advantage of all data that is known (we know it goes at least to 99), and averaging doesn't. The new low numbers we've added mean that there are less likely to be many tanks, and the formula in the link takes that into account with m/k.
Both methods will be accurate if you have 100% of the data, but taking twice the average ignores known data, so the sparser the data the less likely it is to be correct.
In comparison, I have to wonder why the "intelligence estimates" were so bad/severe over estimates.
You can send fake reports if you think the other side is listening. You can move or mock material if you think the other side is watching. You can feed false information if you are captured.
For example, when estimating tiger populations, instead of painting a white dot, rangers set up camera traps to take photos. Then they can use stripe patterns as a signature for subsequent re-appearances. Quite an interesting intersection for image AI with statistical counting methods.
It's kind of giving you an invariant number: * 100 flies -> 5 flies (5%), 100 / 0,05 = 2000 * 80 flies -> 4 flies (5%), 80 / 0,04 (not 0,05) = 2000
But if you used the percent instead (which seems to be what you hinted at) then the results vary: * 100 flies -> 5 flies (5%), 100 / 0,05 = 2000 * 80 flies -> 4 flies (5%), 80 / 0,05 = 1600
What's the principle, does it have a name I could read more about on Mathworld / Wiki?
Same principle behind a DIY fruit fly trap (glass of juice with a plastic cover with a few holes poked in it).
But I don't actually know whether flies do use this pattern.
It seems to me that the author is not ignoring that:
> While the flies now obey the laws of aviation, there's still something that seems missing. Normally, flies want to get indoors. They need to get indoors. So to simulate this, I added an attractor (maybe a rotting piece of fruit) at a position A indoors to lure the flies.
Story: I was living in a large flatshare that was plagued by flies from nearby horse stables. We were organizing a decent sized party (maybe 40 guests). In the afternoon, we had 15ish items of food that needed to be stored for a few hours until guests arrived. At first we considered covering all the food (creating work and waste of aluminum or plastic foil), then I had the idea to kill all the flies in that room and close the door. We saw about four flies. In the end we killed about 20 before we declared the situation good enough. I don't recall if there was a last fly that we eventually killed, or that we eventually gave up on killing. It took half an hour or so.
+ separation: steer to avoid crowding local flockmates
+ alignment: steer towards the average heading of local flockmates
+ cohesion: steer to move towards the average position (center of mass) of local flockmates
The algorithm was used to animate the bat swarms in Batman Returns (1992) [1].I love this algorithm, it's easy to develop and experiment with and the results feel beautiful & natural.
[0]: https://www.red3d.com/cwr/boids/
[1]: https://en.wikipedia.org/wiki/BoidsTurns out one exists [2] (in theory—no commercial product a decade later), but the one I was thinking of would use microphones rather than cameras [3] to detect the bloody suckers. Thing is, I can't find any prior research or even hints that people have considered this approach. (The closest I can find is an app [4] that detects a mosquito from ≤10cm away.) Here are some of my guesses for why it's not been done:
A. Maybe it's too difficult to distinguish mosquito buzz/whine from background noise, even when filtering in only known mosquito frequencies (~400Hz [5]).
B. Maybe it's too slow to sweep a room with a directional mic that's focused enough to detect mosquito sounds? (Say the turret in one ceiling corner of a 12x12x8ft room.)
C. Maybe directional mics don't work well for all sound in their cone and so need to be able to "focus" at different distances (by dynamically changing the parabolic dish's shape), thereby increasing the room sweep time?
D. Maybe the parabolic dish needs to be so big that it just looks ridiculous?
E. Maybe all of this is possible but the type of microphone is so expensive that it's worth pursuing commercially?
I'm curious what you all think about this. It'd be an interesting thing to try making—who hasn't wanted to make a death ray while simultaneously furthering the fight against humanity's deadliest enemy? [6]See also this research paper: Detecting Insect Flight Sounds in the Field: Implications for Acoustical Counting of Mosquitoes [7] (I'm pretty sure this is not directional—they hung an attractant 15cm from the mic and I don't see any dish.)
[1]: https://www.youtube.com/watch?v=BKm8FolQ7jw
[2]: https://www.ted.com/talks/nathan_myhrvold_could_this_laser_z...
[3]: I don't think cameras are well-suited to detecting something so small. The "photonic fence" from the TED talk only kinda works by adding a white background behind the bugs so it's really easy for the camera to detect them—not that practical in a normal room.
[4]: https://www.theguardian.com/science/2018/mar/29/mosquito-ear...
[5]: https://www.youtube.com/watch?v=Rcm3rPz_Q94&t=127
[6]: https://mysteriousuniverse.org/2014/08/why-mosquitos-are-hum...
[7]: https://pdfs.semanticscholar.org/a0bf/4fcd478b6214759046a739...
> Off the top of my head, I'm guessing the problem has mostly to do with background noise, and it only working in moderately quiet environments.
> As for locating the source of a sound, there's plenty of research that's been done about that. A directional mic doing sweeps is probably not your best bet, as it would be slow and difficult to cover three dimensions. I would think using an array of microphones and using volume and time delay to identify location would be much easier. Setting them up in a triangular pyramid would, I think, allow you to triangulate a sound's position in three dimensions. The problem with this two-fold: it's still not super precise, and the mosquito's whine is a steady sound, not an impulse where it's easy to identify time-delay between locations. You'd probably need to have an incredibly high sample rate to identify strong enough variations in the sound of a mosquito to effectively use time-delay, or place them far enough apart to rely on relative volume. Maybe a set of microphones you can set up around a room, rather than a single location would work better.
> I think this could be solvable by having the laser aim towards the sound and do a rapid sweep of the area, rather than a precision strike. You could also potentially have the device hit targets that will confirm they are being hit when you are setting it up so it can calibrate to the environment that it's in under regular conditions.
> Another thing to consider is that you would also probably need temperature and humidity detection, as both of those can affect how sound travels, even over short distances.
I then did more research on the killing part of this—the laser. The product I linked above uses two lasers—a low-power one to pinpoint the target and to "listen" for its exact frequency to rule out benign insects and a high-power one to give it instant heatstroke or burn off its wings. But with computer-aimed lasers (even non-burning visible green lasers), accidental blindness is a real concern especially indoors where the beam can unexpectedly reflect off glass or other shiny things. So maybe a narrow, powerful non-coherent flashlight could act as a spotlight and that'd be good enough for a human to still kill it.
Thank you for this analysis.
However I would admit that switching lights on at 3AM and deliberately opening all the doors for the light to be seen is not something my family appreciate. But, at least, I’m their hero.
It's a machine vision system that tracks mosquitoes and aims a laser pointer on them (so you can swat them). Don't know if this company still exists. It was/is an Israeli start-up and apparently not an April Fool's day joke.
It seems to me the best solution is to use screens, but that is not as sexy as machine vision.
There are lots of windows that don’t work with screens. For example some windows are pushed out as opposed to up, and the latching mechanism would conflict with the screen.
If however they open inwards like mine, open sounds good in theory... but you may end up more frustrated at idiotic flies buzztapping against the interior side of the glass time and time again, rather than flying around it and getting the hell out. Might as well keep the windows closed and accept the flies are here to stay rather than living in false hope while new ones keep buzzing in.
I've never noticed the number of insects reducing from open orifices, only increase, presumably until it's the same number per m³ as outside (or higher if you have food out, perhaps). I won't rule out that there might exist configurations where flies are more likely to fly out of than in to, but aside from conical shapes designed to do that (i.e. not regular windows), has anyone ever noticed that opening a window reduced the number of insects inside?
But ever since I moved to the EU, there have been no nets, then again there are noticeably fewer flies here too.
A screen door can be a secondary exterior rigid door with metal mesh panels[1], or a hanging fabric mesh door[2]. A window screen can be a metal mesh, in a rigid metal frame, tightly integrated with a window[3], or a flexible add-on[4].
The polyester/fiberglass/etc fabric meshes can be more opaque than the metal ones.
[1] https://upload.wikimedia.org/wikipedia/commons/2/22/Screen_d... https://www.lowes.com/search?searchTerm=screen+door [2] https://www.alibaba.com/trade/search?fsb=y&IndexArea=product... [3] https://www.youtube.com/watch?v=oEdK5h6smTU [4] https://www.alibaba.com/trade/search?fsb=y&IndexArea=product...
In South Asia, I could imagine that mosquitos are more dangerous because of diseases they transmit.
There may not be that many flies in the EU as there are in South Asia, but there's enough of them to be annoying. Then there are mosquitoes, moths, wasps, bees - and the very bugs I've been installing these nets against - hornets. Before the net, we'd get 3-5 hornet visits per season. Running around the house late at night with an improvised flamethrower got tiring very quickly.
window and door screens do absolutely exist in europe, but they’re definitely uncommon.
The scent-tracking mode used here seems to be a sort of variant, in which the long legs are not chosen randomly.
WRT the insect density decreasing as some fly away: in reality, others will arrive at approximately the same rate, keeping the density approximately the same, so it is probaby more realistic to put a box around the simulation, e.g. by reversing the direction of those that have moved away to the point that they would be several time-slices away from entering the window even if they flew back in a straight line.
One obvious benefit is that it can start rendering "live" and continuously and doesn't have to generate the whole animation before starting to show it.
It interoperates with python by being passed data to the draw call.
Usage like: c = Canvas(); c.draw(xs); xs is a numpy array of shape (N, 2), the points to draw on the canvas.
It's not fancy. But it drew animations faster than matplotlib (I ran this for thousands of frames, just to watch the simulation).
import IPython.display as ipydisplay
import json
import numpy as np
class Canvas:
def __init__(self, canvas_id=None, width=500, height=500):
self.display_id = None
self._canvas_id = canvas_id or ('canvas_' + str(np.random.randint(0, 10000)))
display(ipydisplay.HTML(f"""
<canvas id="{self._canvas_id}" width="{width}" height="{height}" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag.</canvas>
"""))
def draw(self, xs, world_size):
xs_string = json.dumps(xs.tolist())
obj = ipydisplay.HTML(f"""
<script>
var c = document.getElementById("{self._canvas_id}");
var ctx = c.getContext("2d");
var xs = {xs_string};
var size = {world_size};
ctx.clearRect(0, 0, c.width, c.height);
var scale = c.width / size;
for (let i = 0; i < xs.length; i++) {{
ctx.fillRect(xs[i][0] * scale, c.height - xs[i][1] * scale, 2, 2)
}}
</script>
""")
if self.display_id:
ipydisplay.update_display(obj, display_id=self.display_id)
return self.display_id
self.display_id = display(obj, display_id=True).display_id>If we take a look at the animation now, we can see the flies look slightly more realistic (if not still a bit spazzy)
Is "spazzy" a word that's used in different regional dialects of English as a term to just mean jittery? In most of the places I've lived, it's an offensive word.
Seems like it is indeed much more offensive in the UK. I've never heard it used to mean "stupid" or "incompetent" in America. Here, it describes someone who might be scatterbrained, unorganized, eccentric, and a bit hyperactive or frenetic, but not necessarily unintelligent - you might describe your professor as "a bit of a spaz" without anyone taking offense, though you probably wouldn't say it to their face.
Next step for me would be to turn the attractor into an Insectecuter.
Surely we cameras good enough for fly tracking technology in 2021?
I think the biggest problem with insect tracking is focus: They are so small that they can only be recognized if they are perfectly in focus, so you probably can't track them in 3D volumes.
Maybe you could track them with clever lighting tricks. Eg. illuminate room with very bright light coming from the side, with a black wall, so that mosquitos show up as bright spots in the video.
So yes, you know the delta-fly(er) but not the number of flies.
I have one, we both read your post and we just befriended you without authorization
it would be fun to add static attractors -ie fruit to see how it biases the trajectories