#garfield Logs
Nov 27 2022
#garfield Calendar
12:02 AM rue_shop3: so... I have all these crown gears...
12:39 AM rue_shop3: heh, at some point I should stop and get some food
12:56 AM rue_shop3: ooo I have some really fine gears it hates
12:56 AM rue_shop3: >>> peaks are: [2477.35837868 2055.89116294 1941.93480277] at [149, 150, 151] <<<<
12:56 AM rue_shop3: for that to happen, the FFT is a mess
04:36 AM rue_mohr: polprog, no good morning?
04:37 AM rue_mohr: it may me dark but if you speak, the daemons will answer
04:37 AM rue_mohr: I'm cleaning up my shamefull mess of code
06:42 AM rue_mohr: aandrew,
06:42 AM rue_mohr: polar data
06:42 AM rue_mohr: http://ruemohr.org/%7Eircjunk/tempimage/Figure_1a.png
06:42 AM rue_mohr: http://ruemohr.org/%7Eircjunk/tempimage/Figure_1b.png
06:42 AM rue_mohr: a) is the corrected data for the fft
06:42 AM rue_mohr: but the amplitude counter gets the wrong number
06:43 AM rue_mohr: b) has all the angular reverses and ugly stuff it in, but it gets the right count (in this case)
06:44 AM rue_mohr: (its a 119 tooth gear)
06:44 AM rue_mohr: its like...
06:44 AM rue_mohr: it needs some AC coupling
06:59 AM rue_mohr: if I dial my gain to 50 (from 6) I have a dropped tooth, a click (does not quite cross zero, but its not a binary clipping) and a click (extra non-existant tooth)
07:36 AM rue_mohr: after rewriting a version of the code, my amplitude counter doesn't seem to have a hope in hell
07:36 AM rue_mohr: fft is looking great
10:25 AM polprog: evening
10:25 AM polprog: jesus im so tired
10:26 AM polprog: But i got a nice haul
10:32 AM Tom_L: did he wear you out?
10:36 AM polprog: haha
10:36 AM polprog: no, but i got a few cool things.. including a JAMMA PCB that can run NeoGeo games
10:36 AM polprog: well, half of the system buts its a nice find anyway
02:30 PM rue_mohr: morning
02:30 PM * Tom_L checks the clock
02:30 PM rue_mohr: somewhere
02:30 PM rue_mohr: I was up at 6am
02:30 PM rue_mohr: you weren't there
02:30 PM rue_mohr: and polprog wasn't there at 2am
02:31 PM rue_mohr: http://ruemohr.org/%7Eircjunk/tempimage/Figure_1a.png
02:31 PM rue_mohr: http://ruemohr.org/%7Eircjunk/tempimage/Figure_1b.png
02:31 PM rue_mohr: count the teeth :]
02:32 PM rue_mohr: whats funny, is that using the data in diagram a, which is made all nice and tidy, works WORSE then the mess in diagram B
03:46 PM aandrew: rue_mohr: polar = np.stack((np.hypot(ar[:,0,0],ar[:,0,1]), np.arctan2(ar[:,0,0],ar[:,0,1])), axis=1)
03:46 PM aandrew: wtf is that doing in english
04:03 PM Tom_L: rue_mohr, no cause i was up at 3 then 6
04:13 PM rue_mohr: I think a 3.5:1 ratio on the fft data is a good number
04:13 PM rue_mohr: aandrew, oh sorry I wasn't scrolled
04:14 PM rue_mohr: so, a polar co-ordinate is made of two numbers
04:14 PM rue_mohr: an distance from 0,0
04:14 PM rue_mohr: and an angle
04:14 PM rue_mohr: so, say take the cartesian point 1,1
04:15 PM rue_mohr: the distance is sqrt(1^2+1^2)
04:15 PM rue_mohr: aka 1.4
04:15 PM rue_mohr: and the angle is 45 degrees
04:16 PM rue_mohr: np.hypot calculates the distances for all the points in the contour, arctan2 calculates all the angles
04:16 PM rue_mohr: np.stack makes them into a 2d array cause arg.
04:17 PM aandrew: interesting
04:17 PM aandrew: so I stole that from you
04:17 PM aandrew: and so far it's working on all gears
04:17 PM rue_mohr: :] thats ok
04:18 PM rue_mohr: you still have to do magic to it
04:18 PM aandrew: er no, that stacked gear pic it hates still returns bad
04:18 PM rue_mohr: heh, I have an evil one I didn't show you
04:18 PM aandrew: but you have to be careful of values that are between -1 and 1 when you reduce it
04:18 PM rue_mohr: its a white gear from a copier that has black toner all over it
04:18 PM aandrew: I tried amplifying more and it helped but it's still not perfect
04:18 PM rue_mohr: yea, you can know you have bad data if you get fractionals
04:19 PM rue_mohr: I'd like to figure out a way of applying a high pass filter to it
04:19 PM rue_mohr: aandrew, did you see the graph library I was using to see the polar data
04:19 PM rue_mohr: ?
04:20 PM aandrew: no..
04:21 PM rue_mohr: oh try this...
04:21 PM rue_mohr: import matplotlib.pyplot as plt
04:21 PM rue_mohr: plt.plot(list(range(0, len(polar))), polar, [0,len(polar)], [0, 0] )
04:21 PM rue_mohr: plt.show()
04:22 PM rue_mohr: the plot arguments are x,y,x,y,x,y...
04:22 PM rue_mohr: so the x axis is the 'sample' and the y axis is the polar value
04:22 PM rue_mohr: then, there is a line at Y=0
04:22 PM rue_mohr: it helps get a feel for what the numbers are doing
04:24 PM rue_mohr: my data so far looks like a wave that needs to go thru an isolation transformer
04:26 PM aandrew: scipy has a ton of filtering/data manipulation functions
04:27 PM aandrew: interestingly the tooth count is not an integer like I expected
04:27 PM aandrew: https://ibb.co/XSPCrxd
04:28 PM rue_mohr: I dont get numpy vs scipy
04:29 PM rue_mohr: seems to imply uncertianty
04:29 PM rue_mohr: this is where you find yourself dialing the gain to 500
04:29 PM rue_mohr: odd cause thats a really good image
04:30 PM aandrew: I don't like how you subtract one data point if the first/last are equal... seems like a hack
04:30 PM rue_mohr: so, I found that with the white new gears from china, everything generally went pretty smooth
04:30 PM rue_mohr: aandrew, no no
04:30 PM rue_mohr: its the wrap of the data
04:31 PM rue_mohr: so, if your first and last sample are on the top of a tooth, it wouldn't otherwise remove it
04:31 PM rue_mohr: when it reduces it to one sample per tooth
04:31 PM rue_mohr: its because its a linear buffer instead of circular
04:31 PM rue_mohr: eh?
04:32 PM aandrew: hm
04:32 PM aandrew: need to play a bit to better understand
04:32 PM rue_mohr: sure
04:32 PM rue_mohr: look at the data when its reduced to 1 sample/tooth in that chart ting
04:33 PM rue_mohr: -_-_-_-_-_- is actually a 5 tooth gear
04:33 PM rue_mohr: but the first and last sample are the same high point on the same tooth
04:34 PM rue_mohr: a person COULD move the data left/right to start at a zero crossing
04:34 PM rue_mohr: then that wouldn't happen
04:36 PM aandrew: niiiiice: https://ibb.co/PGnQB1W
04:37 PM rue_mohr: "Resample x to num samples using Fourier method along the given axis."
04:37 PM rue_mohr: how did you land that nice one?
04:38 PM rue_mohr: my graphs are all offset horrid
04:38 PM aandrew: plt.subplot(1, 2, 1),plt.imshow(gear_img, 'gray')
04:38 PM aandrew: plt.subplot(1, 2, 2),plt.plot(list(range(0, len(polar))), polar, [0, len(polar)], [0, 0])
04:38 PM rue_mohr: so, see how the first and last bit of the wave is the peak of the same tooth?
04:38 PM aandrew: plt.show()
04:38 PM rue_mohr: subplot!
04:40 PM rue_mohr: most of my gears dont give me data that nice
04:40 PM rue_mohr: your camera is also closer to your gear
04:40 PM rue_mohr: you must have had fun with focus
04:41 PM rue_mohr: http://ruemohr.org/~ircjunk/tempimage/6.jpg <-- rofl
04:42 PM rue_mohr: I dont know why the software cant get it, I can clearly tell its got 138 teeth
04:48 PM rue_mohr: so, why have you got such good contrast just on wood...
04:52 PM rue_mohr: scipy doesn't just have a first order high pass filter, I don't know how to set up params for a FIR
04:55 PM rue_mohr: ugh, the world doesn't do high pass filters, they do low pass
04:55 PM rue_mohr: grrrr
04:56 PM rue_mohr: you know, if a transformer is what I want, I should just take the ... integral of the wave
05:00 PM aandrew: hm
05:00 PM aandrew: https://ibb.co/YjLrdP6
05:00 PM aandrew: why is the teeth list a little weird at the start
05:01 PM aandrew: I spent a fair bit of time trying to focus only to gaussian blur the image anyway :-)
05:01 PM aandrew: on wood?
05:01 PM aandrew: I've got a black cloth
05:02 PM rue_mohr: oh your picture was wood
05:03 PM rue_mohr: you can also clip to +-0.5 and then add 0.5 to the array, and not /2
05:03 PM rue_mohr: BUT
05:03 PM rue_mohr: if you do that, you dont get as much bad-data feedbacj
05:04 PM rue_mohr: can I have one of your images? I think mine are all evil
05:04 PM rue_mohr: and... if you want some evil images...
05:04 PM rue_mohr: the reason the first few cycles are stretched out funny is because of the way the gear was traced
05:05 PM rue_mohr: thats why I had to do a whole lot of junk to be able to feed it into an FFT
05:05 PM aandrew: https://ibb.co/YjLrdP6 that gear gives a really nice tooth plot
05:05 PM rue_mohr: yea
05:05 PM rue_mohr: have a raw photo for it?
05:05 PM aandrew: that's yours
05:06 PM rue_mohr: hah
05:06 PM rue_mohr: I'v processed like 200+ gears...
05:06 PM rue_mohr: I dont know where all the images are...
05:06 PM rue_mohr: oh, is that my 5mp?
05:06 PM rue_mohr: er 9mp?
05:06 PM rue_mohr: the evil gear?
05:06 PM aandrew: https://ibb.co/vmdW366 is my gear
05:06 PM rue_mohr: ok
05:07 PM aandrew: https://ibb.co/z6yNtpt is your collection of gears
05:07 PM rue_mohr: you know those gear kits from china?
05:08 PM rue_mohr: I processed my collection of like 3 or 4 of them last night
05:08 PM rue_mohr: I'v done like 55+ of my photocopier gears
05:08 PM aandrew: https://ibb.co/p4XxqRW is your 53 gear pic on black bg
05:08 PM rue_mohr: for the time of the pi to run that program, it was nice to be able to jam a bunch of small gears under the camera
05:09 PM rue_mohr: yea, your preprocessing is way better than mine
05:09 PM aandrew: yeah you're doing all the gears found as a breadth-first approach, I'm doing it depth-first where I process each gear entirely then move ot hte next
05:09 PM rue_mohr: is that using the preprocessing in the code you posted yesterday?
05:10 PM aandrew: yeah I haven't changed anything there
05:10 PM aandrew: I am *16 instead of *4 in your code, that's the only difference I think
05:10 PM rue_mohr: I'm kinda mulling along trying to acid test the code as I go
05:10 PM rue_mohr: hah, mine is at 6 right now
05:11 PM rue_mohr: I rewrote all my code, but its not as happy
05:11 PM rue_mohr: http://paste.debian.net/1262092/
05:12 PM rue_mohr: the amplitude code is coughing up ugly things now
05:12 PM rue_mohr: (I kept the old code)
05:16 PM aandrew: yeah I moved my dozen versions of the script into git and "walked" the commits forward so I have one script with the changes as it evolved
05:16 PM rue_mohr: :]
05:16 PM rue_mohr: gearcounter72.py
05:16 PM rue_mohr: hahahaha
05:16 PM aandrew: something like that is what it was like before
05:17 PM aandrew: test.py, findmin.py, findmin_better.py, teeth.py, teeth_min2.py...
05:17 PM aandrew: I had to rely on the create dates to help me sort it out
05:17 PM rue_mohr: I would use different methods if it was a collected team thing
05:18 PM rue_mohr: funny, mine started as test.py too
05:19 PM rue_mohr: in the editor I wanted to write, I wanted to have it create an accompanying file that contained a complete undo history
05:22 PM rue_mohr: wow, using your image I get an almost perfect gear profile
05:22 PM rue_mohr: then i get a HUGE heap of auxillary garbage
05:23 PM rue_mohr: >>> peaks are: [35863.43836024] at [28] <<<< (fft result)
05:23 PM rue_mohr: oh wierd
05:23 PM rue_mohr: Amplitude toothcount is: 30.242889279398412
05:24 PM rue_mohr: the chart looked perfect tho
05:26 PM rue_mohr: http://ruemohr.org/~ircjunk/tempimage/Figure_1.png
05:28 PM rue_mohr: oh! teeths = list(polar>0)
05:29 PM rue_mohr: I was learing python too!
05:29 PM rue_mohr: that creates a true/false array
05:29 PM rue_mohr: 0-1, and you dont need /2
05:35 PM aandrew: so I found some HPF code that isn't scipy
05:35 PM aandrew: not sure if it's right or not
05:35 PM aandrew: but it's small
05:35 PM aandrew: yeah I'm a python newb
05:37 PM aandrew: https://pastebin.com/kP0FrGXz
05:37 PM aandrew: the windowing makes the output list length not hte same as the input one so you have to play with it a bit
05:37 PM rue_mohr: I think I used up all my creds in #python to the point they would just kick me out if I went back in there
05:37 PM aandrew: that's why when I'm replacing the polar data I'm using the 'b' length
05:37 PM aandrew: haha
05:37 PM rue_mohr: teeths = list(polar>0)
05:37 PM rue_mohr: then you dont need to multiply or offset
05:38 PM rue_mohr: [False, True, False, True, False, True, False, True, False, True, False, True, False]
05:38 PM rue_mohr: evaluates to 1's and 0's
05:38 PM aandrew: right
05:38 PM aandrew: although that has a slight bias for negative numbers then
05:38 PM aandrew: since 0 will evaluate to false
05:38 PM aandrew: but I doubt it's important
05:39 PM rue_mohr: I'm gonna go that dir, but with the knowledge I get less error-feedback
05:40 PM rue_mohr: isn't skunkworks a cnc person?
05:45 PM aandrew: not sure
05:45 PM aandrew: I gotta put this away, have work I'm gonna get fired for not doing if I don't get to it
05:46 PM rue_mohr: I'll try to catch up to ya
05:58 PM rue_mohr: oh you filter by the area, nice
05:58 PM rue_mohr: didn't catch that one
06:06 PM rue_mohr: ditching profile 124 because the area is ugly...
06:06 PM rue_mohr: oof, thats lots of noise
06:07 PM rue_mohr: hahah
06:07 PM rue_mohr: after the bad areas are filtered out, my other filters have nothing to do
06:09 PM rue_mohr: damn I just put half the changes in the renamed copy of my function and half of it in the replacement function
06:12 PM rue_mohr: damn
06:12 PM rue_mohr: your image prep is good
06:13 PM rue_mohr: it picked it out right away
06:13 PM * rue_mohr taps ctrl-s
06:13 PM rue_mohr: def getContours(filename):
06:13 PM rue_mohr: image = cv2.imread(filename)
06:13 PM rue_mohr: image_gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
06:13 PM rue_mohr: image_gray = cv2.GaussianBlur(image_gray,(15,15),0)
06:13 PM rue_mohr: _,image_gray = cv2.threshold(image_gray, 127, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C + cv2.THRESH_OTSU)
06:13 PM rue_mohr: contours, _ = cv2.findContours(image_gray, cv2.RETR_CCOMP, cv2.CHAIN_APPROX_SIMPLE)
06:13 PM rue_mohr: return contours
06:14 PM rue_mohr: I MIGHT fall back to just the red channel instead of the greyscale
06:14 PM rue_mohr: I have to check things
06:20 PM rue_mohr: image_gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) 58 contours found
06:21 PM rue_mohr: image_gray = image[:,:,2] 74 contours found
06:21 PM rue_mohr: huh
06:21 PM rue_mohr: ok
06:23 PM rue_mohr: well thats with your image
06:23 PM rue_mohr: I'll try a few of mine
06:28 PM rue_mohr: yup, so far grey wins over red
06:28 PM rue_mohr: consistantly
06:31 PM rue_mohr: the fft is really good at nailing the really messy ones tho...
06:32 PM rue_mohr: it correctly got 4 gears last night that were partly off camera
06:32 PM rue_mohr: but sometimes it'll be a tooth off
06:32 PM rue_mohr: (for gears partly off camera)
06:55 PM rue_shop2: get the computers back up after the power outage last night
06:55 PM rue_shop2: looks like the monitor on this one is failing
06:58 PM rue_shop2: computers are off too long and the shop gets cold
06:58 PM rue_shop2: glad I didn't start any cnc jobs yesterday
06:58 PM Tom_L: heh
06:58 PM Tom_L: what you gonna cut?
07:03 PM rue_mohr: more heads
07:03 PM rue_mohr: were running low again
07:04 PM rue_mohr: I was gonna ask the partner if he would like to have you do more
07:04 PM rue_mohr: we dont have any feedback from the last batch yet
07:04 PM Tom_L: head?
07:04 PM rue_mohr: the A9/10
07:04 PM Tom_L: A9?
07:04 PM rue_mohr: need to get an idea how your aluminum plays out int eh field
07:05 PM rue_mohr: it'll be about 4 months before we get orders
07:05 PM Tom_L: that hard stuff i think is about gone
07:05 PM rue_mohr: we got in 4 repairs that all needed heads so
07:05 PM Tom_L: i got some softer stuff i think
07:05 PM Tom_L: http://tom-itx.no-ip.biz:81/~webpage/rue/Can_Holder/A9_New/New_material.jpg
07:06 PM Tom_L: i think i sent some using that
07:06 PM rue_mohr: there was hardened and unhardened in there
07:06 PM Tom_L: right
07:06 PM rue_mohr: cause I got a surprise when the tabs broke off intead of bending over
07:06 PM Tom_L: the hard stuff was wider
07:08 PM Tom_L: you got somebody helping again?
07:09 PM Tom_L: you try the press?
07:09 PM Tom_L: i can't remember much about that project now
07:11 PM rue_mohr: its still the two of us
07:11 PM Tom_L: that last mod we did was ok?
07:11 PM Tom_L: i think we shortened something i forget
07:11 PM Tom_L: no
07:11 PM rue_mohr: I dont think we had a chance to use the press yet, I still have the "instructions" up in tabs on the web browser in the shop
07:11 PM Tom_L: extended the shoulder
07:12 PM rue_mohr: there was a length issue we probably fixed
07:12 PM Tom_L: like 3mm off or something
07:14 PM rue_mohr: it was just a bit
07:22 PM Tom_L: got plenty of triggers?
07:26 PM rue_mohr: I'v not done a stock check
07:26 PM rue_mohr: I could dig thru it all at some point
07:26 PM rue_mohr: we changed the handle design and make a stock of like 40
07:32 PM rue_mohr: reflash resistor box
07:32 PM rue_mohr: and
07:32 PM rue_mohr: uh
07:32 PM rue_mohr: test motor driver
07:33 PM rue_mohr: but I need to get awake at a descent time tommorow
07:37 PM rue_mohr: I'm wondering if I should get a smartwatch and analize my sleep schedule
07:48 PM aandrew: I've been using sleep cycle on ios for over a year. it actually seems pretty damn good
07:49 PM aandrew: I got the watch it's only really used to augment the data with heart rate and maybe moveent, but the phone uses the mic for most of its analysis as far as I'm aware
07:50 PM aandrew: my mistake. been using it for over 4y
08:01 PM aandrew: https://ibb.co/m9hC6p9
08:03 PM aandrew: hah, I sleep marginally better with the moom
08:03 PM aandrew: moon
08:04 PM aandrew: I also seem to sleep significantly (12%) better when I do about 13k steps/day, but it drops off about -5% when I do 15k
08:04 PM aandrew: mildly (+5%) when air pressure is slightly higher than normal
08:04 PM rue_shop2: aha
08:04 PM rue_shop2: that explains the thing
08:05 PM rue_shop2: where everyone comes into work with a bad nights sleep at the same time
08:05 PM aandrew: I also sleep WAY better when I use the CPAP but I fucking hate that thing
08:10 PM Tom_L: rounded up the A9 tooling/fixture
08:11 PM rue_shop2: well damnit
08:12 PM rue_shop2: the firmware update for my resistor box is a bust
08:12 PM rue_shop2: not sure why
08:13 PM rue_shop2: I wonder if its a dodgy avr
08:20 PM rue_shop2: aha
08:20 PM rue_shop2: the usb code is overwriting the manual setting code
08:28 PM rue_shop2: so much for plug and play software
08:28 PM rue_shop2: looks like I stitched a few oops' into my new resistorbox code
08:28 PM rue_shop2: its working
08:28 PM rue_shop2: but
08:28 PM rue_shop2: it wont accept values like 1.2k
08:30 PM rue_shop2: https://paste.debian.net/1262103/
08:30 PM rue_shop2: well, I see issues
08:30 PM rue_shop2: I wonder if this is an old version of my number collector
08:31 PM rue_shop2: oh it looks like 12m456 should work
08:32 PM rue_shop2: maybe that was the snag
09:05 PM rue_shop3: nope
09:05 PM rue_shop3: its picking up random noise and keeps resetting the value to zero
09:10 PM rue_shop3: - get price on 1/4" copper pipe
09:10 PM rue_shop3: - rewrite usb software for resistor box
09:13 PM rue_shop3: ok whats the other simpel thing that can completelty fail for me today
09:29 PM aandrew: for me it was washing the front porch lamp glass
09:29 PM aandrew: unscrewed the metal at the bottom and the entire threaded rod came out instead of just the end piece, so I'm up on the ladder and I went to move the metal holding hte glass up and the glass cracked
09:30 PM aandrew: a 5m procedure turned into about 2h of phone calls/emails/measuring and the sinking feeling that finding replacement glass for a 7yo lamp is probably futile
09:30 PM aandrew: this thing's big too. 12" tall, about 34" circumference at its' largest part
09:50 PM rue_shop3: ok, the cnc machine motor driver didn't blow up this time
09:51 PM rue_shop3: but MAN did that overvoltage get warm!
09:51 PM rue_shop3: aandrew, wow
09:51 PM rue_shop3: yike
09:51 PM rue_shop3: aandrew, my code really liked your preparser
09:52 PM rue_shop3: I have to do a bit more fiddling
09:52 PM rue_shop3: I'll wait till later
11:33 PM rue_mohr: when I connected the