How many flies are in my apartment?
saml98.github.io
saml98.github.io
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.
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.
Then the next 50 tanks you find are all from the range [1, 100].
Is it more reasonable to assume that there are around 1258 tanks, or that there are probably closer to 100 tanks, and that first one with the very large serial number was not a sequentially numbered tank?
But, from the article's initial proposition - "You do know that the Germans have a sequential numbering system (1, 2, …, n)" and in giving historical context "On investigation, it became clear that the serial numbers were sequential, without gaps."
So, yes, without that being a prior, of course it's more likely that that outlier is a strange one off, and you'd do better to exclude it from your data set (and/or continue to investigate, because it's NOT at all clear that the serial numbers are sequential yet).
But, that context and ordering matters. Assume just the opposite series of events - you started by finding 50 tanks with serial numbers [1, 100]. And then three or four months go by you didn't get any tank serials sent to you. And then you get 1234. 1258 tanks seems really reasonable at that point (and, in fact, would fit the reality; the Germans were producing ~256 tanks per month per the article).
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.
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.
I think repeatidly slapping them with a pretty soft plastic attraption until they stop moving is even harsher though.
Or slapping them outta the air, trying to electrocute them but having too little power on the shitty device so only their wings get burned.
Or vacuuming them up
Or flushing them down the drain.
Honestly, whatever people usually do to them it's way way crueller
It's soft to you, not to the fly. You don't slap a fly "until it stops moving". When you swat a fly, it explodes.
Don’t Google dust mites.
Because of their rarity, I find that the ones that wear tiny top hats are easily distinguishable too.
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?
But I don't actually know whether flies do use this pattern.
Same principle behind a DIY fruit fly trap (glass of juice with a plastic cover with a few holes poked in it).
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.
But ever since I moved to the EU, there have been no nets, then again there are noticeably fewer flies here too.
window and door screens do absolutely exist in europe, but they’re definitely uncommon.
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.
Also, when you say "nets", do you mean "screens", ie on the windows?
Just a lighter, a spray can, and steady hands. I know you're probably disappointed, but simplest solutions do work best :).
(To be absolutely clear: I only use this against wasps and hornets, and only in situations where there's no safe way of shooing them back out through a window.)
Operation: hold the lighter in front of you, light the flame, spray above it. Aim for sub-second bursts of flame - you don't want anything in the room to heat up. Never let the flame come close to any highly flammable surface (like drapes, or aforementioned mosquito net).
Tactics: against hornets and wasps, I shoot either below it, or at it directly. Shooting below, the rising hot air will confuse the bug, possibly stun it for a moment. Shooting at it, a sub-second burst is enough to burn off is wings, at which point you can finish it off using your favorite percussive maintenance tool.
Equipment considerations:
- I tend to use cheap, widely available flint lighters. I have experimented with gasoline and butane (high-pressure) lighters before, but IIRC, they didn't work well.
- For fuel, I use a deodorant. In the past, I've also used a hair spray - it's a good choice, because it enables a third mode of operation: cold mode. Because hair spray is viscous, hitting a bug with it is likely to clog its breathing apparatus and glue its wings, allowing you to safely apply the killing blow. I found it useful in a tent[0], where you absolutely do not want to play with an open flame of any kind. Anyway, any kind of spray with a flammable mixture will work, but pay attention to the possible combustion products. I do not recommend going for pressurized butane gas directly - it won't combust fully, and you'll be cleaning soot from every solid surface near you (ask me how I know).
I've been thinking about building/3D-printing a mount to operate the flamethrower single-handed, but to be honest, using two hands gives greater control, and the optimal distance between the lighter and the spray can varies with the type of spray can and environmental conditions.
> Also, when you say "nets", do you mean "screens", ie on the windows?
Yes. I buy a box with a fine mesh net, which I cut down to size and attach to the inside of the window using provided mounting strips (adhesive on the window frame size, velcro on the net side). We call this "moskitiera" (mosquito net). For balcony doors, there are variants with the net split in half and held together with magnets - so you can walk through it, and it'll close behind you.
--
[0] - I was once on a two-week camping trip where we were constantly assaulted by swarms of wasps. We didn't know until later that it was because there was a hive under the building near our site. The organizers of that camp actually funded me a supply of hair spray, and designated me as the camp's exterminator. The "cold mode" was useful for cleaning out tents every couple hours. After we left, the owners of the building decided it's too much hassle to clear out the hive, and burned the building down.
Our current windows pivot in the middle which makes a fixed screen impossible.
(They do have a "pane inside" mode which would let you put a screen on the outside but we're 3 floors up and it would be a bit tricky, not to mention inconvenient when the temperature drops.)
Because I want to let more light in?
Because things flying in is approximately not a problem anyway?
Seems perfectly fathomable to me.
(I live in London, occasionally a fly will come in and chill out for a bit before sodding off again.. fine? I've never had a wasp inside even. Our mosquitoes will extremely rarely give you anything nasty. Moths that would fly in aren't the fabric-eating kind. Even leaving aside the other issues, there's no reason to, it wouldn't be worth my time or money to buy them/fit them/have them fitted. I've spent longer writing this comment than being irritated by anything flying in through my windows.)
https://medium.com/@sophanemwise/the-wasp-killing-myth-in-ge...
Wasps are the usual example because it's legal to kill flies/mosquitoes and no one wants to kill the other protected insects like bumblebees. The wasps in Berlin are common and pretty aggressive, and have free rein in an awful lot of the chain backeries.
If it works or not I don't really know but at least I had a bowl of ice cream and wasn't especially bothered..
What I mean is, if this is a commonly believed exaggeration then it could just be that in this case the person believing it wasn't the wasp-killer (or would-be-killer) but the cafe owner. Has your friend ever actually been fined for doing it, or did the cafe owner/manager mention having had to deal with it in the past?
Certainly does seem odd that this law would (a) exist; and (b) be intended to stop this sort of behaviour; and (c) actually be enforced!
I would say mainly it's not enforced because b) has been effective - Germans (or Berliners at least) don't kill wasps! If doing so became common, it would probably be enforced more consistently.
Another factor is the light level. If you have a lot of days with rain or low light, like UK or many other places have, nets reduce even more the level of light entering in the house. Lacking of a lot of the dangerous mosquito borne diseases than tropical places have, the cons weight more than the pros. Would be seen as a better deal in California for example, where the extra shadow is welcomed.
And finally there is some inertia provided by cultural factors. For Dutch allowing everybody to see your room by default (don't have anything to hide here) is a cultural post-war thing also.
Maybe I'm just used to it.
Also it's not only like a cultural thing, I legally had to put screens in every window of my house before it was able to be occupied. Just an anecdote...
It's weird how we never question things like that.
Regarding light - leaving aside however much it blocks light for illumination purposes, what about seeing out? I want to look out of the window, not look at a mesh all but completely obscuring the view.
However, there were also pretty much no bugs; we kept the windows and doors open regularly without an issue - if you tried that were I live now in the US you'd have flies inside making a racket and be eaten alive by mosquitoes.
In South Asia, I could imagine that mosquitos are more dangerous because of diseases they transmit.
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...
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?
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_idI went through:
- matplotlib animations (super slow, not live)
- writing an image with PIL and updating display (flickers)
- custom html+canvas code
- ipycanvas
I call display() on the canvas and then run the draw update loop on the canvas later in the same cell. That way the canvas is first displayed and then "live" updated.
>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