Live data from Hacker News

How many flies are in my apartment?

saml98.github.io

141–150 of 158 posts

Re: How many flies are in my apartment?

#141

Well, there was at least one startup that addressed the issue of flies/mosquitoes indoors. Bzigo. https://bzigo.com/ 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…

> 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.

Re: How many flies are in my apartment?

#142
post #8

Earlier quoted context omitted.

This is the norm in the south asian country I come from. But ever since I moved to the EU, there have been no nets, then again there are noticeably fewer flies here too.

Dont the windows have screens? In the US pretty much every window has a permanent screen outside the panel for this purpose...just assumed it was the same in europe

In California there’s a decent amount of homes without screens. I’ve lived in two apartments that had no screens (one was a fire escape, the other opened outwards and had a latching mechanism that made it impossible to add a screen).

Re: How many flies are in my apartment?

#143

Earlier quoted context omitted.

If there are 100 tanks, and you get 1, 2, 5, and 99, your method would give 54 tanks ((1 + 2 + 5 + 99)/4 * 2), which is obviously wrong. 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")…

Hmmm, on the other hand, suppose you first find a tank with the serial number 1234. 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?

Certainly!

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).

Re: How many flies are in my apartment?

#144

Earlier quoted context omitted.

That's scary. I used to be a hardcore insectaphobe, but I got over it over the last couple years. Now I don't care that much when I see insects in my house. But it is within reason! I wouldn't want bugs reproducing in my house, that sounds like a slippery slope!

> I wouldn't want bugs reproducing in my house, that sounds like a slippery slope! Don’t Google dust mites.

Or Face Mites.

Re: How many flies are in my apartment?

#146

Earlier quoted context omitted.

I admire your perception. I'm personally unable to distinguish different fly specimens, they all look the same to me.

It's only the size and age of them that makes one fly distinguishable from another. When they're all being born at the same time there's absolutely nothing that makes them distinct, and that's your clue that eggs have been laid somewhere in the vicinity.

> It's only the size and age of them that makes one fly distinguishable from another.

Because of their rarity, I find that the ones that wear tiny top hats are easily distinguishable too.

Re: How many flies are in my apartment?

#147
post #13

I tried showing the flies using matplotlib.animation.FuncAnimation in a notebook, animating even 1000 frames is slow and it warns the animation becomes too large. Maybe there's a better way to do it? Preferably in a notebook interface.

I ended up writing some very rudimentary HTML canvas + javascript drawing code into the notebook and for my purposes it's fast and does the job. Just to note to others, that this is a possibility within a Jupyter notebook. 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.

How exactly do you that and can you interop with python?

Re: How many flies are in my apartment?

#148
post #131
post #40

In my statistics class we were taught a technique for estimating the number of flies in a barn. You capture a fixed size sample of flies, e.g. 100, and give them each a little white dot on the back, then release them all back in the barn. Leave them to mingle for a while, then capture another fixed number of flies, e.g. 100. If 5 of them have a white dot on them, then you estimate that the 100 flies you captured orig…

But how do you catch flies!?!?!

Probably using a net and some sort of mild tranquilizer.

Re: How many flies are in my apartment?

#150

Earlier quoted context omitted.

I ended up writing some very rudimentary HTML canvas + javascript drawing code into the notebook and for my purposes it's fast and does the job. Just to note to others, that this is a possibility within a Jupyter notebook. 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.

How exactly do you that and can you interop with python?

I just used this in the Jupyter notebook (toldya it was very simple, written today :).

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"""

            
            Your browser does not support the HTML5 canvas tag.
            """))

        def draw(self, xs, world_size):
            xs_string = json.dumps(xs.tolist())
            obj = ipydisplay.HTML(f"""
            
            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 
            """)
            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
Post reply on HN