From jep200404 at columbus.rr.com Wed Dec 4 19:16:03 2013 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Wed, 4 Dec 2013 13:16:03 -0500 Subject: [CentralOH] COLUG Meeting Tonight About Robot That Uses Python In-Reply-To: References: Message-ID: <20131204131603.44fa301f.jep200404@columbus.rr.com> COLUG Meeting Tonight About Robot That Uses Python On Tue, 19 Nov 2013 13:17:17 -0500, Scott Merrill wrote to COLUG's mailing list: > Our own Ethan Dicks will introduce us to Tourbot: Telepresence with Open Source. > > Based on RUDEBOT, a Canadian conference-room robot project, Tourbot combines > Python, pygame, Arduino, and Linux into a mobile telepresence platform. See colug.net for details. From brian.costlow at gmail.com Thu Dec 5 02:03:39 2013 From: brian.costlow at gmail.com (Brian Costlow) Date: Wed, 4 Dec 2013 20:03:39 -0500 Subject: [CentralOH] Reminder: COhPy for December is next Monday! Message-ID: Just a friendly reminder that COhPy is meeting on December 9th this month, instead of the last Monday. Details are here: http://www.meetup.com/Central-Ohio-Python-Users-Group/events/149516962/ Please RSVP at Meetup.com if you plan to attend so we can plan for pizza. Thanks! Brian -------------- next part -------------- An HTML attachment was scrubbed... URL: From jep200404 at columbus.rr.com Fri Dec 6 00:00:12 2013 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Thu, 5 Dec 2013 18:00:12 -0500 Subject: [CentralOH] =?utf-8?q?2013-11-29_=E9=81=93=E5=A0=B4_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz8=?= Message-ID: <20131205180012.0e58d0ec.jep200404@columbus.rr.com> Beverage for Pythonistas http://www.blacksheepbrewery.com/beers/holy_grail_bottled_beer gevent 1.0 released http://blog.gevent.org/2013/11/26/gevent-1-0-released/ ??? http://bash.cumulonim.biz/BashPitfalls.html wp:EdX wp:Windows PowerShell permmod heck https://www.django-cms.org/en/blog/2012/10/03/the-future-moderator/ http://www.richarddawkins.net/foundation_articles/2013/11/27/top-10-questions-from-richard-s-live-chat-on-reddit wp:Richard Dawkins wp:Wendy Wright https://duckduckgo.com/html/?q=stephen+hawking+wendy+wright Name of benzene is not after Benz of Mercedes Benz wp:Benzene In 1833, Eilhard Mitscherlich produced it via the distillation of benzoic acid (from gum benzoin) and lime. He gave the compound the name benzin. http://upload.wikimedia.org/wikipedia/commons/1/15/C-141_Starlifter_with_penguins.jpg http://en.wikipedia.org/wiki/Sweet_Baby_James Red Revenge by ramyb Mort-vivant by Radscoolian Seems Fishy... by Radcoolian Monty Python's Holy Gr^H^Hail some non Asian Lee's wp:Robert E. Lee wp:Vivien Leigh wp:Spike Lee wp:Bill Lee (musician) wp:Brenda Lee wp:Charles Lee (general) wp:Christopher Lee wp:David Lee (physicist) wp:Dorothy Lee (actress) wp:Edwin Gray Lee wp:Fitzhugh Lee wp:Francis Lightfoot Lee wp:Francis Lee wp:Alvin Lee wp:Anna Lee wp:Ann Lee wp:Amy Lee wp:Amos Lee wp:Albert Lee wp:Alan Lee (footballer) wp:Lee Harvey Oswald wp:Temperance movement http://www.wctu.org/ From jep200404 at columbus.rr.com Thu Dec 5 17:53:50 2013 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Thu, 5 Dec 2013 11:53:50 -0500 Subject: [CentralOH] =?utf-8?q?2013-10-04_=E9=81=93=E5=A0=B4_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz8=?= Message-ID: <20131205115350.194e5f35.jep200404@columbus.rr.com> http://www.meetup.com/girldevelopitcbus/ http://www.meetup.com/girldevelopitcbus/events/142740512/ Tommy Emmanuel wp:The_Day_Finger_Pickers_Took_Over_The_World wp:Fur_Peace_Ranch with Jorma Kaukonen https://www.youtube.com/watch?v=Ugq13M21Bxw Tommy Emmanuel performed two sold out nights at Jorma's Fur Peace Ranch during the 2012 season! Jorma came out on Saturday to join Tommy! This is one of the few songs they played together! http://www.scottyhallphotography.com http://www.furpeaceranch.com wp:Jorma_Kaukonen ---- valves for car and many bicycle tires are same wp:Schrader_valve shekinah festival pawpaw festival ohio linux festival game dev conference euler #80 11.7 ms wp:Yo_La_Tengo wp:Ira_Kaplan wp:Georgia_Hubley wp:James_McNew Use low beams in fog. Do _not_ use high beams in fog. #5 in http://www.wikihow.com/Drive-Safely-in-Fog http://www.autoinsurancequotes.com/news/headlights ---- avant-garde music Laurie Anderson soft: Mister Heartbreak hard: Big Science The Art of Noise In Visible Silence wp:Home_of_the_Brave_(1986_film) shibboleth musicians earplugs http://docs.python.org/2/library/sys.html SO/IEC 9899:1999. ?Programming languages ? C.? A public draft of this standard is available at http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf Learning Python is excellent http://shop.oreilly.com/product/9781565924642.do Columbus Python Workshop for women and their friends http://www.meetup.com/Central-Ohio-Python-Users-Group/events/135566022/ %r for repr() http://docs.python.org/2/library/stdtypes.html#string-formatting-operations wp:Leo Kottke wp:Mel Bay Vaseline Machine Gun repr() versus str() sys.argv http://docs.python.org/2/library/sys.html#sys.argv wp:The_Unix_Programming_Environment by Kernighan & Pike wp:C_(programming_language) New and Old Testaments emacs versus vi(m) wp:Pop_Pop http://english.chosun.com/site/data/html_dir/2013/09/14/2013091400409.html http://www.dispatch.com/content/stories/local/2013/04/28/28-two-dead-in-hocking-hills.html From looiebwv at gmail.com Sun Dec 8 17:09:37 2013 From: looiebwv at gmail.com (Louis Bogdan) Date: Sun, 8 Dec 2013 11:09:37 -0500 Subject: [CentralOH] (no subject) Message-ID: Hi folks @central oh/python: As a recent subscriber, I received notice of your Dec 9 meeting from Brian. As I am working on a program to go along with a recently filed patent, and am totally new to Python, I sent him a proposed ?subroutine?. This is used repetitively within the program. Since I sent it to Brian, I have done some more research and have come up with a better version as follows: num = 1.2346 a = num(-1) b = num(-2) if a >7: a = 0 b+ =1 elif a<3: a = 0 else: a = 5 As each stepper motor step equals .0005? of movement, with the above I can get .0002? absolute positional accuracy with a .0005? control increment. I have looked at some of the Python ?round? statements and examples and don?t fully understand them so as an ?ole? retired engunear, (does 93 qualify me) I thunk up my own way of doing things. Maybe some of you young ones can teach an ole man how to do things better. This routine also has application in several other projects I have under consideration. Would something like this, if it works, be a Python library item? If any of you can ?tweek? the above into working order I would appreciate it. I do have some other questions for you. What do I need to buy to get started with RPi? I will be using my Apple computer. Thank you for any comments you might have. Lou Bigdan -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrewcfitzgerald at gmail.com Sun Dec 8 17:34:57 2013 From: andrewcfitzgerald at gmail.com (Andrew Fitzgerald) Date: Sun, 8 Dec 2013 11:34:57 -0500 Subject: [CentralOH] (no subject) In-Reply-To: References: Message-ID: Hi Lou, Could you perhaps provide a summary of what that code is supposed to do? Right now you're assigning num the numeric value 1.2346 on the first line. You're then attempting to call num as a function on the next 2 lines. This won't work because num hasn't been defined as a function anywhere, and if it was the function is overwritten by the value 1.2346 on the first line. The part below that (if/else) looks like it should work if a and b are assigned numeric values. -Andrew Fitzgerald On Sun, Dec 8, 2013 at 11:09 AM, Louis Bogdan wrote: > Hi folks @central oh/python: > > > > As a recent subscriber, I received notice of your Dec 9 meeting from Brian. > As I am working on a program to go along with a recently filed patent, and > am totally new to Python, I sent him a proposed ?subroutine?. This is > used repetitively within the program. Since I sent it to Brian, I have > done some more research and have come up with a better version as follows: > > > > num = 1.2346 > > a = num(-1) > > b = num(-2) > > if a >7: > > a = 0 > > b+ =1 > > elif a<3: > > a = 0 > > else: > > a = 5 > > > > As each stepper motor step equals .0005? of movement, with the above I can > get .0002? absolute positional accuracy with a .0005? control increment. I > have looked at some of the Python ?round? statements and examples and don?t > fully understand them so as an ?ole? retired engunear, (does 93 qualify me) > I thunk up my own way of doing things. Maybe some of you young ones can > teach an ole man how to do things better. > > > > This routine also has application in several other projects I have under > consideration. Would something like this, if it works, be a Python library > item? > > > > If any of you can ?tweek? the above into working order I would appreciate > it. I do have some other questions for you. What do I need to buy to > get started with RPi? I will be using my Apple computer. > > > > Thank you for any comments you might have. Lou Bigdan > > > > > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From looiebwv at gmail.com Sun Dec 8 20:36:01 2013 From: looiebwv at gmail.com (Louis Bogdan) Date: Sun, 8 Dec 2013 14:36:01 -0500 Subject: [CentralOH] (no subject) In-Reply-To: References: Message-ID: I will start out by saying,"Have you heard that a LITTLE bit of knowledge is a dangerous thing?" Well, I am the Poster Boy for that saying. num is calculated value 1.2346 a=num(-1) is indicating the numeral "6" with negative indexing notation. b=num(-2) is indicating the numeral "4" " " " ". if numeral "6" is greater than "7" make numeral "6" a "0" and increment the "4" to "5". elif numeral "6" is less than"3", meaning a "0", "1", or "2", make it a "0". else none of the above conditions apply, make numeral "6" a "5". EXAMPLE: 1.2340, 1.2341, 1.2342 become 1.2340 1.2348, 1.2349 become 1.2350 1.2343, 1/2344, 1.2345, 1.2346. 1.2347 become 1.2345. So with the "Bogdan" rounding, I am never more than .0002" off calculated position. I then divide the modified num 1.2345 by .0005 and get 2469 which is the number of steps required of the stepper motor to provide a movement of 1.2345" (-.0001" from theoretical.) I hope that explains MY way of talking to a computer. How would you talk to Python and say the same thing and Python says,"MAN, I know what you want!? Lou On Sun, Dec 8, 2013 at 11:34 AM, Andrew Fitzgerald < andrewcfitzgerald at gmail.com> wrote: > Hi Lou, > > Could you perhaps provide a summary of what that code is supposed to do? > > Right now you're assigning num the numeric value 1.2346 on the first line. > > You're then attempting to call num as a function on the next 2 lines. > > This won't work because num hasn't been defined as a function anywhere, > and if it was the function is overwritten by the value 1.2346 on the first > line. > > > The part below that (if/else) looks like it should work if a and b are > assigned numeric values. > > -Andrew Fitzgerald > > > On Sun, Dec 8, 2013 at 11:09 AM, Louis Bogdan wrote: > >> Hi folks @central oh/python: >> >> >> >> As a recent subscriber, I received notice of your Dec 9 meeting from >> Brian. As I am working on a program to go along with a recently filed >> patent, and am totally new to Python, I sent him a proposed ?subroutine?. >> This is used repetitively within the program. Since I sent it to Brian, >> I have done some more research and have come up with a better version as >> follows: >> >> >> >> num = 1.2346 >> >> a = num(-1) >> >> b = num(-2) >> >> if a >7: >> >> a = 0 >> >> b+ =1 >> >> elif a<3: >> >> a = 0 >> >> else: >> >> a = 5 >> >> >> >> As each stepper motor step equals .0005? of movement, with the above I >> can get .0002? absolute positional accuracy with a .0005? control >> increment. I have looked at some of the Python ?round? statements and >> examples and don?t fully understand them so as an ?ole? retired engunear, >> (does 93 qualify me) I thunk up my own way of doing things. Maybe some >> of you young ones can teach an ole man how to do things better. >> >> >> >> This routine also has application in several other projects I have under >> consideration. Would something like this, if it works, be a Python library >> item? >> >> >> >> If any of you can ?tweek? the above into working order I would appreciate >> it. I do have some other questions for you. What do I need to buy to >> get started with RPi? I will be using my Apple computer. >> >> >> >> Thank you for any comments you might have. Lou Bigdan >> >> >> >> >> >> _______________________________________________ >> CentralOH mailing list >> CentralOH at python.org >> https://mail.python.org/mailman/listinfo/centraloh >> >> > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jep200404 at columbus.rr.com Sun Dec 8 20:36:08 2013 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Sun, 8 Dec 2013 14:36:08 -0500 Subject: [CentralOH] Refactoring Motor Control Code? In-Reply-To: References: Message-ID: <20131208143608.0a10b8d7.jep200404@columbus.rr.com> On Sun, 8 Dec 2013 11:09:37 -0500, Louis Bogdan wrote: > As I ... am totally new to Python ... Come to the dojos. They are good for beginners (and others also). We can explore really bad ways and some OK ways to do things. Download big files before coming. > ... proposed ?subroutine? ... What you have is not a subroutine (which would be called a "function" in Python), but could become one. > num = 1.2346 > > a = num(-1) > > b = num(-2) I concur with Fitzgerald. > if a >7: > > a = 0 > > b+ =1 > > elif a<3: > > a = 0 > > else: > > a = 5 goal = 5 # Unit is what? tolerance = 2 # Unit is what? error = a - goal if error > +tolerance: a = 0 n_too_high += 1 elif error < -tolerance: a = 0 else: a = goal The asymmetry between a being too high or too low is curious. Why don't you count the number of times that a is too low? error = a - goal if abs(error) <= tolerance: a = goal else: a = 0 if error > 0: n_too_high += 1 else: n_too_low += 1 Magic numbers are evil[2]. Give them meaningful names. Read and follow PEP 8.[1] Names are important. Rename b to something meaningful like number_of_times_too_high or n_too_high. Choose a better name for goal. Document the units for each name. > This routine also has application in several other projects I > have under consideration. Would something like this, if it > works, be a Python library item? What you showed is not a routine (i.e. function), but could become one. If you use it from many modules, then it probably should go into a separate module to be imported. > As each stepper motor step equals .0005? of movement, > with the above I can get .0002? absolute positional accuracy > with a .0005? control increment. It is curius that .0005" is not an even multiple of .0002". Are you microstepping the stepper motors? Do you have positioning feedback? Thermal expansion is fun. Are you confusing accuracy with resolution? At least one folk who attends the dojos has experience with embedded programming and moving stuff. Bresenham's algorithm[4] is fun. Again, document the units for each name in the code. > I have looked at some of the Python ?round? statements and > examples and don?t fully understand them ... It helps to know what you are trying to accomplish before figuring out _how_ to accomplish it. What are you trying to accomplish? What are the inputs? What are the outputs? In answering the above, try to avoid speaking in terms that suggest a how to accomplish whatever your goal is. You might recognize similar statements from your career. Let's have some fun with bad tricky ways of doing stuff. too_much = [0] *2 ... error = a - goal if abs(error) <= tolerance: a = goal else: a = 0 # The following is too tricky, so do not do it. too_much[error < 0] += 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - error = a - goal # The following is also too tricky. a = goal if abs(error) <= tolerance else 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > What do I need to buy to get started with RPi? enthusiasm (Urban Meyer sells this) Raspberry Pi B (avoid the A model) power supply SDHC card (get a fast one!) A display that handles HDMI input, and HDMI cable could be helpful. USB keyboard and USB mouse could be helpful. Network connection could be helpful. Go to Microcenter on Bethel. Also read "The Zen of Python"[3]. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - n = {-1: 0, 0: 0, 1: 0} n = dict((i, 0) for i in (-1, 0, 1)) n = dict((i-1, 0) for i in range(3)) ... # And finally, monsieur, a wafer-thin mint. # It's just two wafer thin lines. # Just the one, sir... voila... bon app?tit... n[min(1, max(-1, ((a - (goal - tolerance)) / (2 * tolerance + 1))))] += 1 a = goal * (not ((a - (goal - tolerance)) / (2 * tolerance + 1))) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [1] http://www.python.org/dev/peps/pep-0008/ [2] https://en.wikipedia.org/wiki/Magic_number_(programming)#Unnamed_numerical_constants [3] http://www.python.org/dev/peps/pep-0020/ Extra bonus points for reading ZMM https://en.wikipedia.org/wiki/Zen_and_the_Art_of_Motorcycle_Maintenance [4] https://en.wikipedia.org/wiki/Bresenham's_line_algorithm From jep200404 at columbus.rr.com Sun Dec 8 20:40:10 2013 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Sun, 8 Dec 2013 14:40:10 -0500 Subject: [CentralOH] Plucking Digits From Float In-Reply-To: References: Message-ID: <20131208144010.16e1a950.jep200404@columbus.rr.com> On Sun, 8 Dec 2013 14:36:01 -0500, Louis Bogdan wrote: > num is calculated value 1.2346 > a=num(-1) is indicating the numeral "6" with negative indexing notation. > b=num(-2) is indicating the numeral "4" " " I question the sanity of do so. Nonetheless. num = 1.2346 a = str(num)[-1] b = str(num)[-2] print num, a, b From brian.costlow at gmail.com Sun Dec 8 20:49:49 2013 From: brian.costlow at gmail.com (Brian Costlow) Date: Sun, 8 Dec 2013 14:49:49 -0500 Subject: [CentralOH] (no subject) In-Reply-To: References: Message-ID: This was my quick & dirt response to an email from Louis, and Louis reply, which I have not digested yet. I pointed him at the list as I'm kind of buried with some other stuff this weekend. You get the same rounding, will take any numeric or a string representing numeric, no float imprecision, no weird string manipulation. >>> from decimal import Decimal as D >>> multiplier_val = D('2000') >>> quant_val = D('1') >>> def custom_round(number): ... number = D(str(number)) ... return (number * multiplier_val).quantize(quant_val) / multiplier_val >>> custom_round(1.2340) Decimal('1.234') >>> custom_round(1.2341) Decimal('1.234') >>> custom_round(1.2342) Decimal('1.234') >>> custom_round(1.2343) Decimal('1.2345') >>> custom_round(1.2346) Decimal('1.2345') >>> custom_round(1.2347) Decimal('1.2345') >>> custom_round(1.2348) Decimal('1.235') >>> custom_round(1.2349) Decimal('1.235') I'm so familiar with the details of my invention and its ramifications that I didn't provide you with enough details. to explain my approach. I am looking to make this a subroutine for the following reasons: 1. For various applications, there can be many number, N inputs. 2. For each N input, there can be as many as 30 variable incremental modifications to N, each modification requiring that "subroutine" to make sure that N is in suitable form for later usage. 3. The program to run this only requires the input of N and formula created range of increments thus negating any access to N variations and increments during the cycle. 4. So with this "subroutine" I have .0002" absolute positional accuracy with .0005" increment control and other accuracies can be obtained with positional variations. I hope this clarifies my original email. Lou On Sun, Dec 8, 2013 at 2:36 PM, Louis Bogdan wrote: > I will start out by saying,"Have you heard that a LITTLE bit of knowledge > is a dangerous thing?" Well, I am the Poster Boy for that saying. > > num is calculated value 1.2346 > a=num(-1) is indicating the numeral "6" with negative indexing notation. > b=num(-2) is indicating the numeral "4" " " > " ". > > if numeral "6" is greater than "7" make numeral "6" a "0" and increment > the "4" to "5". > elif numeral "6" is less than"3", meaning a "0", "1", or "2", make it a > "0". > else none of the above conditions apply, make numeral "6" a "5". > > EXAMPLE: 1.2340, 1.2341, 1.2342 become 1.2340 > 1.2348, 1.2349 become 1.2350 > 1.2343, 1/2344, 1.2345, 1.2346. 1.2347 become 1.2345. > > So with the "Bogdan" rounding, I am never more than .0002" off calculated > position. > I then divide the modified num 1.2345 by .0005 and get 2469 which is the > number of steps required of the stepper motor to provide a movement of > 1.2345" (-.0001" from theoretical.) > > I hope that explains MY way of talking to a computer. How would you talk > to Python and say the same thing and Python says,"MAN, I know what you > want!? Lou > > > On Sun, Dec 8, 2013 at 11:34 AM, Andrew Fitzgerald < > andrewcfitzgerald at gmail.com> wrote: > >> Hi Lou, >> >> Could you perhaps provide a summary of what that code is supposed to do? >> >> Right now you're assigning num the numeric value 1.2346 on the first line. >> >> You're then attempting to call num as a function on the next 2 lines. >> >> This won't work because num hasn't been defined as a function anywhere, >> and if it was the function is overwritten by the value 1.2346 on the first >> line. >> >> >> The part below that (if/else) looks like it should work if a and b are >> assigned numeric values. >> >> -Andrew Fitzgerald >> >> >> On Sun, Dec 8, 2013 at 11:09 AM, Louis Bogdan wrote: >> >>> Hi folks @central oh/python: >>> >>> >>> >>> As a recent subscriber, I received notice of your Dec 9 meeting from >>> Brian. As I am working on a program to go along with a recently filed >>> patent, and am totally new to Python, I sent him a proposed ?subroutine?. >>> This is used repetitively within the program. Since I sent it to >>> Brian, I have done some more research and have come up with a better >>> version as follows: >>> >>> >>> >>> num = 1.2346 >>> >>> a = num(-1) >>> >>> b = num(-2) >>> >>> if a >7: >>> >>> a = 0 >>> >>> b+ =1 >>> >>> elif a<3: >>> >>> a = 0 >>> >>> else: >>> >>> a = 5 >>> >>> >>> >>> As each stepper motor step equals .0005? of movement, with the above I >>> can get .0002? absolute positional accuracy with a .0005? control >>> increment. I have looked at some of the Python ?round? statements and >>> examples and don?t fully understand them so as an ?ole? retired engunear, >>> (does 93 qualify me) I thunk up my own way of doing things. Maybe some >>> of you young ones can teach an ole man how to do things better. >>> >>> >>> >>> This routine also has application in several other projects I have under >>> consideration. Would something like this, if it works, be a Python library >>> item? >>> >>> >>> >>> If any of you can ?tweek? the above into working order I would >>> appreciate it. I do have some other questions for you. What do I need >>> to buy to get started with RPi? I will be using my Apple computer. >>> >>> >>> >>> Thank you for any comments you might have. Lou Bigdan >>> >>> >>> >>> >>> >>> _______________________________________________ >>> CentralOH mailing list >>> CentralOH at python.org >>> https://mail.python.org/mailman/listinfo/centraloh >>> >>> >> >> _______________________________________________ >> CentralOH mailing list >> CentralOH at python.org >> https://mail.python.org/mailman/listinfo/centraloh >> >> > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jep200404 at columbus.rr.com Sun Dec 8 21:00:07 2013 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Sun, 8 Dec 2013 15:00:07 -0500 Subject: [CentralOH] Say What You Want To Accomplish In-Reply-To: References: Message-ID: <20131208150007.42d09110.jep200404@columbus.rr.com> On Sun, 8 Dec 2013 14:36:01 -0500, Louis Bogdan wrote: > if numeral "6" is greater than "7" make numeral "6" a "0" and increment the > "4" to "5". > elif numeral "6" is less than"3", meaning a "0", "1", or "2", make it a "0". > else none of the above conditions apply, make numeral "6" a "5". Uggh! There is a simple problem with a simple solution hiding in the above. Tell us what you want to accomplish in prose, without magic numbers, without suggesting implementations. Do not overthink it. Name the quantities. If those are not the right terms, use the right ones. Tell us about the hardware. What are its capabilities? What are its limitations? > if numeral "6" is greater than "7" ... "6" is greater than "7" for sufficiently large values of "6". :-) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - step_resolution = 0.0005 # Unit is one inch. def closest(x, resolution): return round(x / resolution) * resolution for x in range(10 + 1): x = (12340 + x) / 10000.0 print x, closest(x, step_resolution) From jep200404 at columbus.rr.com Sun Dec 8 21:09:01 2013 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Sun, 8 Dec 2013 15:09:01 -0500 Subject: [CentralOH] What is the form suitable for later use? In-Reply-To: References: Message-ID: <20131208150901.4a1da964.jep200404@columbus.rr.com> On Sun, 8 Dec 2013 14:49:49 -0500, Brian Costlow wrote: > ... each modification requiring that "subroutine" to make > sure that N is in suitable form for later usage. What is the form suitable for later use? From brian.costlow at gmail.com Sun Dec 8 21:11:04 2013 From: brian.costlow at gmail.com (Brian Costlow) Date: Sun, 8 Dec 2013 15:11:04 -0500 Subject: [CentralOH] What is the form suitable for later use? In-Reply-To: <20131208150901.4a1da964.jep200404@columbus.rr.com> References: <20131208150901.4a1da964.jep200404@columbus.rr.com> Message-ID: No idea, that part was Louis' response, but I'm guessing that he means it's rounded as described above so it always lands on a step. On Sun, Dec 8, 2013 at 3:09 PM, wrote: > On Sun, 8 Dec 2013 14:49:49 -0500, Brian Costlow > wrote: > > > ... each modification requiring that "subroutine" to make > > sure that N is in suitable form for later usage. > > What is the form suitable for later use? > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > -------------- next part -------------- An HTML attachment was scrubbed... URL: From looiebwv at gmail.com Sun Dec 8 22:10:09 2013 From: looiebwv at gmail.com (Louis Bogdan) Date: Sun, 8 Dec 2013 16:10:09 -0500 Subject: [CentralOH] (no subject) In-Reply-To: References: Message-ID: I see that there are some questions about my explanation of what I'm trying to do. Would it clarify things if my explanation read as follows: num(-1) denotes right-hand most digit of num in index position notation num(-2) denotes the 3rd position digit of num in index position notation. I don't know how to say it in computer language, that's why I'm asking for your help. Lou On Sun, Dec 8, 2013 at 2:49 PM, Brian Costlow wrote: > This was my quick & dirt response to an email from Louis, and Louis reply, > which I have not digested yet. I pointed him at the list as I'm kind of > buried with some other stuff this weekend. > > You get the same rounding, will take any numeric or a string representing > numeric, no float imprecision, no weird string manipulation. > > >>> from decimal import Decimal as D > >>> multiplier_val = D('2000') > >>> quant_val = D('1') > >>> def custom_round(number): > ... number = D(str(number)) > ... return (number * multiplier_val).quantize(quant_val) / multiplier_val > > >>> custom_round(1.2340) > Decimal('1.234') > >>> custom_round(1.2341) > Decimal('1.234') > >>> custom_round(1.2342) > Decimal('1.234') > >>> custom_round(1.2343) > Decimal('1.2345') > >>> custom_round(1.2346) > Decimal('1.2345') > >>> custom_round(1.2347) > Decimal('1.2345') > >>> custom_round(1.2348) > Decimal('1.235') > >>> custom_round(1.2349) > Decimal('1.235') > > I'm so familiar with the details of my invention and its ramifications > that I didn't provide you with enough details. to explain my approach. I am > looking to make this a subroutine for the following reasons: > 1. For various applications, there can be many number, N inputs. > 2. For each N input, there can be as many as 30 variable incremental > modifications to N, each modification requiring that "subroutine" to make > sure that N is in suitable form for later usage. > 3. The program to run this only requires the input of N and formula > created range of increments thus negating any access to N variations and > increments during the cycle. > 4. So with this "subroutine" I have .0002" absolute positional accuracy > with .0005" increment control and other accuracies can be obtained with > positional variations. I hope this clarifies my original email. Lou > > > > > On Sun, Dec 8, 2013 at 2:36 PM, Louis Bogdan wrote: > >> I will start out by saying,"Have you heard that a LITTLE bit of knowledge >> is a dangerous thing?" Well, I am the Poster Boy for that saying. >> >> num is calculated value 1.2346 >> a=num(-1) is indicating the numeral "6" with negative indexing notation. >> b=num(-2) is indicating the numeral "4" " " >> " ". >> >> if numeral "6" is greater than "7" make numeral "6" a "0" and increment >> the "4" to "5". >> elif numeral "6" is less than"3", meaning a "0", "1", or "2", make it a >> "0". >> else none of the above conditions apply, make numeral "6" a "5". >> >> EXAMPLE: 1.2340, 1.2341, 1.2342 become 1.2340 >> 1.2348, 1.2349 become 1.2350 >> 1.2343, 1/2344, 1.2345, 1.2346. 1.2347 become 1.2345. >> >> So with the "Bogdan" rounding, I am never more than .0002" off calculated >> position. >> I then divide the modified num 1.2345 by .0005 and get 2469 which is the >> number of steps required of the stepper motor to provide a movement of >> 1.2345" (-.0001" from theoretical.) >> >> I hope that explains MY way of talking to a computer. How would you talk >> to Python and say the same thing and Python says,"MAN, I know what you >> want!? Lou >> >> >> On Sun, Dec 8, 2013 at 11:34 AM, Andrew Fitzgerald < >> andrewcfitzgerald at gmail.com> wrote: >> >>> Hi Lou, >>> >>> Could you perhaps provide a summary of what that code is supposed to do? >>> >>> Right now you're assigning num the numeric value 1.2346 on the first >>> line. >>> >>> You're then attempting to call num as a function on the next 2 lines. >>> >>> This won't work because num hasn't been defined as a function anywhere, >>> and if it was the function is overwritten by the value 1.2346 on the first >>> line. >>> >>> >>> The part below that (if/else) looks like it should work if a and b are >>> assigned numeric values. >>> >>> -Andrew Fitzgerald >>> >>> >>> On Sun, Dec 8, 2013 at 11:09 AM, Louis Bogdan wrote: >>> >>>> Hi folks @central oh/python: >>>> >>>> >>>> >>>> As a recent subscriber, I received notice of your Dec 9 meeting from >>>> Brian. As I am working on a program to go along with a recently filed >>>> patent, and am totally new to Python, I sent him a proposed ?subroutine?. >>>> This is used repetitively within the program. Since I sent it to >>>> Brian, I have done some more research and have come up with a better >>>> version as follows: >>>> >>>> >>>> >>>> num = 1.2346 >>>> >>>> a = num(-1) >>>> >>>> b = num(-2) >>>> >>>> if a >7: >>>> >>>> a = 0 >>>> >>>> b+ =1 >>>> >>>> elif a<3: >>>> >>>> a = 0 >>>> >>>> else: >>>> >>>> a = 5 >>>> >>>> >>>> >>>> As each stepper motor step equals .0005? of movement, with the above I >>>> can get .0002? absolute positional accuracy with a .0005? control >>>> increment. I have looked at some of the Python ?round? statements and >>>> examples and don?t fully understand them so as an ?ole? retired engunear, >>>> (does 93 qualify me) I thunk up my own way of doing things. Maybe >>>> some of you young ones can teach an ole man how to do things better. >>>> >>>> >>>> >>>> This routine also has application in several other projects I have >>>> under consideration. Would something like this, if it works, be a Python >>>> library item? >>>> >>>> >>>> >>>> If any of you can ?tweek? the above into working order I would >>>> appreciate it. I do have some other questions for you. What do I >>>> need to buy to get started with RPi? I will be using my Apple >>>> computer. >>>> >>>> >>>> >>>> Thank you for any comments you might have. Lou Bigdan >>>> >>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> CentralOH mailing list >>>> CentralOH at python.org >>>> https://mail.python.org/mailman/listinfo/centraloh >>>> >>>> >>> >>> _______________________________________________ >>> CentralOH mailing list >>> CentralOH at python.org >>> https://mail.python.org/mailman/listinfo/centraloh >>> >>> >> >> _______________________________________________ >> CentralOH mailing list >> CentralOH at python.org >> https://mail.python.org/mailman/listinfo/centraloh >> >> > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jep200404 at columbus.rr.com Sun Dec 8 23:06:01 2013 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Sun, 8 Dec 2013 17:06:01 -0500 Subject: [CentralOH] State The Problem Simply In-Reply-To: References: Message-ID: <20131208170601.52548c40.jep200404@columbus.rr.com> State your problem simply. On Sun, 8 Dec 2013 16:10:09 -0500, Louis Bogdan wrote: > I see that there are some questions about my explanation of what I'm trying > to do. Would it clarify things if my explanation read as follows: > num(-1) denotes right-hand most digit of num in index position notation > num(-2) denotes the 3rd position digit of num in index position notation. I understand your notation. All the talk about picking out digits and doing things depending on which digit has which value is an awkward way of stating your problem. > I don't know how to say it in computer language, ... So say it in engunearing English. The following is an example of how to simply state a problem. I have stepper motors with a given resolution. For a given absolute position and stepper motor resolution, I want to calculate the number of absolute steps that is closest to the given absolute position. How would I do that in Python? The above is just an example of how to state a problem simply. The problem stated above is different that your problem. State your problem so simply. I could have made the statement complicated by mentioning a particular resolution and what to do based on which digit has which value. That would just obscure the problem. A solution to the above problem might be something like: def foo(d, steps_per_unit): '''Returns number of stepper motor steps closest to given distance d, for stepper motor step resolution steps_per_unit. Unit in steps_per_unit must be same as unit of d.''' return int(round(d * steps_per_unit)) MOTOR_STEP_RATE = 2000 # Unit is 1 step/inch. foo(1.23456, MOTOR_STEP_RATE) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - A solution to the another problem might be something like: def goo(d, steps_per_unit): '''Returns closest distance to d that a steps_per_unit stepper motor can achieve. Unit in steps_per_unit must be same as unit of d.''' return round(d * steps_per_unit) / steps_per_unit MOTOR_STEP_RATE = 2000 # Unit is 1 step/inch. goo(1.23456, MOTOR_STEP_RATE) From jep200404 at columbus.rr.com Sun Dec 8 23:12:24 2013 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Sun, 8 Dec 2013 17:12:24 -0500 Subject: [CentralOH] =?utf-8?q?2013-12-06_=E9=81=93=E5=A0=B4_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz8=?= Message-ID: <20131208171224.6e6122cb.jep200404@columbus.rr.com> Solved a messy Python package/virtualenv problem. Python T-shirt: The House Always Wins by Wenceslao Almazan wenceslaoalmazan.com shirt.woot.com/offers/the-house-always-wins aromaku indonesian food truck recommended by facebook.com/ar0maku https://twitter.com/Ar0maku pdfa/Wes McKinney/pandas Try to install most Python packages within a virtual environment with pip. Install the barest minimum of Python packages with the system package manager. Had much trouble with python packages in Linux Mint 15 MATE 32-bit New virtual environments inherited all packages from system, even with --no-site-packages. Could _not_ avoid inheriting system Python packages. Linux Mint installs many Python packages. Someone did a clean install of the Linux above, and found that installing pip by installing virtualenv, seemed to solve the problem. See the attached tarball. Compare requirements.20131207-1630-initial with foo/requirements.20131207-1633-initial. Follow installation in "installation" file. The linuxmint-15-mate-dvd-32bit-20131207-1454-after-install-before-update file might be helpful for restoring the messed up system. Look at output of diff between above file and current list of installed system packages. Pup In Training by fablefire shirt.woot.com/offers/pup-in-training -------------- next part -------------- A non-text attachment was scrubbed... Name: virtualenv.tgz Type: application/x-gzip Size: 33598 bytes Desc: not available URL: From jep200404 at columbus.rr.com Mon Dec 9 15:24:20 2013 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Mon, 9 Dec 2013 09:24:20 -0500 Subject: [CentralOH] Meeting Reminder Message-ID: <20131209092420.0f76fb0e.jep200404@columbus.rr.com> Meeting tonight Eric Floehr will be giving a talk on computer vision in Python. http://www.meetup.com/Central-Ohio-Python-Users-Group/events/149516962/ The Explorers Club at 1586 South High Street is open until 10pm, so is a candidate for after the meeting. http://www.explorersclubmv.com/ From joe at joeshaw.org Mon Dec 9 15:57:31 2013 From: joe at joeshaw.org (Joe Shaw) Date: Mon, 9 Dec 2013 09:57:31 -0500 Subject: [CentralOH] Plucking Digits From Float In-Reply-To: <20131208144010.16e1a950.jep200404@columbus.rr.com> References: <20131208144010.16e1a950.jep200404@columbus.rr.com> Message-ID: Hi, It's worth pointing out also that floating point values are an approximation. This is one reason why you should never do direct comparisons with floating point numbers, but it could also bite you here. It's possible that 1.2346 (or any value you choose) cannot be precisely represented as you wish, and so converting it to a string and taking the negative index might be very, very wrong. 0.1 is one such number, and it can be demonstrated in python on some platforms. Go into the Python REPL and type "0.1" and you might get "0.10000000000000001" back. If this is really important you can store your values as integers -- which are exactly precise -- and handle the decimals yourself. (In other words, your own implemention of fixed point values.) Joe On Sun, Dec 8, 2013 at 2:40 PM, wrote: > On Sun, 8 Dec 2013 14:36:01 -0500, Louis Bogdan wrote: > >> num is calculated value 1.2346 >> a=num(-1) is indicating the numeral "6" with negative indexing notation. >> b=num(-2) is indicating the numeral "4" " " > > I question the sanity of do so. Nonetheless. > > num = 1.2346 > a = str(num)[-1] > b = str(num)[-2] > > print num, a, b > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh From brian.costlow at gmail.com Mon Dec 9 16:21:07 2013 From: brian.costlow at gmail.com (Brian Costlow) Date: Mon, 9 Dec 2013 10:21:07 -0500 Subject: [CentralOH] Plucking Digits From Float In-Reply-To: References: <20131208144010.16e1a950.jep200404@columbus.rr.com> Message-ID: There is an existing Decimal library in the standard library, which can be used for a lot of this kind of work. It's designed to avoid these kind of issues (mostly). http://docs.python.org/2/library/decimal.html Although since he is working with hardware, if the boundary can only pass floats into Python, he still will have potential issues. But using Decimal you can actually trap instances of inexact conversion and deal with them, instead of having them sneak by. On Mon, Dec 9, 2013 at 9:57 AM, Joe Shaw wrote: > Hi, > > It's worth pointing out also that floating point values are an > approximation. This is one reason why you should never do direct > comparisons with floating point numbers, but it could also bite you > here. It's possible that 1.2346 (or any value you choose) cannot be > precisely represented as you wish, and so converting it to a string > and taking the negative index might be very, very wrong. > > 0.1 is one such number, and it can be demonstrated in python on some > platforms. Go into the Python REPL and type "0.1" and you might get > "0.10000000000000001" back. > > If this is really important you can store your values as integers -- > which are exactly precise -- and handle the decimals yourself. (In > other words, your own implemention of fixed point values.) > > Joe > > On Sun, Dec 8, 2013 at 2:40 PM, wrote: > > On Sun, 8 Dec 2013 14:36:01 -0500, Louis Bogdan > wrote: > > > >> num is calculated value 1.2346 > >> a=num(-1) is indicating the numeral "6" with negative indexing notation. > >> b=num(-2) is indicating the numeral "4" " " > > > > I question the sanity of do so. Nonetheless. > > > > num = 1.2346 > > a = str(num)[-1] > > b = str(num)[-2] > > > > print num, a, b > > > > _______________________________________________ > > CentralOH mailing list > > CentralOH at python.org > > https://mail.python.org/mailman/listinfo/centraloh > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > -------------- next part -------------- An HTML attachment was scrubbed... URL: From looiebwv at gmail.com Mon Dec 9 16:32:17 2013 From: looiebwv at gmail.com (Louis Bogdan) Date: Mon, 9 Dec 2013 10:32:17 -0500 Subject: [CentralOH] Plucking Digits From Float In-Reply-To: References: <20131208144010.16e1a950.jep200404@columbus.rr.com> Message-ID: If my number 1.2346 was 12346.0, could I still do what I do in my proposed function? What I would be doing is multiplying everything by 10000 to convert to integers. The end result would still be tbe same. lou On Mon, Dec 9, 2013 at 10:21 AM, Brian Costlow wrote: > There is an existing Decimal library in the standard library, which can be > used for a lot of this kind of work. It's designed to avoid these kind of > issues (mostly). > > http://docs.python.org/2/library/decimal.html > > Although since he is working with hardware, if the boundary can only pass > floats into Python, he still will have potential issues. But using Decimal > you can actually trap instances of inexact conversion and deal with them, > instead of having them sneak by. > > > > > > > On Mon, Dec 9, 2013 at 9:57 AM, Joe Shaw wrote: > >> Hi, >> >> It's worth pointing out also that floating point values are an >> approximation. This is one reason why you should never do direct >> comparisons with floating point numbers, but it could also bite you >> here. It's possible that 1.2346 (or any value you choose) cannot be >> precisely represented as you wish, and so converting it to a string >> and taking the negative index might be very, very wrong. >> >> 0.1 is one such number, and it can be demonstrated in python on some >> platforms. Go into the Python REPL and type "0.1" and you might get >> "0.10000000000000001" back. >> >> If this is really important you can store your values as integers -- >> which are exactly precise -- and handle the decimals yourself. (In >> other words, your own implemention of fixed point values.) >> >> Joe >> >> On Sun, Dec 8, 2013 at 2:40 PM, wrote: >> > On Sun, 8 Dec 2013 14:36:01 -0500, Louis Bogdan >> wrote: >> > >> >> num is calculated value 1.2346 >> >> a=num(-1) is indicating the numeral "6" with negative indexing >> notation. >> >> b=num(-2) is indicating the numeral "4" " " >> > >> > I question the sanity of do so. Nonetheless. >> > >> > num = 1.2346 >> > a = str(num)[-1] >> > b = str(num)[-2] >> > >> > print num, a, b >> > >> > _______________________________________________ >> > CentralOH mailing list >> > CentralOH at python.org >> > https://mail.python.org/mailman/listinfo/centraloh >> _______________________________________________ >> CentralOH mailing list >> CentralOH at python.org >> https://mail.python.org/mailman/listinfo/centraloh >> > > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From joe at joeshaw.org Mon Dec 9 16:35:40 2013 From: joe at joeshaw.org (Joe Shaw) Date: Mon, 9 Dec 2013 10:35:40 -0500 Subject: [CentralOH] Plucking Digits From Float In-Reply-To: References: <20131208144010.16e1a950.jep200404@columbus.rr.com> Message-ID: Hi, Yep, good call. I wasn't familiar with the Decimal library and hadn't caught up to your other message on the thread. It definitely looks like it'll fit the bill. I would be a bit surprised if the hardware returned floats... most small embedded components don't have FPUs or IEEE-754 implementations. (And for things like medical devices, they'd more likely use some fixed point implementation to avoid these kinds of rounding errors.) Joe On Mon, Dec 9, 2013 at 10:21 AM, Brian Costlow wrote: > There is an existing Decimal library in the standard library, which can be > used for a lot of this kind of work. It's designed to avoid these kind of > issues (mostly). > > http://docs.python.org/2/library/decimal.html > > Although since he is working with hardware, if the boundary can only pass > floats into Python, he still will have potential issues. But using Decimal > you can actually trap instances of inexact conversion and deal with them, > instead of having them sneak by. > > > > > > > On Mon, Dec 9, 2013 at 9:57 AM, Joe Shaw wrote: >> >> Hi, >> >> It's worth pointing out also that floating point values are an >> approximation. This is one reason why you should never do direct >> comparisons with floating point numbers, but it could also bite you >> here. It's possible that 1.2346 (or any value you choose) cannot be >> precisely represented as you wish, and so converting it to a string >> and taking the negative index might be very, very wrong. >> >> 0.1 is one such number, and it can be demonstrated in python on some >> platforms. Go into the Python REPL and type "0.1" and you might get >> "0.10000000000000001" back. >> >> If this is really important you can store your values as integers -- >> which are exactly precise -- and handle the decimals yourself. (In >> other words, your own implemention of fixed point values.) >> >> Joe >> >> On Sun, Dec 8, 2013 at 2:40 PM, wrote: >> > On Sun, 8 Dec 2013 14:36:01 -0500, Louis Bogdan >> > wrote: >> > >> >> num is calculated value 1.2346 >> >> a=num(-1) is indicating the numeral "6" with negative indexing >> >> notation. >> >> b=num(-2) is indicating the numeral "4" " " >> > >> > I question the sanity of do so. Nonetheless. >> > >> > num = 1.2346 >> > a = str(num)[-1] >> > b = str(num)[-2] >> > >> > print num, a, b >> > >> > _______________________________________________ >> > CentralOH mailing list >> > CentralOH at python.org >> > https://mail.python.org/mailman/listinfo/centraloh >> _______________________________________________ >> CentralOH mailing list >> CentralOH at python.org >> https://mail.python.org/mailman/listinfo/centraloh > > > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > From jep200404 at columbus.rr.com Mon Dec 9 16:42:23 2013 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Mon, 9 Dec 2013 10:42:23 -0500 Subject: [CentralOH] Define The Problem, Then Solve In-Reply-To: References: <20131208144010.16e1a950.jep200404@columbus.rr.com> Message-ID: <20131209104223.0cf0adde.jep200404@columbus.rr.com> On Mon, 9 Dec 2013 10:32:17 -0500, Louis Bogdan wrote: > If ... Come to the meeting and after-meeting. It will be good place to discuss and define the problem. Once we have a good definition of the problem, solving the problem should be easy. From brian.costlow at gmail.com Mon Dec 9 16:44:17 2013 From: brian.costlow at gmail.com (Brian Costlow) Date: Mon, 9 Dec 2013 10:44:17 -0500 Subject: [CentralOH] Plucking Digits From Float In-Reply-To: References: <20131208144010.16e1a950.jep200404@columbus.rr.com> Message-ID: The (very few) hobby things I have done return ints of some type from the hardware, but it's not something I'm terribly familiar with. And that was an off-the-top-of-my-head starting point. There's a couple issues with my code, including an unnecessary str conversion and not setting the context correctly. On Mon, Dec 9, 2013 at 10:35 AM, Joe Shaw wrote: > Hi, > > Yep, good call. I wasn't familiar with the Decimal library and hadn't > caught up to your other message on the thread. It definitely looks > like it'll fit the bill. > > I would be a bit surprised if the hardware returned floats... most > small embedded components don't have FPUs or IEEE-754 implementations. > (And for things like medical devices, they'd more likely use some > fixed point implementation to avoid these kinds of rounding errors.) > > Joe > > On Mon, Dec 9, 2013 at 10:21 AM, Brian Costlow > wrote: > > There is an existing Decimal library in the standard library, which can > be > > used for a lot of this kind of work. It's designed to avoid these kind of > > issues (mostly). > > > > http://docs.python.org/2/library/decimal.html > > > > Although since he is working with hardware, if the boundary can only pass > > floats into Python, he still will have potential issues. But using > Decimal > > you can actually trap instances of inexact conversion and deal with them, > > instead of having them sneak by. > > > > > > > > > > > > > > On Mon, Dec 9, 2013 at 9:57 AM, Joe Shaw wrote: > >> > >> Hi, > >> > >> It's worth pointing out also that floating point values are an > >> approximation. This is one reason why you should never do direct > >> comparisons with floating point numbers, but it could also bite you > >> here. It's possible that 1.2346 (or any value you choose) cannot be > >> precisely represented as you wish, and so converting it to a string > >> and taking the negative index might be very, very wrong. > >> > >> 0.1 is one such number, and it can be demonstrated in python on some > >> platforms. Go into the Python REPL and type "0.1" and you might get > >> "0.10000000000000001" back. > >> > >> If this is really important you can store your values as integers -- > >> which are exactly precise -- and handle the decimals yourself. (In > >> other words, your own implemention of fixed point values.) > >> > >> Joe > >> > >> On Sun, Dec 8, 2013 at 2:40 PM, wrote: > >> > On Sun, 8 Dec 2013 14:36:01 -0500, Louis Bogdan > >> > wrote: > >> > > >> >> num is calculated value 1.2346 > >> >> a=num(-1) is indicating the numeral "6" with negative indexing > >> >> notation. > >> >> b=num(-2) is indicating the numeral "4" " " > >> > > >> > I question the sanity of do so. Nonetheless. > >> > > >> > num = 1.2346 > >> > a = str(num)[-1] > >> > b = str(num)[-2] > >> > > >> > print num, a, b > >> > > >> > _______________________________________________ > >> > CentralOH mailing list > >> > CentralOH at python.org > >> > https://mail.python.org/mailman/listinfo/centraloh > >> _______________________________________________ > >> CentralOH mailing list > >> CentralOH at python.org > >> https://mail.python.org/mailman/listinfo/centraloh > > > > > > > > _______________________________________________ > > CentralOH mailing list > > CentralOH at python.org > > https://mail.python.org/mailman/listinfo/centraloh > > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jep200404 at columbus.rr.com Mon Dec 9 16:53:00 2013 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Mon, 9 Dec 2013 10:53:00 -0500 Subject: [CentralOH] =?utf-8?q?2013-12-06_=E9=81=93=E5=A0=B4_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz8gc3VkbyBhcHQtZ2V0IC15IGluc3RhbGwgcHl0aG9u?= =?utf-8?q?-virtualenv?= In-Reply-To: <20131208171224.6e6122cb.jep200404@columbus.rr.com> References: <20131208171224.6e6122cb.jep200404@columbus.rr.com> Message-ID: <20131209105300.0088d3a0.jep200404@columbus.rr.com> On Sun, 8 Dec 2013 17:12:24 -0500, jep200404 at columbus.rr.com wrote: > Solved a messy Python package/virtualenv problem. The essence of the solution seems to have been: sudo apt-get -y install python-virtualenv which was inspired by 'IPython & Notebook on Xubuntu 12.10 Desktop i386' https://mail.python.org/pipermail/centraloh/2013-February/001544.html From brian.costlow at gmail.com Mon Dec 9 16:53:33 2013 From: brian.costlow at gmail.com (Brian Costlow) Date: Mon, 9 Dec 2013 10:53:33 -0500 Subject: [CentralOH] Plucking Digits From Float In-Reply-To: References: <20131208144010.16e1a950.jep200404@columbus.rr.com> Message-ID: If you are doing string manipulation, this is where it gets tricky, and where we are unclear what you are trying to do. If input is 1.2346 the output is 1.2345 (from your examples) But if the input is 12346.0, what is your expected output? Based on the 0.0005 step, I would expect it stays 12346.0 But wait, if we get 1234.6 what do we do? If we are just manipulating the last 2 digits of a string, we end up with 1234.5 Which of those would be correct? What if it's 1234.60 in the string, which is the same numeric value as 1234.6. To avoid those issues, you need a bunch more string manipulation. This is why we are asking you to step back and give a high level description of the problem without being fixated on your algorithm. On Mon, Dec 9, 2013 at 10:32 AM, Louis Bogdan wrote: > If my number 1.2346 was 12346.0, could I still do what I do in my proposed > function? What I would be doing is multiplying everything by 10000 to > convert to integers. The end result would still be tbe same. lou > > > On Mon, Dec 9, 2013 at 10:21 AM, Brian Costlow wrote: > >> There is an existing Decimal library in the standard library, which can >> be used for a lot of this kind of work. It's designed to avoid these kind >> of issues (mostly). >> >> http://docs.python.org/2/library/decimal.html >> >> Although since he is working with hardware, if the boundary can only pass >> floats into Python, he still will have potential issues. But using Decimal >> you can actually trap instances of inexact conversion and deal with them, >> instead of having them sneak by. >> >> >> >> >> >> >> On Mon, Dec 9, 2013 at 9:57 AM, Joe Shaw wrote: >> >>> Hi, >>> >>> It's worth pointing out also that floating point values are an >>> approximation. This is one reason why you should never do direct >>> comparisons with floating point numbers, but it could also bite you >>> here. It's possible that 1.2346 (or any value you choose) cannot be >>> precisely represented as you wish, and so converting it to a string >>> and taking the negative index might be very, very wrong. >>> >>> 0.1 is one such number, and it can be demonstrated in python on some >>> platforms. Go into the Python REPL and type "0.1" and you might get >>> "0.10000000000000001" back. >>> >>> If this is really important you can store your values as integers -- >>> which are exactly precise -- and handle the decimals yourself. (In >>> other words, your own implemention of fixed point values.) >>> >>> Joe >>> >>> On Sun, Dec 8, 2013 at 2:40 PM, wrote: >>> > On Sun, 8 Dec 2013 14:36:01 -0500, Louis Bogdan >>> wrote: >>> > >>> >> num is calculated value 1.2346 >>> >> a=num(-1) is indicating the numeral "6" with negative indexing >>> notation. >>> >> b=num(-2) is indicating the numeral "4" " " >>> > >>> > I question the sanity of do so. Nonetheless. >>> > >>> > num = 1.2346 >>> > a = str(num)[-1] >>> > b = str(num)[-2] >>> > >>> > print num, a, b >>> > >>> > _______________________________________________ >>> > CentralOH mailing list >>> > CentralOH at python.org >>> > https://mail.python.org/mailman/listinfo/centraloh >>> _______________________________________________ >>> CentralOH mailing list >>> CentralOH at python.org >>> https://mail.python.org/mailman/listinfo/centraloh >>> >> >> >> _______________________________________________ >> CentralOH mailing list >> CentralOH at python.org >> https://mail.python.org/mailman/listinfo/centraloh >> >> > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From looiebwv at gmail.com Mon Dec 9 20:44:02 2013 From: looiebwv at gmail.com (Louis Bogdan) Date: Mon, 9 Dec 2013 14:44:02 -0500 Subject: [CentralOH] Define The Problem, Then Solve In-Reply-To: <20131209104223.0cf0adde.jep200404@columbus.rr.com> References: <20131208144010.16e1a950.jep200404@columbus.rr.com> <20131209104223.0cf0adde.jep200404@columbus.rr.com> Message-ID: As I mentioned to Brian, the problem is to express my function in Python understandable language. To wonder if it might be 1.2346 or 1234.6 or 1234.60 is pointless because it will be 1.2346 or12346. into eternity thru precision control. I got started in programming in 1961 which I did in machine language because I figured the machine knows its own language so I might as well use it. After retirement I got a freebee CoC 2 computer and my "subroutine" works just fine on it. I can't print anything as printer ribbon has not been available for years. If Python can't do it, then I just might use portions of that basic program which I have managed to print out and create my own butchered basic language. On Mon, Dec 9, 2013 at 10:42 AM, wrote: > On Mon, 9 Dec 2013 10:32:17 -0500, Louis Bogdan > wrote: > > > If ... > > Come to the meeting and after-meeting. > It will be good place to discuss and define the problem. > > Once we have a good definition of the problem, > solving the problem should be easy. > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kurtis.mullins at gmail.com Mon Dec 9 21:30:51 2013 From: kurtis.mullins at gmail.com (Kurtis Mullins) Date: Mon, 9 Dec 2013 15:30:51 -0500 Subject: [CentralOH] (no subject) In-Reply-To: References: Message-ID: I would probably use a combination of this post ( http://math.stackexchange.com/questions/10173/extract-each-digit-of-a-number) and the Python Decimal library for precision. Another alternative that seems apparent, but I haven't put much thought into, is using the Decimal library, converting the number into a String, and grabbing the digit by index. Sorry I don't have more time to give you some sample code; I have to run. If you can't solve it, I'll try to help out when I get some free time. Good luck! On Sun, Dec 8, 2013 at 4:10 PM, Louis Bogdan wrote: > I see that there are some questions about my explanation of what I'm > trying to do. Would it clarify things if my explanation read as follows: > num(-1) denotes right-hand most digit of num in index position notation > num(-2) denotes the 3rd position digit of num in index position notation. > > I don't know how to say it in computer language, that's why I'm asking for > your help. Lou > > > On Sun, Dec 8, 2013 at 2:49 PM, Brian Costlow wrote: > >> This was my quick & dirt response to an email from Louis, and Louis >> reply, which I have not digested yet. I pointed him at the list as I'm kind >> of buried with some other stuff this weekend. >> >> You get the same rounding, will take any numeric or a string >> representing numeric, no float imprecision, no weird string manipulation. >> >> >>> from decimal import Decimal as D >> >>> multiplier_val = D('2000') >> >>> quant_val = D('1') >> >>> def custom_round(number): >> ... number = D(str(number)) >> ... return (number * multiplier_val).quantize(quant_val) / >> multiplier_val >> >> >>> custom_round(1.2340) >> Decimal('1.234') >> >>> custom_round(1.2341) >> Decimal('1.234') >> >>> custom_round(1.2342) >> Decimal('1.234') >> >>> custom_round(1.2343) >> Decimal('1.2345') >> >>> custom_round(1.2346) >> Decimal('1.2345') >> >>> custom_round(1.2347) >> Decimal('1.2345') >> >>> custom_round(1.2348) >> Decimal('1.235') >> >>> custom_round(1.2349) >> Decimal('1.235') >> >> I'm so familiar with the details of my invention and its ramifications >> that I didn't provide you with enough details. to explain my approach. I am >> looking to make this a subroutine for the following reasons: >> 1. For various applications, there can be many number, N inputs. >> 2. For each N input, there can be as many as 30 variable incremental >> modifications to N, each modification requiring that "subroutine" to make >> sure that N is in suitable form for later usage. >> 3. The program to run this only requires the input of N and formula >> created range of increments thus negating any access to N variations and >> increments during the cycle. >> 4. So with this "subroutine" I have .0002" absolute positional accuracy >> with .0005" increment control and other accuracies can be obtained with >> positional variations. I hope this clarifies my original email. Lou >> >> >> >> >> On Sun, Dec 8, 2013 at 2:36 PM, Louis Bogdan wrote: >> >>> I will start out by saying,"Have you heard that a LITTLE bit of >>> knowledge is a dangerous thing?" Well, I am the Poster Boy for that >>> saying. >>> >>> num is calculated value 1.2346 >>> a=num(-1) is indicating the numeral "6" with negative indexing notation. >>> b=num(-2) is indicating the numeral "4" " " >>> " ". >>> >>> if numeral "6" is greater than "7" make numeral "6" a "0" and increment >>> the "4" to "5". >>> elif numeral "6" is less than"3", meaning a "0", "1", or "2", make it a >>> "0". >>> else none of the above conditions apply, make numeral "6" a "5". >>> >>> EXAMPLE: 1.2340, 1.2341, 1.2342 become 1.2340 >>> 1.2348, 1.2349 become 1.2350 >>> 1.2343, 1/2344, 1.2345, 1.2346. 1.2347 become 1.2345. >>> >>> So with the "Bogdan" rounding, I am never more than .0002" off >>> calculated position. >>> I then divide the modified num 1.2345 by .0005 and get 2469 which is the >>> number of steps required of the stepper motor to provide a movement of >>> 1.2345" (-.0001" from theoretical.) >>> >>> I hope that explains MY way of talking to a computer. How would you >>> talk to Python and say the same thing and Python says,"MAN, I know what you >>> want!? Lou >>> >>> >>> On Sun, Dec 8, 2013 at 11:34 AM, Andrew Fitzgerald < >>> andrewcfitzgerald at gmail.com> wrote: >>> >>>> Hi Lou, >>>> >>>> Could you perhaps provide a summary of what that code is supposed to do? >>>> >>>> Right now you're assigning num the numeric value 1.2346 on the first >>>> line. >>>> >>>> You're then attempting to call num as a function on the next 2 lines. >>>> >>>> This won't work because num hasn't been defined as a function anywhere, >>>> and if it was the function is overwritten by the value 1.2346 on the first >>>> line. >>>> >>>> >>>> The part below that (if/else) looks like it should work if a and b are >>>> assigned numeric values. >>>> >>>> -Andrew Fitzgerald >>>> >>>> >>>> On Sun, Dec 8, 2013 at 11:09 AM, Louis Bogdan wrote: >>>> >>>>> Hi folks @central oh/python: >>>>> >>>>> >>>>> >>>>> As a recent subscriber, I received notice of your Dec 9 meeting from >>>>> Brian. As I am working on a program to go along with a recently >>>>> filed patent, and am totally new to Python, I sent him a proposed >>>>> ?subroutine?. This is used repetitively within the program. Since I >>>>> sent it to Brian, I have done some more research and have come up with a >>>>> better version as follows: >>>>> >>>>> >>>>> >>>>> num = 1.2346 >>>>> >>>>> a = num(-1) >>>>> >>>>> b = num(-2) >>>>> >>>>> if a >7: >>>>> >>>>> a = 0 >>>>> >>>>> b+ =1 >>>>> >>>>> elif a<3: >>>>> >>>>> a = 0 >>>>> >>>>> else: >>>>> >>>>> a = 5 >>>>> >>>>> >>>>> >>>>> As each stepper motor step equals .0005? of movement, with the above I >>>>> can get .0002? absolute positional accuracy with a .0005? control >>>>> increment. I have looked at some of the Python ?round? statements and >>>>> examples and don?t fully understand them so as an ?ole? retired engunear, >>>>> (does 93 qualify me) I thunk up my own way of doing things. Maybe >>>>> some of you young ones can teach an ole man how to do things better. >>>>> >>>>> >>>>> >>>>> This routine also has application in several other projects I have >>>>> under consideration. Would something like this, if it works, be a Python >>>>> library item? >>>>> >>>>> >>>>> >>>>> If any of you can ?tweek? the above into working order I would >>>>> appreciate it. I do have some other questions for you. What do I >>>>> need to buy to get started with RPi? I will be using my Apple >>>>> computer. >>>>> >>>>> >>>>> >>>>> Thank you for any comments you might have. Lou Bigdan >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> CentralOH mailing list >>>>> CentralOH at python.org >>>>> https://mail.python.org/mailman/listinfo/centraloh >>>>> >>>>> >>>> >>>> _______________________________________________ >>>> CentralOH mailing list >>>> CentralOH at python.org >>>> https://mail.python.org/mailman/listinfo/centraloh >>>> >>>> >>> >>> _______________________________________________ >>> CentralOH mailing list >>> CentralOH at python.org >>> https://mail.python.org/mailman/listinfo/centraloh >>> >>> >> >> _______________________________________________ >> CentralOH mailing list >> CentralOH at python.org >> https://mail.python.org/mailman/listinfo/centraloh >> >> > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From brian.costlow at gmail.com Mon Dec 9 21:43:20 2013 From: brian.costlow at gmail.com (Brian Costlow) Date: Mon, 9 Dec 2013 15:43:20 -0500 Subject: [CentralOH] Better Problem Description. In-Reply-To: References: Message-ID: Louis, Here is a sort-of pythonic implementation of your algorithm. There's some non idiomatic stuff here because I think it's easier for a new Python person to follow. It takes a string which contains a representation of a decimal number as input. This will only give correct output if the number has four places to the right of the decimal. It will also have issues if the string passed in is not a number. And one more thing...read on # Used as a simple hash to lookup new last digit ROUNDING_LOOKUP = { '0':'0', '1':'0', '2':'0', '3':'5', '4':'5', '5':'5', '6':'5', '7':'5', '8':'0', '9':'0', } def bogdan_round(num_as_string): '''Round to 0.0005 step Input must be a string representing a decimal number, with four places to right of decimal. Anything else WILL break. Negative values WILL NOT move in correct direction''' # part that won't change, uses slice notation, given 1.2345 as input becomes 1.23 prefix = num_as_string[:-2] # given 1.2345 becomes 4 next_to_last_digit = num_as_string[-2:-1] # given 1.2345 becomes 5 last_digit = num_as_stringx[-1:] next_to_last_as_int = int(next_to_last_digit) if next_to_last_as_int > 7: if next_to_last_as_int == 9: next_to_last_digit = '0' else: next_to_last_digit = str(next_to_last_as_int + 1) return prefix + next_to_last_digit + ROUNDING_LOOKUP[last_digit] Except there is a huge bug here. 1.2346 returns 1.2345 1.2349 returns 1.2350 but 1.2399 returns 1.2300 NOT the correct 1.2400 which is what happens when you try to play with isolated digits as a string. To fix that requires traversing the rest of the string in a loop adjusting digits. It's better to do math. Returning to my earlier solution, with a couple of tweaks. All computers have imprecision when doing floating point math, because of precision limitations moving between decimal and the actual binary implementation of the numbers. This is not unique to Python, but any language that abstracts the idea of a float and targets multiple architectures. Python has a Decimal library that allows you to do fixed point decimal math, or do floating point that will notify you if precision is lost. This does the same as the above, plus it handles ints and floats as input, negative values: # Use the decimal lib from decimal import Decimal as D # Since we are rounding to closest 0.0005, we can't just use the quant method # but we have to multiply so we can do integer rounding then divide back MULTIPLIER = D('2000') # Number can be int, string, or in Python 2.7 or >, a float def custom_round(number): number = D(number) # create a decimal type # multiply so we can round to nearest int adjusted_number = number * MULTIPLIER # round, divide back, and return result in one step return adjusted_number.to_integral_value() / MULTIPLIER Here's the function in action, showing the result: >>> custom_round('1.2340') Decimal('1.234') >>> custom_round('1.2341') Decimal('1.234') >>> custom_round('1.2342') Decimal('1.234') >>> custom_round('1.2343') Decimal('1.2345') >>> custom_round('1.2344') Decimal('1.2345') >>> custom_round('1.2345') Decimal('1.2345') >>> custom_round('1.2346') Decimal('1.2345') >>> custom_round('1.2347') Decimal('1.2345') >>> custom_round('1.2348') Decimal('1.235') >>> custom_round('1.2349') Decimal('1.235') On Mon, Dec 9, 2013 at 12:56 PM, Louis Bogdan wrote: > First off Brian, thank you for your interest in helping me. So let's > start from the beginning. The number comes from a keyboard input that is > requested with 4 decimal input and is modified with an imbedded formula. > In this application the keyboard number can vary from integer to integer > plus 4 decimal. This modified number, "num", is used to control a stepper > motor where each step equals 0.0005" of linear motion. My function rounds > "num" in such a manner that the maximum error is 0.0002", which in this > application is acceptable. The initial number may be modified as much as > 30 times in a cycle. These modifications are so handled that in > engineering parlance I "baseline" dimension rather that "chain" so that > each increment is within 0.0002" of true location rather than a possible > maximum accumulative error of 0.0066". All that I can and have handled. > What I need is to put my "rounding" function into Python language. One > comment I received was to use only integers. That would be no problem, we > would adjust the units and tens digit as necessary and accomplish the same > thing. It would be: motor steps equals num(decimal)/0.0005 or > num(integer)/5 as I have shown in one of my emails. As far as the comment > of "other" accuracies can be totally ignored in the present discussion. > > Now I know that Python does rounding which I don't understand and have not > found any decent, understandable explanation how it does it. I understand > rounding, even way back when I was proficient with the abacus. > > I hope this is some claification and if not, let me know. Lou > > > On Mon, Dec 9, 2013 at 10:53 AM, Brian Costlow wrote: > >> Hi Louis, >> >> I read through all the group postings real quick this morning, and here's >> my take. >> >> What Jim is asking for (he's our resident elder curmudgeon, although in >> your case he could probably be your grandson.) is to step back and describe >> the problem in English. >> >> You have given us an algorithm, and asked us to help you code it in >> Python. That algorithm is best encoded in Python via string manipulation, >> which is not really what you should be doing if you are trying to do math. >> >> So, we want a generic description of the problem because we may find a >> better algorithm entirely. >> >> We also need to know where the input is coming from and where it is used >> after, because if you have floating point values coming in, and going out, >> then not only is string manipulation 'extra' work, it may bite you. >> >> Last, it's unclear whether the 0.0005 step value ever needs to change. >> Thus Jim's comment about magic numbers. I think your line that said this: "other >> accuracies can be obtained with positional variations" implies that 0.0005 >> step might change and be some other value. But it's not clear. >> >> In my code I sent you earlier, 'custom_round' IS a subroutine (we usually >> say procedure or function in python-speak) that does exactly what you need. >> It doesn't do string manipulation, it does real math, but it will accept a >> string or any numeric type as input. >> >> You can also modify it so that the 0.0005 is changeable.There are a >> couple of design approaches to doing that, and the one you should use >> partly depends on the rest of your program design. >> >> Coding something in any language is not merely figuring a psuedo-code >> algorithm and then forcing the language to fit your algorithm. >> >> It's learning the idioms and built-in tools of the language. >> >> >> >> >> >> >> >> >> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jep200404 at columbus.rr.com Mon Dec 9 23:06:34 2013 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Mon, 9 Dec 2013 17:06:34 -0500 Subject: [CentralOH] State The Problem Simply In-Reply-To: <20131208170601.52548c40.jep200404@columbus.rr.com> References: <20131208170601.52548c40.jep200404@columbus.rr.com> Message-ID: <20131209170634.3c426a2f.jep200404@columbus.rr.com> Lou, Does the following correctly describe what you want to accomplish? Given position d and stepper motor resolution steps_per_unit, calculate the position closest to d that a steps_per_unit stepper motor can achieve. A terse yes or no without explanation is best. From looiebwv at gmail.com Tue Dec 10 00:59:01 2013 From: looiebwv at gmail.com (Louis Bogdan) Date: Mon, 9 Dec 2013 18:59:01 -0500 Subject: [CentralOH] Better Problem Description. In-Reply-To: References: Message-ID: Hi Brian: You bring up an interesting point. If num is 1.2399 would result in 1.2300 my way. In looking at that there is a real easy fix that also simplifies the function as follows: num = 1.2399 if num[-1] >7 num+=2 #this will make num 1.2398 ,1.2399 = 1.2400 or 1.2401. elif num[-1]<3 num[-1]= 0 # this will make num 1.2401,1.2402 =1.2400 else: num[-1] = 5 #nom 1.2394, 1.2395, 1.2396,1.2397 will =1.2395 I ran several "numbers" and found 2 occasions with a .0099 condition. Does this make any sense? A num 1.2398 or 1.2399 would obviate the else statement but we do not have access to the calculations so it should be standard. On Mon, Dec 9, 2013 at 3:43 PM, Brian Costlow wrote: > Louis, > > Here is a sort-of pythonic implementation of your algorithm. There's some > non idiomatic stuff here because I think it's easier for a new Python > person to follow. It takes a string which contains a representation of a > decimal number as input. This will only give correct output if the number > has four places to the right of the decimal. It will also have issues if > the string passed in is not a number. And one more thing...read on > > # Used as a simple hash to lookup new last digit > ROUNDING_LOOKUP = { '0':'0', '1':'0', '2':'0', '3':'5', '4':'5', > '5':'5', '6':'5', '7':'5', '8':'0', '9':'0', } > > def bogdan_round(num_as_string): > '''Round to 0.0005 step > > Input must be a string representing a decimal number, with > four places to right of decimal. Anything else WILL break. > Negative values WILL NOT move in correct direction''' > > # part that won't change, uses slice notation, given 1.2345 as input > becomes 1.23 > prefix = num_as_string[:-2] > # given 1.2345 becomes 4 > next_to_last_digit = num_as_string[-2:-1] > # given 1.2345 becomes 5 > last_digit = num_as_stringx[-1:] > next_to_last_as_int = int(next_to_last_digit) > > if next_to_last_as_int > 7: > if next_to_last_as_int == 9: > next_to_last_digit = '0' > else: > next_to_last_digit = str(next_to_last_as_int + 1) > return prefix + next_to_last_digit + ROUNDING_LOOKUP[last_digit] > > Except there is a huge bug here. > > 1.2346 returns 1.2345 > 1.2349 returns 1.2350 > but > 1.2399 returns 1.2300 NOT the correct 1.2400 which is what happens when > you try to play with isolated digits as a string. > > To fix that requires traversing the rest of the string in a loop adjusting > digits. It's better to do math. Returning to my earlier solution, with a > couple of tweaks. > > All computers have imprecision when doing floating point math, because of > precision limitations moving between decimal and the actual binary > implementation of the numbers. This is not unique to Python, but any > language that abstracts the idea of a float and targets multiple > architectures. > > Python has a Decimal library that allows you to do fixed point decimal > math, or do floating point that will notify you if precision is lost. This > does the same as the above, plus it handles ints and floats as input, > negative values: > > # Use the decimal lib > from decimal import Decimal as D > > # Since we are rounding to closest 0.0005, we can't just use the quant > method > # but we have to multiply so we can do integer rounding then divide back > MULTIPLIER = D('2000') > > # Number can be int, string, or in Python 2.7 or >, a float > def custom_round(number): > number = D(number) # create a decimal type > # multiply so we can round to nearest int > adjusted_number = number * MULTIPLIER > # round, divide back, and return result in one step > return adjusted_number.to_integral_value() / MULTIPLIER > > Here's the function in action, showing the result: > > >>> custom_round('1.2340') > Decimal('1.234') > >>> custom_round('1.2341') > Decimal('1.234') > >>> custom_round('1.2342') > Decimal('1.234') > >>> custom_round('1.2343') > Decimal('1.2345') > >>> custom_round('1.2344') > Decimal('1.2345') > >>> custom_round('1.2345') > Decimal('1.2345') > >>> custom_round('1.2346') > Decimal('1.2345') > >>> custom_round('1.2347') > Decimal('1.2345') > >>> custom_round('1.2348') > Decimal('1.235') > >>> custom_round('1.2349') > Decimal('1.235') > > > > > > > > > > > > > > > > > > On Mon, Dec 9, 2013 at 12:56 PM, Louis Bogdan wrote: > >> First off Brian, thank you for your interest in helping me. So let's >> start from the beginning. The number comes from a keyboard input that is >> requested with 4 decimal input and is modified with an imbedded formula. >> In this application the keyboard number can vary from integer to integer >> plus 4 decimal. This modified number, "num", is used to control a stepper >> motor where each step equals 0.0005" of linear motion. My function rounds >> "num" in such a manner that the maximum error is 0.0002", which in this >> application is acceptable. The initial number may be modified as much as >> 30 times in a cycle. These modifications are so handled that in >> engineering parlance I "baseline" dimension rather that "chain" so that >> each increment is within 0.0002" of true location rather than a possible >> maximum accumulative error of 0.0066". All that I can and have handled. >> What I need is to put my "rounding" function into Python language. One >> comment I received was to use only integers. That would be no problem, we >> would adjust the units and tens digit as necessary and accomplish the same >> thing. It would be: motor steps equals num(decimal)/0.0005 or >> num(integer)/5 as I have shown in one of my emails. As far as the comment >> of "other" accuracies can be totally ignored in the present discussion. >> >> Now I know that Python does rounding which I don't understand and have >> not found any decent, understandable explanation how it does it. I >> understand rounding, even way back when I was proficient with the abacus. >> >> I hope this is some claification and if not, let me know. Lou >> >> >> On Mon, Dec 9, 2013 at 10:53 AM, Brian Costlow wrote: >> >>> Hi Louis, >>> >>> I read through all the group postings real quick this morning, and >>> here's my take. >>> >>> What Jim is asking for (he's our resident elder curmudgeon, although in >>> your case he could probably be your grandson.) is to step back and describe >>> the problem in English. >>> >>> You have given us an algorithm, and asked us to help you code it in >>> Python. That algorithm is best encoded in Python via string manipulation, >>> which is not really what you should be doing if you are trying to do math. >>> >>> So, we want a generic description of the problem because we may find a >>> better algorithm entirely. >>> >>> We also need to know where the input is coming from and where it is used >>> after, because if you have floating point values coming in, and going out, >>> then not only is string manipulation 'extra' work, it may bite you. >>> >>> Last, it's unclear whether the 0.0005 step value ever needs to change. >>> Thus Jim's comment about magic numbers. I think your line that said this: "other >>> accuracies can be obtained with positional variations" implies that 0.0005 >>> step might change and be some other value. But it's not clear. >>> >>> In my code I sent you earlier, 'custom_round' IS a subroutine (we >>> usually say procedure or function in python-speak) that does exactly what >>> you need. It doesn't do string manipulation, it does real math, but it will >>> accept a string or any numeric type as input. >>> >>> You can also modify it so that the 0.0005 is changeable.There are a >>> couple of design approaches to doing that, and the one you should use >>> partly depends on the rest of your program design. >>> >>> Coding something in any language is not merely figuring a psuedo-code >>> algorithm and then forcing the language to fit your algorithm. >>> >>> It's learning the idioms and built-in tools of the language. >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From looiebwv at gmail.com Tue Dec 10 01:01:38 2013 From: looiebwv at gmail.com (Louis Bogdan) Date: Mon, 9 Dec 2013 19:01:38 -0500 Subject: [CentralOH] State The Problem Simply In-Reply-To: <20131209170634.3c426a2f.jep200404@columbus.rr.com> References: <20131208170601.52548c40.jep200404@columbus.rr.com> <20131209170634.3c426a2f.jep200404@columbus.rr.com> Message-ID: yes On Mon, Dec 9, 2013 at 5:06 PM, wrote: > Lou, > > Does the following correctly describe what you want to accomplish? > > Given position d and stepper motor resolution steps_per_unit, > calculate the position closest to d that a > steps_per_unit stepper motor can achieve. > > A terse yes or no without explanation is best. > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > -------------- next part -------------- An HTML attachment was scrubbed... URL: From brian.costlow at gmail.com Tue Dec 10 05:53:37 2013 From: brian.costlow at gmail.com (Brian Costlow) Date: Mon, 9 Dec 2013 23:53:37 -0500 Subject: [CentralOH] State The Problem Simply In-Reply-To: References: <20131208170601.52548c40.jep200404@columbus.rr.com> <20131209170634.3c426a2f.jep200404@columbus.rr.com> Message-ID: Follow on. Is steps_per_unit a constant throughout the life of the program, or is it expected to change? On Mon, Dec 9, 2013 at 7:01 PM, Louis Bogdan wrote: > yes > > > On Mon, Dec 9, 2013 at 5:06 PM, wrote: > >> Lou, >> >> Does the following correctly describe what you want to accomplish? >> >> Given position d and stepper motor resolution steps_per_unit, >> calculate the position closest to d that a >> steps_per_unit stepper motor can achieve. >> >> A terse yes or no without explanation is best. >> _______________________________________________ >> CentralOH mailing list >> CentralOH at python.org >> https://mail.python.org/mailman/listinfo/centraloh >> > > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jep200404 at columbus.rr.com Tue Dec 10 06:23:42 2013 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Tue, 10 Dec 2013 00:23:42 -0500 Subject: [CentralOH] Simply Stated Problem Solved Simply In-Reply-To: References: <20131208170601.52548c40.jep200404@columbus.rr.com> <20131209170634.3c426a2f.jep200404@columbus.rr.com> Message-ID: <20131210002342.0c82e1de.jep200404@columbus.rr.com> On Mon, 9 Dec 2013 19:01:38 -0500, Louis Bogdan wrote: > On Mon, Dec 9, 2013 at 5:06 PM, wrote: > > Does the following correctly describe what you want to accomplish? > > > > Given position d and stepper motor resolution steps_per_unit, > > calculate the position closest to d that a > > steps_per_unit stepper motor can achieve. > > > > A terse yes or no without explanation is best. > yes Good. That's the clarity and simplicity that both you and I needed. I think I already solved that problem. See the goo() function near the bottom of an earlier post[1]. I exercised that code in Ipython Notebook and brought it to tonight's meeting to show, but you were not there, so I did not show it. I have attached a cleaned up version of that notebook in the attached tarball. You can play with that notebook, either by installing Ipython Notebook[2] or running it on a remote server, such as Ipython Notebook Viewer[3]. Scrutinize the output of cell #4. Study the foo() function also. You might find it to be handy for determining how many stepper motor steps to do. [1] https://mail.python.org/pipermail/centraloh/2013-December/001919.html That post might be longer than you thought. Scroll all the way to the bottom. [2] IPython & Notebook on Xubuntu 12.10 Desktop i386 https://mail.python.org/pipermail/centraloh/2013-February/index.html [3] http://nbviewer.ipython.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: stepper-solution.tgz Type: application/x-gzip Size: 1160 bytes Desc: not available URL: From nludban at columbus.rr.com Tue Dec 10 14:22:39 2013 From: nludban at columbus.rr.com (Neil Ludban) Date: Tue, 10 Dec 2013 08:22:39 -0500 Subject: [CentralOH] Better Problem Description. In-Reply-To: References: Message-ID: <20131210082239.13d368cf.nludban@columbus.rr.com> On Mon, 9 Dec 2013 18:59:01 -0500 Louis Bogdan wrote: ... > > On Mon, Dec 9, 2013 at 12:56 PM, Louis Bogdan wrote: > >> Now I know that Python does rounding which I don't understand and have > >> not found any decent, understandable explanation how it does it. I > >> understand rounding, even way back when I was proficient with the abacus. It's really quantization errors, not rounding. If binary integers are expressed as a sum of numbers from the set {1, 2, 4, 8, 16, ...} then binary floating point numbers (from a very simplistic viewpoint) add to that set the fractions {1/2, 1/4, 1/8, 1/16, ...}. 64-bit doubles (the typical Python "float" type) enables 53 consecutive values from that combined set: http://en.wikipedia.org/wiki/Double_precision_floating-point_format So numbers like 1, 1+1/2, 1+1/4, 1+1/8, can be represented exactly in decimal and binary (the minus sign is added here to force the bin function to output all 64 bits): --> import struct --> bin(struct.unpack('Q', struct.pack('d', float('-1.0000')))[0]) '0b1011111111110000000000000000000000000000000000000000000000000000' --> bin(struct.unpack('Q', struct.pack('d', float('-1.5000')))[0]) '0b1011111111111000000000000000000000000000000000000000000000000000' --> bin(struct.unpack('Q', struct.pack('d', float('-1.2500')))[0]) '0b1011111111110100000000000000000000000000000000000000000000000000' --> bin(struct.unpack('Q', struct.pack('d', float('-1.1250')))[0]) '0b1011111111110010000000000000000000000000000000000000000000000000' 1+1/10 works in decimal, but is a repeating pattern in binary: --> bin(struct.unpack('Q', struct.pack('d', float('-1.1000')))[0]) '0b1011111111110001100110011001100110011001100110011001100110011010' 1+1/3 repeats in both decimal and binary: --> -4/3. -1.3333333333333333 --> bin(struct.unpack('Q', struct.pack('d', float(-4/3.)))[0]) '0b1011111111110101010101010101010101010101010101010101010101010101' And then there's the weird stuff that may concern you: --> bin(struct.unpack('Q', struct.pack('d', float(-4/3. * 1000 / 1000)))[0]) '0b1011111111110101010101010101010101010101010101010101010101010101' --> bin(struct.unpack('Q', struct.pack('d', float(-4/3. + 1000 - 1000)))[0]) '0b1011111111110101010101010101010101010101010101010101011000000000' --> -4/3. + 1000 - 1000 -1.3333333333333712 The result of the last example can vary depending on the compiler and optimization flags, whether the code runs on the main FPU or vector coprocessor (eg, MMX), level of IEEE-754 compliance (which varies from none for early Crays to partly for early NVIDIA GPUs to full for most modern desktops), and any non-standard options (eg, rounding mode and denormal truncation) which other parts of your application or supporting libraries may have set... Hope that helps. From brian.costlow at gmail.com Tue Dec 10 14:36:53 2013 From: brian.costlow at gmail.com (Brian Costlow) Date: Tue, 10 Dec 2013 08:36:53 -0500 Subject: [CentralOH] Simply Stated Problem Solved Simply In-Reply-To: <20131210002342.0c82e1de.jep200404@columbus.rr.com> References: <20131208170601.52548c40.jep200404@columbus.rr.com> <20131209170634.3c426a2f.jep200404@columbus.rr.com> <20131210002342.0c82e1de.jep200404@columbus.rr.com> Message-ID: The solution here is almost identical to the one I posted, except goo() allows floating point discrepancies to creep in. Which usually will just wash out, but could potentially round to the wrong step. That's dependent on the expected range of d. Using the decimal library helps to prevent that, and/or signals when you have an issue. It's worth reading through the module's doc and understanding for this type of application. On Tue, Dec 10, 2013 at 12:23 AM, wrote: > On Mon, 9 Dec 2013 19:01:38 -0500, Louis Bogdan > wrote: > > > On Mon, Dec 9, 2013 at 5:06 PM, wrote: > > > > Does the following correctly describe what you want to accomplish? > > > > > > Given position d and stepper motor resolution steps_per_unit, > > > calculate the position closest to d that a > > > steps_per_unit stepper motor can achieve. > > > > > > A terse yes or no without explanation is best. > > > yes > > Good. That's the clarity and simplicity that both you and I needed. > I think I already solved that problem. > See the goo() function near the bottom of an earlier post[1]. > > I exercised that code in Ipython Notebook and brought it to > tonight's meeting to show, but you were not there, > so I did not show it. I have attached a cleaned up version > of that notebook in the attached tarball. > > You can play with that notebook, either by installing > Ipython Notebook[2] or running it on a remote server, > such as Ipython Notebook Viewer[3]. > Scrutinize the output of cell #4. > Study the foo() function also. You might find it to be handy > for determining how many stepper motor steps to do. > > [1] https://mail.python.org/pipermail/centraloh/2013-December/001919.html > That post might be longer than you thought. > Scroll all the way to the bottom. > > [2] IPython & Notebook on Xubuntu 12.10 Desktop i386 > https://mail.python.org/pipermail/centraloh/2013-February/index.html > > [3] http://nbviewer.ipython.org/ > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jep200404 at columbus.rr.com Tue Dec 10 14:57:34 2013 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Tue, 10 Dec 2013 08:57:34 -0500 Subject: [CentralOH] Range of Movement In-Reply-To: References: <20131208170601.52548c40.jep200404@columbus.rr.com> <20131209170634.3c426a2f.jep200404@columbus.rr.com> <20131210002342.0c82e1de.jep200404@columbus.rr.com> Message-ID: <20131210085734.560d110d.jep200404@columbus.rr.com> Lou, how far can your stepper motor(s) move things? On Tue, 10 Dec 2013 08:36:53 -0500, Brian Costlow wrote: > ... goo() > allows floating point discrepancies to creep in. Which usually will just > wash out, but could potentially round to the wrong step. That's dependent > on the expected range of d. Again, the hard part is getting a good description of the problem. From looiebwv at gmail.com Tue Dec 10 16:24:08 2013 From: looiebwv at gmail.com (Louis Bogdan) Date: Tue, 10 Dec 2013 10:24:08 -0500 Subject: [CentralOH] Better Problem Description. In-Reply-To: <20131210082239.13d368cf.nludban@columbus.rr.com> References: <20131210082239.13d368cf.nludban@columbus.rr.com> Message-ID: It seems that I'm having a problem in getting my point across as to what I would like to do, so let's try another approach. I have a number, 1.2348 and it is of no consequence or interest where it came from, etc. I would like to manipulate the right hand most digit so that if it is greater that 7, I would increment it by 2 to 0 and end up with the number being either 1.2350 or 1.2351. In like manner I would just change the right hand most digit to 0 as this would have no effect on any other digits, I would end up with the number being 1.2340. Now if the right hand digit was not greater than 7 nor less than 3, it fall into the range of 3-8 and digits 3, 4, 5 ,6 &7 I change to digit 5 The end result of the above I will have a number whose right hand digit will be either 0 or 5. And here again, what happens next is of no consequence or interest to anyone but me. But to satisfy some people's curiosity, the above number was derived from a keypad input, two integer four decimal, and manipulated by an internal equation. The finally derived number will then manipulated into an integer which will the number of steps required to make a linear movement equal to the above number of inches. NOW!! HOW DO I SAY THAT IN PYTHON? On Tue, Dec 10, 2013 at 8:22 AM, Neil Ludban wrote: > On Mon, 9 Dec 2013 18:59:01 -0500 > Louis Bogdan wrote: > ... > > > On Mon, Dec 9, 2013 at 12:56 PM, Louis Bogdan > wrote: > > >> Now I know that Python does rounding which I don't understand and have > > >> not found any decent, understandable explanation how it does it. I > > >> understand rounding, even way back when I was proficient with the > abacus. > > It's really quantization errors, not rounding. If binary integers > are expressed as a sum of numbers from the set {1, 2, 4, 8, 16, ...} > then binary floating point numbers (from a very simplistic viewpoint) > add to that set the fractions {1/2, 1/4, 1/8, 1/16, ...}. 64-bit > doubles (the typical Python "float" type) enables 53 consecutive > values from that combined set: > > http://en.wikipedia.org/wiki/Double_precision_floating-point_format > > So numbers like 1, 1+1/2, 1+1/4, 1+1/8, can be represented exactly > in decimal and binary (the minus sign is added here to force the > bin function to output all 64 bits): > > --> import struct > --> bin(struct.unpack('Q', struct.pack('d', float('-1.0000')))[0]) > '0b1011111111110000000000000000000000000000000000000000000000000000' > --> bin(struct.unpack('Q', struct.pack('d', float('-1.5000')))[0]) > '0b1011111111111000000000000000000000000000000000000000000000000000' > --> bin(struct.unpack('Q', struct.pack('d', float('-1.2500')))[0]) > '0b1011111111110100000000000000000000000000000000000000000000000000' > --> bin(struct.unpack('Q', struct.pack('d', float('-1.1250')))[0]) > '0b1011111111110010000000000000000000000000000000000000000000000000' > > > 1+1/10 works in decimal, but is a repeating pattern in binary: > --> bin(struct.unpack('Q', struct.pack('d', float('-1.1000')))[0]) > '0b1011111111110001100110011001100110011001100110011001100110011010' > > > 1+1/3 repeats in both decimal and binary: > --> -4/3. > -1.3333333333333333 > --> bin(struct.unpack('Q', struct.pack('d', float(-4/3.)))[0]) > '0b1011111111110101010101010101010101010101010101010101010101010101' > > > And then there's the weird stuff that may concern you: > > --> bin(struct.unpack('Q', struct.pack('d', float(-4/3. * 1000 / > 1000)))[0]) > '0b1011111111110101010101010101010101010101010101010101010101010101' > --> bin(struct.unpack('Q', struct.pack('d', float(-4/3. + 1000 - > 1000)))[0]) > '0b1011111111110101010101010101010101010101010101010101011000000000' > --> -4/3. + 1000 - 1000 > -1.3333333333333712 > > The result of the last example can vary depending on the compiler > and optimization flags, whether the code runs on the main FPU or > vector coprocessor (eg, MMX), level of IEEE-754 compliance (which > varies from none for early Crays to partly for early NVIDIA GPUs to > full for most modern desktops), and any non-standard options (eg, > rounding mode and denormal truncation) which other parts of your > application or supporting libraries may have set... > > > Hope that helps. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From joe at joeshaw.org Tue Dec 10 16:31:48 2013 From: joe at joeshaw.org (Joe Shaw) Date: Tue, 10 Dec 2013 10:31:48 -0500 Subject: [CentralOH] Better Problem Description. In-Reply-To: References: <20131210082239.13d368cf.nludban@columbus.rr.com> Message-ID: Hi, To put it into pseudocode: if last_digit < 3: last_digit = 0 elif last_digit < 8: last_digit = 5 else: last_digit = 0 next_to_last_digit += 1 Is that correct? On Tue, Dec 10, 2013 at 10:24 AM, Louis Bogdan wrote: > It seems that I'm having a problem in getting my point across as to what I > would like to do, so let's try another approach. > > I have a number, 1.2348 and it is of no consequence or interest where it > came from, etc. I would like to manipulate the right hand most digit so > that if it is greater that 7, I would increment it by 2 to 0 and end up with > the number being either 1.2350 or 1.2351. > > In like manner I would just change the right hand most digit to 0 as this > would have no effect on any other digits, I would end up with the number > being 1.2340. > > Now if the right hand digit was not greater than 7 nor less than 3, it fall > into the range of 3-8 and digits 3, 4, 5 ,6 &7 I change to digit 5 > > The end result of the above I will have a number whose right hand digit will > be either 0 or 5. And here again, what happens next is of no consequence > or interest to anyone but me. But to satisfy some people's curiosity, the > above number was derived from a keypad input, two integer four decimal, and > manipulated by an internal equation. The finally derived number will then > manipulated into an integer which will the number of steps required to make > a linear movement equal to the above number of inches. > > NOW!! HOW DO I SAY THAT IN PYTHON? > > > > > On Tue, Dec 10, 2013 at 8:22 AM, Neil Ludban > wrote: >> >> On Mon, 9 Dec 2013 18:59:01 -0500 >> Louis Bogdan wrote: >> ... >> > > On Mon, Dec 9, 2013 at 12:56 PM, Louis Bogdan >> > > wrote: >> > >> Now I know that Python does rounding which I don't understand and >> > >> have >> > >> not found any decent, understandable explanation how it does it. I >> > >> understand rounding, even way back when I was proficient with the >> > >> abacus. >> >> It's really quantization errors, not rounding. If binary integers >> are expressed as a sum of numbers from the set {1, 2, 4, 8, 16, ...} >> then binary floating point numbers (from a very simplistic viewpoint) >> add to that set the fractions {1/2, 1/4, 1/8, 1/16, ...}. 64-bit >> doubles (the typical Python "float" type) enables 53 consecutive >> values from that combined set: >> >> http://en.wikipedia.org/wiki/Double_precision_floating-point_format >> >> So numbers like 1, 1+1/2, 1+1/4, 1+1/8, can be represented exactly >> in decimal and binary (the minus sign is added here to force the >> bin function to output all 64 bits): >> >> --> import struct >> --> bin(struct.unpack('Q', struct.pack('d', float('-1.0000')))[0]) >> '0b1011111111110000000000000000000000000000000000000000000000000000' >> --> bin(struct.unpack('Q', struct.pack('d', float('-1.5000')))[0]) >> '0b1011111111111000000000000000000000000000000000000000000000000000' >> --> bin(struct.unpack('Q', struct.pack('d', float('-1.2500')))[0]) >> '0b1011111111110100000000000000000000000000000000000000000000000000' >> --> bin(struct.unpack('Q', struct.pack('d', float('-1.1250')))[0]) >> '0b1011111111110010000000000000000000000000000000000000000000000000' >> >> >> 1+1/10 works in decimal, but is a repeating pattern in binary: >> --> bin(struct.unpack('Q', struct.pack('d', float('-1.1000')))[0]) >> '0b1011111111110001100110011001100110011001100110011001100110011010' >> >> >> 1+1/3 repeats in both decimal and binary: >> --> -4/3. >> -1.3333333333333333 >> --> bin(struct.unpack('Q', struct.pack('d', float(-4/3.)))[0]) >> '0b1011111111110101010101010101010101010101010101010101010101010101' >> >> >> And then there's the weird stuff that may concern you: >> >> --> bin(struct.unpack('Q', struct.pack('d', float(-4/3. * 1000 / >> 1000)))[0]) >> '0b1011111111110101010101010101010101010101010101010101010101010101' >> --> bin(struct.unpack('Q', struct.pack('d', float(-4/3. + 1000 - >> 1000)))[0]) >> '0b1011111111110101010101010101010101010101010101010101011000000000' >> --> -4/3. + 1000 - 1000 >> -1.3333333333333712 >> >> The result of the last example can vary depending on the compiler >> and optimization flags, whether the code runs on the main FPU or >> vector coprocessor (eg, MMX), level of IEEE-754 compliance (which >> varies from none for early Crays to partly for early NVIDIA GPUs to >> full for most modern desktops), and any non-standard options (eg, >> rounding mode and denormal truncation) which other parts of your >> application or supporting libraries may have set... >> >> >> Hope that helps. > > > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > From looiebwv at gmail.com Tue Dec 10 16:31:49 2013 From: looiebwv at gmail.com (Louis Bogdan) Date: Tue, 10 Dec 2013 10:31:49 -0500 Subject: [CentralOH] Better Problem Description. In-Reply-To: References: <20131210082239.13d368cf.nludban@columbus.rr.com> Message-ID: Oops: The third paragraph should read: In like manner, IF THE RIGHT HAND DIGIT IS <3, On Tue, Dec 10, 2013 at 10:24 AM, Louis Bogdan wrote: > It seems that I'm having a problem in getting my point across as to what I > would like to do, so let's try another approach. > > I have a number, 1.2348 and it is of no consequence or interest where it > came from, etc. I would like to manipulate the right hand most digit so > that if it is greater that 7, I would increment it by 2 to 0 and end up > with the number being either 1.2350 or 1.2351. > > In like manner I would just change the right hand most digit to 0 as this > would have no effect on any other digits, I would end up with the number > being 1.2340. > > Now if the right hand digit was not greater than 7 nor less than 3, it > fall into the range of 3-8 and digits 3, 4, 5 ,6 &7 I change to digit 5 > > The end result of the above I will have a number whose right hand digit > will be either 0 or 5. And here again, what happens next is of no > consequence or interest to anyone but me. But to satisfy some people's > curiosity, the above number was derived from a keypad input, two integer > four decimal, and manipulated by an internal equation. The finally derived > number will then manipulated into an integer which will the number of steps > required to make a linear movement equal to the above number of inches. > > NOW!! HOW DO I SAY THAT IN PYTHON? > > > > > On Tue, Dec 10, 2013 at 8:22 AM, Neil Ludban wrote: > >> On Mon, 9 Dec 2013 18:59:01 -0500 >> Louis Bogdan wrote: >> ... >> > > On Mon, Dec 9, 2013 at 12:56 PM, Louis Bogdan >> wrote: >> > >> Now I know that Python does rounding which I don't understand and >> have >> > >> not found any decent, understandable explanation how it does it. I >> > >> understand rounding, even way back when I was proficient with the >> abacus. >> >> It's really quantization errors, not rounding. If binary integers >> are expressed as a sum of numbers from the set {1, 2, 4, 8, 16, ...} >> then binary floating point numbers (from a very simplistic viewpoint) >> add to that set the fractions {1/2, 1/4, 1/8, 1/16, ...}. 64-bit >> doubles (the typical Python "float" type) enables 53 consecutive >> values from that combined set: >> >> http://en.wikipedia.org/wiki/Double_precision_floating-point_format >> >> So numbers like 1, 1+1/2, 1+1/4, 1+1/8, can be represented exactly >> in decimal and binary (the minus sign is added here to force the >> bin function to output all 64 bits): >> >> --> import struct >> --> bin(struct.unpack('Q', struct.pack('d', float('-1.0000')))[0]) >> '0b1011111111110000000000000000000000000000000000000000000000000000' >> --> bin(struct.unpack('Q', struct.pack('d', float('-1.5000')))[0]) >> '0b1011111111111000000000000000000000000000000000000000000000000000' >> --> bin(struct.unpack('Q', struct.pack('d', float('-1.2500')))[0]) >> '0b1011111111110100000000000000000000000000000000000000000000000000' >> --> bin(struct.unpack('Q', struct.pack('d', float('-1.1250')))[0]) >> '0b1011111111110010000000000000000000000000000000000000000000000000' >> >> >> 1+1/10 works in decimal, but is a repeating pattern in binary: >> --> bin(struct.unpack('Q', struct.pack('d', float('-1.1000')))[0]) >> '0b1011111111110001100110011001100110011001100110011001100110011010' >> >> >> 1+1/3 repeats in both decimal and binary: >> --> -4/3. >> -1.3333333333333333 >> --> bin(struct.unpack('Q', struct.pack('d', float(-4/3.)))[0]) >> '0b1011111111110101010101010101010101010101010101010101010101010101' >> >> >> And then there's the weird stuff that may concern you: >> >> --> bin(struct.unpack('Q', struct.pack('d', float(-4/3. * 1000 / >> 1000)))[0]) >> '0b1011111111110101010101010101010101010101010101010101010101010101' >> --> bin(struct.unpack('Q', struct.pack('d', float(-4/3. + 1000 - >> 1000)))[0]) >> '0b1011111111110101010101010101010101010101010101010101011000000000' >> --> -4/3. + 1000 - 1000 >> -1.3333333333333712 >> >> The result of the last example can vary depending on the compiler >> and optimization flags, whether the code runs on the main FPU or >> vector coprocessor (eg, MMX), level of IEEE-754 compliance (which >> varies from none for early Crays to partly for early NVIDIA GPUs to >> full for most modern desktops), and any non-standard options (eg, >> rounding mode and denormal truncation) which other parts of your >> application or supporting libraries may have set... >> >> >> Hope that helps. >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jep200404 at columbus.rr.com Tue Dec 10 17:12:07 2013 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Tue, 10 Dec 2013 11:12:07 -0500 Subject: [CentralOH] Accept The Solutions In-Reply-To: References: <20131210082239.13d368cf.nludban@columbus.rr.com> Message-ID: <20131210111207.6fd8d134.jep200404@columbus.rr.com> On Tue, 10 Dec 2013 10:24:08 -0500, Louis Bogdan wrote: > It seems that I'm having a problem in getting my point across as to what I > would like to do, ... Lou, your problem has been understood and solved. See goo() near bottom in https://mail.python.org/pipermail/centraloh/2013-December/001919.html as discussed in https://mail.python.org/pipermail/centraloh/2013-December/001937.html. See custom_round() in https://mail.python.org/pipermail/centraloh/2013-December/001914.html. From looiebwv at gmail.com Tue Dec 10 17:16:26 2013 From: looiebwv at gmail.com (Louis Bogdan) Date: Tue, 10 Dec 2013 11:16:26 -0500 Subject: [CentralOH] Better Problem Description. In-Reply-To: References: <20131210082239.13d368cf.nludban@columbus.rr.com> Message-ID: Almost, pertneer, just a little tweeking. I think it should read if last _digit <3 # this takes care of a 1 or 2 last_digit=0 elif last_digit >7 # this takes care of an 8 or 9 last_digit = 0 next_last _digit +=1 else last_digit_<8 # this takes care of everything else last_digit + 5 I think the "everything else" should be last and also if last digit is already 0, don't mess with it. I guess if you put it in simple terms, it's easy to understand. Thanks much!!! lou On Tue, Dec 10, 2013 at 10:31 AM, Joe Shaw wrote: > Hi, > > To put it into pseudocode: > > if last_digit < 3: > last_digit = 0 > elif last_digit < 8: > last_digit = 5 > else: > last_digit = 0 > next_to_last_digit += 1 > > Is that correct? > > On Tue, Dec 10, 2013 at 10:24 AM, Louis Bogdan wrote: > > It seems that I'm having a problem in getting my point across as to what > I > > would like to do, so let's try another approach. > > > > I have a number, 1.2348 and it is of no consequence or interest where it > > came from, etc. I would like to manipulate the right hand most digit so > > that if it is greater that 7, I would increment it by 2 to 0 and end up > with > > the number being either 1.2350 or 1.2351. > > > > In like manner I would just change the right hand most digit to 0 as this > > would have no effect on any other digits, I would end up with the number > > being 1.2340. > > > > Now if the right hand digit was not greater than 7 nor less than 3, it > fall > > into the range of 3-8 and digits 3, 4, 5 ,6 &7 I change to digit 5 > > > > The end result of the above I will have a number whose right hand digit > will > > be either 0 or 5. And here again, what happens next is of no > consequence > > or interest to anyone but me. But to satisfy some people's curiosity, > the > > above number was derived from a keypad input, two integer four decimal, > and > > manipulated by an internal equation. The finally derived number will > then > > manipulated into an integer which will the number of steps required to > make > > a linear movement equal to the above number of inches. > > > > NOW!! HOW DO I SAY THAT IN PYTHON? > > > > > > > > > > On Tue, Dec 10, 2013 at 8:22 AM, Neil Ludban > > wrote: > >> > >> On Mon, 9 Dec 2013 18:59:01 -0500 > >> Louis Bogdan wrote: > >> ... > >> > > On Mon, Dec 9, 2013 at 12:56 PM, Louis Bogdan > >> > > wrote: > >> > >> Now I know that Python does rounding which I don't understand and > >> > >> have > >> > >> not found any decent, understandable explanation how it does it. I > >> > >> understand rounding, even way back when I was proficient with the > >> > >> abacus. > >> > >> It's really quantization errors, not rounding. If binary integers > >> are expressed as a sum of numbers from the set {1, 2, 4, 8, 16, ...} > >> then binary floating point numbers (from a very simplistic viewpoint) > >> add to that set the fractions {1/2, 1/4, 1/8, 1/16, ...}. 64-bit > >> doubles (the typical Python "float" type) enables 53 consecutive > >> values from that combined set: > >> > >> http://en.wikipedia.org/wiki/Double_precision_floating-point_format > >> > >> So numbers like 1, 1+1/2, 1+1/4, 1+1/8, can be represented exactly > >> in decimal and binary (the minus sign is added here to force the > >> bin function to output all 64 bits): > >> > >> --> import struct > >> --> bin(struct.unpack('Q', struct.pack('d', float('-1.0000')))[0]) > >> '0b1011111111110000000000000000000000000000000000000000000000000000' > >> --> bin(struct.unpack('Q', struct.pack('d', float('-1.5000')))[0]) > >> '0b1011111111111000000000000000000000000000000000000000000000000000' > >> --> bin(struct.unpack('Q', struct.pack('d', float('-1.2500')))[0]) > >> '0b1011111111110100000000000000000000000000000000000000000000000000' > >> --> bin(struct.unpack('Q', struct.pack('d', float('-1.1250')))[0]) > >> '0b1011111111110010000000000000000000000000000000000000000000000000' > >> > >> > >> 1+1/10 works in decimal, but is a repeating pattern in binary: > >> --> bin(struct.unpack('Q', struct.pack('d', float('-1.1000')))[0]) > >> '0b1011111111110001100110011001100110011001100110011001100110011010' > >> > >> > >> 1+1/3 repeats in both decimal and binary: > >> --> -4/3. > >> -1.3333333333333333 > >> --> bin(struct.unpack('Q', struct.pack('d', float(-4/3.)))[0]) > >> '0b1011111111110101010101010101010101010101010101010101010101010101' > >> > >> > >> And then there's the weird stuff that may concern you: > >> > >> --> bin(struct.unpack('Q', struct.pack('d', float(-4/3. * 1000 / > >> 1000)))[0]) > >> '0b1011111111110101010101010101010101010101010101010101010101010101' > >> --> bin(struct.unpack('Q', struct.pack('d', float(-4/3. + 1000 - > >> 1000)))[0]) > >> '0b1011111111110101010101010101010101010101010101010101011000000000' > >> --> -4/3. + 1000 - 1000 > >> -1.3333333333333712 > >> > >> The result of the last example can vary depending on the compiler > >> and optimization flags, whether the code runs on the main FPU or > >> vector coprocessor (eg, MMX), level of IEEE-754 compliance (which > >> varies from none for early Crays to partly for early NVIDIA GPUs to > >> full for most modern desktops), and any non-standard options (eg, > >> rounding mode and denormal truncation) which other parts of your > >> application or supporting libraries may have set... > >> > >> > >> Hope that helps. > > > > > > > > _______________________________________________ > > CentralOH mailing list > > CentralOH at python.org > > https://mail.python.org/mailman/listinfo/centraloh > > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jep200404 at columbus.rr.com Tue Dec 10 22:57:30 2013 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Tue, 10 Dec 2013 16:57:30 -0500 Subject: [CentralOH] =?utf-8?q?2013-12-09_=E6=9C=83=E8=AD=B0_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz8=?= Message-ID: <20131210165730.1c12b5b8.jep200404@columbus.rr.com> Thanks to Pillar Technology, Bob Myers, Nate Bennick, and Ben Rogers for hosting us. They took good care of us. There was salad, cookies including cream filled soft sandwich pumpkin cookies, plenty of pizza and adult beverages. http://www.catb.org/~esr/faqs/smart-questions.html#goal Often, people who need technical help have a high-level goal in mind and get stuck on what they think is one particular path towards the goal. They come for help with the step, but don't realize that the path is wrong. It can take substantial effort to get past this. http://en.wikipedia.org/wiki/Socratic_questioning http://en.wikipedia.org/wiki/Socratic_method http://www.catb.org/~esr/faqs/smart-questions.html http://wiki.centos.org/SpoonFeed http://web.archive.org/web/20090627155454/www.greenend.org.uk/rjk/2000/06/14/quoting.html We were in a new room where the projector shined on a bare wall. Because the room lights could be turned off to not shine on the wall, it was easy to see. Eric Floehr Computer Vision Open-Source Computer Vision Library written in C(++) python library that interfaces with it. (pretty thin layer) sudo apt-get install python-opencv SimpleCV See poll on: http://www.autoweek.com/article/20130530/CARNEWS/130539990 low-level nittygritty detail Practical Computer Vision opencv is introduced p197 Practical Computer Vision with SimpleCV The Simple Way to Make Technology See By Kurt Demaagd, Anthony Oliver, Nathan Oostendorp, Katherine Scott Publisher: O'Reilly Media Released: July 2012 Pages: 254 http://shop.oreilly.com/product/0636920024057.do OpenCV Computing with Python Programming Computer Vision with Python Tools and algorithms for analyzing images By Jan Erik Solem Publisher: O'Reilly Media Released: June 2012 Pages: 264 http://shop.oreilly.com/product/0636920022923.do OpenCV is in active development, so differences from book have arisen. https://github.com/sightmachine/simplecv Eric likes to use virtualenv wrapper https://pypi.python.org/pypi/virtualenvwrapper Eric likes to install big packages (like scipy and numpy) from system package manager (apt-get/yum) mkvirtualenv --system-site-packages cohpy-dec2013 workon tab completion works pip install svgwrite # undocumented dependency simplecv has a shell looks like its built on top of ipython (not notebook) SimpleCV:1> help(Motion) SimpleCV:2> example 32 sudoku solver github.com/abidrahmank/OpenCV2-Python/tree/master/OpenCV*? https://github.com/abidrahmank/OpenCV2-Python/tree/master/OpenCV_Python_Blog/sudoku_v_0.0.6 augmented reality OpenCV Computer Vision with Python By Joseph Howse Publisher: Packt Publishing Released: April 2013 Pages: 122 http://shop.oreilly.com/product/9781782163923.do Learning OpenCV Computer Vision with the OpenCV Library By Gary Bradski, Adrian Kaehler Publisher: O'Reilly Media Released: September 2008 Pages: 580 http://shop.oreilly.com/product/9780596516130.do Learning OpenCV Computer Vision in C++ with the OpenCV Library By Adrian Kaehler, Gary Bradski Publisher: O'Reilly Media Released: October 2013 Pages: 575 http://shop.oreilly.com/product/0636920022497.do Use pillow instead of PIL, because PIL has stagnated. https://pypi.python.org/pypi/Pillow https://pypi.python.org/pypi/Pillow/2.2.1 runs on Python 3 https://pypi.python.org/pypi/requests https://github.com/profjrr/COhPyDec92013 James Reed gave presentation on web page scraping with Python using BeautifulSoup from bs4 import BeautifulSoup spashtop remote desktop wp:Splashtop#Splashtop_Remote_Desktop https://pypi.python.org/pypi/Scrapy The Explorers Club was closed, even though we were there during posted hours. http://www.explorersclubmv.com/ There seems to be no apostrophes in "Explorers Club". Went to Jimmy V's instead. Gyro & fries for $5. http://www.jimmyvspub.com/ 912 S High St Lorem Ipsum left some comments. http://www.jimmyvspub.com/comments.html Someone kept asking how to write SQL when using an ORM, so a presentation on the benefits of using an ORM is needed. maybe http://www.linkedin.com/pub/john-cassidy/8/B21/26A http://www.yelp.com/biz/cgi-columbus-2 http://www.cgi.com/en http://www.superpages.com/bp/Columbus-OH/CGI-L2051932011.htm http://www.cgi.com/en/ohio what about pip install at system level? is that inherited? with --system-site-packages? with --no-site-packages? From winningham at gmail.com Tue Dec 10 23:09:26 2013 From: winningham at gmail.com (Thomas Winningham) Date: Tue, 10 Dec 2013 17:09:26 -0500 Subject: [CentralOH] =?utf-8?q?2013-12-09_=E6=9C=83=E8=AD=B0_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz8=?= In-Reply-To: <20131210165730.1c12b5b8.jep200404@columbus.rr.com> References: <20131210165730.1c12b5b8.jep200404@columbus.rr.com> Message-ID: Wanted to mention in relation the first link or so, the Perl people talk about the XY problem: http://www.perlmonks.org/index.pl?node_id=542341 ... I know this tripped me up early in my programming efforts, but I think even now I do this with new things I'm exploring. The worst was when the web was a little smaller and the only things you'd find were your own posts asking the unanswered question. Also, SimpleCV is amazingly fun to work with, thank you for giving that library some air time!! Is lxml or pyquery what should be talked about instead of beautiful soup? i know lxml has a beautiful soup mode, but CSS3 selectors are so very nice. Thank you guys for making such a great list!! On Tue, Dec 10, 2013 at 4:57 PM, wrote: > Thanks to Pillar Technology, Bob Myers, Nate Bennick, > and Ben Rogers for hosting us. They took good care of us. > There was salad, cookies including cream filled soft sandwich > pumpkin cookies, plenty of pizza and adult beverages. > > http://www.catb.org/~esr/faqs/smart-questions.html#goal > > Often, people who need technical help have a high-level goal > in mind and get stuck on what they think is one particular > path towards the goal. They come for help with the step, > but don't realize that the path is wrong. > It can take substantial effort to get past this. > > http://en.wikipedia.org/wiki/Socratic_questioning > http://en.wikipedia.org/wiki/Socratic_method > http://www.catb.org/~esr/faqs/smart-questions.html > http://wiki.centos.org/SpoonFeed > > http://web.archive.org/web/20090627155454/www.greenend.org.uk/rjk/2000/06/14/quoting.html > > We were in a new room where the projector shined on a bare wall. > Because the room lights could be turned off to not shine on the > wall, it was easy to see. > > Eric Floehr > Computer Vision > Open-Source Computer Vision Library > written in C(++) > python library that interfaces with it. (pretty thin layer) > sudo apt-get install python-opencv > SimpleCV > > See poll on: > http://www.autoweek.com/article/20130530/CARNEWS/130539990 > > low-level nittygritty detail Practical Computer Vision > opencv is introduced p197 > Practical Computer Vision with SimpleCV > The Simple Way to Make Technology See > By Kurt Demaagd, Anthony Oliver, Nathan Oostendorp, Katherine Scott > Publisher: O'Reilly Media > Released: July 2012 > Pages: 254 > http://shop.oreilly.com/product/0636920024057.do > > OpenCV Computing with Python > > Programming Computer Vision with Python > Tools and algorithms for analyzing images > By Jan Erik Solem > Publisher: O'Reilly Media > Released: June 2012 > Pages: 264 > http://shop.oreilly.com/product/0636920022923.do > OpenCV is in active development, so differences from book have arisen. > > https://github.com/sightmachine/simplecv > > Eric likes to use virtualenv wrapper > https://pypi.python.org/pypi/virtualenvwrapper > Eric likes to install big packages (like scipy and numpy) > from system package manager (apt-get/yum) > mkvirtualenv --system-site-packages cohpy-dec2013 > workon > tab completion works > > pip install svgwrite # undocumented dependency > > simplecv has a shell > looks like its built on top of ipython (not notebook) > > SimpleCV:1> help(Motion) > SimpleCV:2> example 32 > > sudoku solver > github.com/abidrahmank/OpenCV2-Python/tree/master/OpenCV*? > > https://github.com/abidrahmank/OpenCV2-Python/tree/master/OpenCV_Python_Blog/sudoku_v_0.0.6 > > augmented reality > > OpenCV Computer Vision with Python > By Joseph Howse > Publisher: Packt Publishing > Released: April 2013 > Pages: 122 > http://shop.oreilly.com/product/9781782163923.do > > Learning OpenCV > Computer Vision with the OpenCV Library > By Gary Bradski, Adrian Kaehler > Publisher: O'Reilly Media > Released: September 2008 > Pages: 580 > http://shop.oreilly.com/product/9780596516130.do > > Learning OpenCV > Computer Vision in C++ with the OpenCV Library > By Adrian Kaehler, Gary Bradski > Publisher: O'Reilly Media > Released: October 2013 > Pages: 575 > http://shop.oreilly.com/product/0636920022497.do > > Use pillow instead of PIL, because PIL has stagnated. > https://pypi.python.org/pypi/Pillow > https://pypi.python.org/pypi/Pillow/2.2.1 > runs on Python 3 > https://pypi.python.org/pypi/requests > https://github.com/profjrr/COhPyDec92013 > > James Reed > gave presentation on web page scraping with Python > using BeautifulSoup > from bs4 import BeautifulSoup > spashtop remote desktop > wp:Splashtop#Splashtop_Remote_Desktop > https://pypi.python.org/pypi/Scrapy > > The Explorers Club was closed, even though we were there during posted > hours. > http://www.explorersclubmv.com/ > There seems to be no apostrophes in "Explorers Club". > Went to Jimmy V's instead. Gyro & fries for $5. > http://www.jimmyvspub.com/ > 912 S High St > > Lorem Ipsum left some comments. > http://www.jimmyvspub.com/comments.html > > Someone kept asking how to write SQL when using an ORM, > so a presentation on the benefits of using an ORM is needed. > > maybe http://www.linkedin.com/pub/john-cassidy/8/B21/26A > http://www.yelp.com/biz/cgi-columbus-2 > http://www.cgi.com/en > http://www.superpages.com/bp/Columbus-OH/CGI-L2051932011.htm > http://www.cgi.com/en/ohio > > what about pip install at system level? > is that inherited? > with --system-site-packages? > with --no-site-packages? > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jep200404 at columbus.rr.com Tue Dec 10 23:37:03 2013 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Tue, 10 Dec 2013 17:37:03 -0500 Subject: [CentralOH] Screen Scraping Presentation In-Reply-To: References: <20131210165730.1c12b5b8.jep200404@columbus.rr.com> Message-ID: <20131210173703.55105ff2.jep200404@columbus.rr.com> On Tue, 10 Dec 2013 17:09:26 -0500, Thomas Winningham wrote: > Is lxml or pyquery what should be talked about instead of beautiful soup? i > know lxml has a beautiful soup mode, but CSS3 selectors are so very nice. Please give a presentation on other ways of screen scraping (that might even be better). How many other folks would like to see his presentation? From jcfolsom at pureperfect.com Tue Dec 10 23:45:48 2013 From: jcfolsom at pureperfect.com (Chris Folsom) Date: Tue, 10 Dec 2013 15:45:48 -0700 Subject: [CentralOH] Screen Scraping Presentation Message-ID: <20131210154548.7098ff60d8000ac98b0356cd27c73871.a143489087.wbe@email04.secureserver.net> An HTML attachment was scrubbed... URL: From miller.eric.t at gmail.com Tue Dec 10 23:50:52 2013 From: miller.eric.t at gmail.com (Eric Miller) Date: Tue, 10 Dec 2013 17:50:52 -0500 Subject: [CentralOH] Screen Scraping Presentation In-Reply-To: <20131210154548.7098ff60d8000ac98b0356cd27c73871.a143489087.wbe@email04.secureserver.net> References: <20131210154548.7098ff60d8000ac98b0356cd27c73871.a143489087.wbe@email04.secureserver.net> Message-ID: +1, would love to see this. On Tue, Dec 10, 2013 at 5:45 PM, Chris Folsom wrote: > > Sounds awesome. I would definitely attend. Currently using Nutch + Regexp. > > -------- Original Message -------- > Subject: [CentralOH] Screen Scraping Presentation > From: jep200404 at columbus.rr.com > Date: Tue, December 10, 2013 5:37 pm > To: "Mailing list for Central Ohio Python User Group (COhPy)" > > > On Tue, 10 Dec 2013 17:09:26 -0500, Thomas Winningham < > winningham at gmail.com> wrote: > > > Is lxml or pyquery what should be talked about instead of beautiful > soup? i > > know lxml has a beautiful soup mode, but CSS3 selectors are so very nice. > > Please give a presentation on other ways of screen scraping > (that might even be better). > > How many other folks would like to see his presentation? > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From winningham at gmail.com Tue Dec 10 23:56:38 2013 From: winningham at gmail.com (Thomas Winningham) Date: Tue, 10 Dec 2013 17:56:38 -0500 Subject: [CentralOH] Screen Scraping Presentation In-Reply-To: References: <20131210154548.7098ff60d8000ac98b0356cd27c73871.a143489087.wbe@email04.secureserver.net> Message-ID: Oh geez now I've done it :P Honestly I don't do too much. I had only heard about Nutch once, and when I googled it came across Scrapy. I did have some success with PyQuery like earlier in the year, but I only needed like one thing really and was thinking about the problem in CSS3 style, so it fit. I cannot say much about its performance. I've used lxml for some broken HTML and XML since its forgiving parser is somewhat nice depending on how muddy the water the is, but I don't know how much I could say about these things you couldn't google. I'll play around and try to come up with something then perhaps heh :P On Tue, Dec 10, 2013 at 5:50 PM, Eric Miller wrote: > +1, would love to see this. > > > On Tue, Dec 10, 2013 at 5:45 PM, Chris Folsom wrote: > >> >> Sounds awesome. I would definitely attend. Currently using Nutch + Regexp. >> >> -------- Original Message -------- >> Subject: [CentralOH] Screen Scraping Presentation >> From: jep200404 at columbus.rr.com >> Date: Tue, December 10, 2013 5:37 pm >> To: "Mailing list for Central Ohio Python User Group (COhPy)" >> >> >> On Tue, 10 Dec 2013 17:09:26 -0500, Thomas Winningham < >> winningham at gmail.com> wrote: >> >> > Is lxml or pyquery what should be talked about instead of beautiful >> soup? i >> > know lxml has a beautiful soup mode, but CSS3 selectors are so very >> nice. >> >> Please give a presentation on other ways of screen scraping >> (that might even be better). >> >> How many other folks would like to see his presentation? >> >> _______________________________________________ >> CentralOH mailing list >> CentralOH at python.org >> https://mail.python.org/mailman/listinfo/centraloh >> >> >> _______________________________________________ >> CentralOH mailing list >> CentralOH at python.org >> https://mail.python.org/mailman/listinfo/centraloh >> >> > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From herrold at owlriver.com Tue Dec 10 23:51:16 2013 From: herrold at owlriver.com (R P Herrold) Date: Tue, 10 Dec 2013 17:51:16 -0500 (EST) Subject: [CentralOH] Screen Scraping Presentation In-Reply-To: <20131210173703.55105ff2.jep200404@columbus.rr.com> References: <20131210165730.1c12b5b8.jep200404@columbus.rr.com> <20131210173703.55105ff2.jep200404@columbus.rr.com> Message-ID: On Tue, 10 Dec 2013, jep200404 at columbus.rr.com wrote: > On Tue, 10 Dec 2013 17:09:26 -0500, Thomas Winningham wrote: > > > Is lxml or pyquery what should be talked about instead of beautiful soup? i > > know lxml has a beautiful soup mode, but CSS3 selectors are so very nice. > > Please give a presentation on other ways of screen scraping > (that might even be better). I was thinking that an optically based OpenCV and the online-poker venues seemed like a natural fit (compared to the bloodless Soduku). The operators of those sites use clients that try to keep away robo-players ... but ... if one can work across an air-gap, they wil not be able to stop that -- Russ herrold From winningham at gmail.com Wed Dec 11 00:25:51 2013 From: winningham at gmail.com (Thomas Winningham) Date: Tue, 10 Dec 2013 18:25:51 -0500 Subject: [CentralOH] Screen Scraping Presentation In-Reply-To: References: <20131210165730.1c12b5b8.jep200404@columbus.rr.com> <20131210173703.55105ff2.jep200404@columbus.rr.com> Message-ID: I would check out Sikuli for that, very interesting Jython thing where you put little clips of the screen as parameters to functions. But couldn't they eventually tell by the too precise timing? Then maybe you could come up with a bunch of fake human things like triple thinking, making occasional dumb mistakes, maybe record your nervous mouse habits and replay them... hrmm! I'm too busy gambling with my career and inter-personal relationships which is enough money down the drain as it is :P Could be fun to play with!! What about short of full automation some kind of tooling to let you play like hundreds of hands simultaneously somehow better? Or some such assistance that is still technically not a robot? On Tue, Dec 10, 2013 at 5:51 PM, R P Herrold wrote: > On Tue, 10 Dec 2013, jep200404 at columbus.rr.com wrote: > > > On Tue, 10 Dec 2013 17:09:26 -0500, Thomas Winningham < > winningham at gmail.com> wrote: > > > > > Is lxml or pyquery what should be talked about instead of beautiful > soup? i > > > know lxml has a beautiful soup mode, but CSS3 selectors are so very > nice. > > > > Please give a presentation on other ways of screen scraping > > (that might even be better). > > I was thinking that an optically based OpenCV and the > online-poker venues seemed like a natural fit (compared to the > bloodless Soduku). The operators of those sites use clients > that try to keep away robo-players ... but ... if one can work > across an air-gap, they wil not be able to stop that > > -- Russ herrold > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > -------------- next part -------------- An HTML attachment was scrubbed... URL: From herrold at owlriver.com Wed Dec 11 00:38:50 2013 From: herrold at owlriver.com (R P Herrold) Date: Tue, 10 Dec 2013 18:38:50 -0500 (EST) Subject: [CentralOH] Screen Scraping Presentation In-Reply-To: References: <20131210165730.1c12b5b8.jep200404@columbus.rr.com> <20131210173703.55105ff2.jep200404@columbus.rr.com> Message-ID: On Tue, 10 Dec 2013, Thomas Winningham wrote: > I would check out Sikuli for that, very interesting Jython thing where you > put little clips of the screen as parameters to functions. > But couldn't they eventually tell by the too precise timing? easy enough to add several non-correlated 'jitter' delays ... and poker is not a 'speed' game, so one need not be fast > Then maybe you > could come up with a bunch of fake human things like triple thinking, > making occasional dumb mistakes, maybe record your nervous mouse habits and > replay them... hrmm! yes ... called bluffing in some circles ;) > I'm too busy gambling with my career and > inter-personal relationships which is enough money down the drain as it is > :P Could be fun to play with!! What about short of full automation some > kind of tooling to let you play like hundreds of hands simultaneously > somehow better? One assumes that the vendors watch for IP addresses of players to rule out such economies of scale > Or some such assistance that is still technically not a > robot? a 'heads up display' overlay to assist a live player to peak performance, and to also act as a trainer of 'correct' repsonses, comes to mind: Cue: Nicholas Cage, singing 'I am the greatest' https://www.youtube.com/watch?v=2FyuHA_zAOM -- Russ herrold From eric at intellovations.com Wed Dec 11 00:41:11 2013 From: eric at intellovations.com (Eric Floehr) Date: Tue, 10 Dec 2013 18:41:11 -0500 Subject: [CentralOH] Screen Scraping Presentation In-Reply-To: References: <20131210165730.1c12b5b8.jep200404@columbus.rr.com> <20131210173703.55105ff2.jep200404@columbus.rr.com> Message-ID: > > a 'heads up display' overlay to assist a live player to peak > performance, and to also act as a trainer of 'correct' > repsonses, comes to mind: > There's an app for that (on Android at least) and it uses OpenCV even! https://play.google.com/store/apps/details?id=net.aasuited.pokeroddscamera -Eric -------------- next part -------------- An HTML attachment was scrubbed... URL: From eric at intellovations.com Tue Dec 10 20:03:12 2013 From: eric at intellovations.com (Eric Floehr) Date: Tue, 10 Dec 2013 14:03:12 -0500 Subject: [CentralOH] The Mustached Cloud Message-ID: Enjoyed presenting last night, thanks to Pillar for hosting. I'm still working on gathering all the links together, but I thought I'd share a cool face found in one of my timelapses via SimpleCV... I call him the Mustached Cloud Man. He looks better the more you squint. The attached picture was enhanced a bit by stretching contrast, despeckling, and normalizing. [image: Inline image 1] -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: the_mustached_man_2.jpg Type: image/jpeg Size: 10284 bytes Desc: not available URL: From Richard.C.1 at bwc.state.oh.us Wed Dec 11 13:57:24 2013 From: Richard.C.1 at bwc.state.oh.us (Richard.C.1 at bwc.state.oh.us) Date: Wed, 11 Dec 2013 12:57:24 +0000 Subject: [CentralOH] Screen Scraping Presentation In-Reply-To: <20131210173703.55105ff2.jep200404@columbus.rr.com> References: <20131210165730.1c12b5b8.jep200404@columbus.rr.com> <20131210173703.55105ff2.jep200404@columbus.rr.com> Message-ID: <05CEC79B81631F4BAFAF8E30F65E45DB0930B3EB@SOCEMMB04> Yes. -----Original Message----- From: CentralOH [mailto:centraloh-bounces+richard.c.1=bwc.state.oh.us at python.org] On Behalf Of jep200404 at columbus.rr.com Sent: Tuesday, December 10, 2013 5:37 PM To: Mailing list for Central Ohio Python User Group (COhPy) Subject: [CentralOH] Screen Scraping Presentation On Tue, 10 Dec 2013 17:09:26 -0500, Thomas Winningham wrote: > Is lxml or pyquery what should be talked about instead of beautiful > soup? i know lxml has a beautiful soup mode, but CSS3 selectors are so very nice. Please give a presentation on other ways of screen scraping (that might even be better). How many other folks would like to see his presentation? _______________________________________________ CentralOH mailing list CentralOH at python.org https://mail.python.org/mailman/listinfo/centraloh Portions of this message may be confidential under an exemption to Ohio's public records law or under a legal privilege. If you have received this message in error or due to an unauthorized transmission or interception, please delete all copies from your system without disclosing, copying, or transmitting this message. From brian.costlow at gmail.com Wed Dec 11 20:37:25 2013 From: brian.costlow at gmail.com (Brian Costlow) Date: Wed, 11 Dec 2013 14:37:25 -0500 Subject: [CentralOH] The Mustached Cloud In-Reply-To: References: Message-ID: If I squint real hard, I get this http://images4.wikia.nocookie.net/__cb20130510203024/deadliestfiction/images/7/7e/Iosif_Stalin.jpeg On Tue, Dec 10, 2013 at 2:03 PM, Eric Floehr wrote: > Enjoyed presenting last night, thanks to Pillar for hosting. > > I'm still working on gathering all the links together, but I thought I'd > share a cool face found in one of my timelapses via SimpleCV... > > I call him the Mustached Cloud Man. He looks better the more you squint. > The attached picture was enhanced a bit by stretching contrast, > despeckling, and normalizing. > > > [image: Inline image 1] > > > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: the_mustached_man_2.jpg Type: image/jpeg Size: 10284 bytes Desc: not available URL: From jcfolsom at pureperfect.com Thu Dec 12 04:34:05 2013 From: jcfolsom at pureperfect.com (Chris Folsom) Date: Wed, 11 Dec 2013 20:34:05 -0700 Subject: [CentralOH] The Mustached Cloud Message-ID: <20131211203405.7098ff60d8000ac98b0356cd27c73871.f936695649.wbe@email04.secureserver.net> An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: the_mustached_man_2.jpg Type: image/jpeg Size: 10284 bytes Desc: not available URL: From eric at intellovations.com Thu Dec 12 14:19:47 2013 From: eric at intellovations.com (Eric Floehr) Date: Thu, 12 Dec 2013 08:19:47 -0500 Subject: [CentralOH] Great example of IPython Notebook Message-ID: A great example of the use of IPython Notebook, used to examine the online reaction to Amazon Prime Air: http://nbviewer.ipython.org/github/ptwobrussell/Mining-the-Social-Web-2nd-Edition/blob/master/ipynb/__Understanding%20the%20Reaction%20to%20%22Amazon%20Prime%20Air%22.ipynb -------------- next part -------------- An HTML attachment was scrubbed... URL: From joe at joeshaw.org Thu Dec 12 19:49:11 2013 From: joe at joeshaw.org (Joe Shaw) Date: Thu, 12 Dec 2013 13:49:11 -0500 Subject: [CentralOH] Great example of IPython Notebook In-Reply-To: References: Message-ID: Hi, Another great example: Peter Norvig's examination of the traveling salesman problem. http://nbviewer.ipython.org/url/norvig.com/ipython/TSPv3.ipynb Joe On Thu, Dec 12, 2013 at 8:19 AM, Eric Floehr wrote: > A great example of the use of IPython Notebook, used to examine the online > reaction to Amazon Prime Air: > > http://nbviewer.ipython.org/github/ptwobrussell/Mining-the-Social-Web-2nd-Edition/blob/master/ipynb/__Understanding%20the%20Reaction%20to%20%22Amazon%20Prime%20Air%22.ipynb > > > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > From jaredbrock at sbcglobal.net Sun Dec 15 22:53:37 2013 From: jaredbrock at sbcglobal.net (Jared Brock) Date: Sun, 15 Dec 2013 13:53:37 -0800 (PST) Subject: [CentralOH] Looking for Introductory Python Materials Message-ID: <1387144417.91262.YahooMailNeo@web180906.mail.ne1.yahoo.com> Greeting Pythonistas. I am a student with a neglegible amount of programming experience who was referred to both Python and this group as a way to learn the language. I am looking for suggestings on books, websites, or other materials that can serve as a good starting place. The one online tutorial I found (http://docs.python.org/2/tutorial/index.html) did have examples of basic concepts but lacked any suggested problems to solve to reinforce those concepts. And in case someone asks, I am not currently able to make it to the Friday DoJo's for the time being. Thanks for reading, and double thanks for replies. -------------- next part -------------- An HTML attachment was scrubbed... URL: From miller.eric.t at gmail.com Sun Dec 15 23:35:11 2013 From: miller.eric.t at gmail.com (Eric Miller) Date: Sun, 15 Dec 2013 17:35:11 -0500 Subject: [CentralOH] Looking for Introductory Python Materials In-Reply-To: <1387144417.91262.YahooMailNeo@web180906.mail.ne1.yahoo.com> References: <1387144417.91262.YahooMailNeo@web180906.mail.ne1.yahoo.com> Message-ID: If you want free, then these are good resources: http://www.tutorialspoint.com/python/ http://www.learnpython.org/ https://developers.google.com/edu/python/ http://docs.python.org/2/tutorial/ and, my personal favorite: http://pymotw.com/2/contents.html If you aren't afraid of paying, the O'Reilly certification is second to none. I am halfway done with it, and it taught me a lot. It's 160 hours of training total, it can't be beat to get you from zero to hero in the shortest amount of time. If you are new to python, you may want to avoid python 3.3 in favor of 2.7.6 This might sound like weird advice, but 3.3 isn't really "better" from a learning pespective. So much of what is availalbe online and in stackoverflow articles is written in 2.x.x, and 3.3. is not backwards compatible. Once you know python, switching to 3.3 is a breeze (or back and forth between the two). But for learning, I'd say use 2.7.6 http://www.oreillyschool.com/certificate-programs/python-programming/ On Sun, Dec 15, 2013 at 4:53 PM, Jared Brock wrote: > Greeting Pythonistas. I am a student with a neglegible amount of > programming experience who was referred to both Python and this group as a > way to learn the language. I am looking for suggestings on books, websites, > or other materials that can serve as a good starting place. The one online > tutorial I found (http://docs.python.org/2/tutorial/index.html) did have > examples of basic concepts but lacked any suggested problems to solve to > reinforce those concepts. > And in case someone asks, I am not currently able to make it to the Friday > DoJo's for the time being. > > Thanks for reading, and double thanks for replies. > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From phpdotsql at gmail.com Sun Dec 15 23:43:52 2013 From: phpdotsql at gmail.com (Brian Good) Date: Sun, 15 Dec 2013 17:43:52 -0500 Subject: [CentralOH] Looking for Introductory Python Materials In-Reply-To: <1387144417.91262.YahooMailNeo@web180906.mail.ne1.yahoo.com> References: <1387144417.91262.YahooMailNeo@web180906.mail.ne1.yahoo.com> Message-ID: http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-189-a-gentle-introduction-to-programming-using-python-january-iap-2011/ On Sun, Dec 15, 2013 at 4:53 PM, Jared Brock wrote: > Greeting Pythonistas. I am a student with a neglegible amount of > programming experience who was referred to both Python and this group as a > way to learn the language. I am looking for suggestings on books, websites, > or other materials that can serve as a good starting place. The one online > tutorial I found (http://docs.python.org/2/tutorial/index.html) did have > examples of basic concepts but lacked any suggested problems to solve to > reinforce those concepts. > And in case someone asks, I am not currently able to make it to the Friday > DoJo's for the time being. > > Thanks for reading, and double thanks for replies. > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pcarswell.1 at gmail.com Mon Dec 16 16:58:26 2013 From: pcarswell.1 at gmail.com (Peter Carswell) Date: Mon, 16 Dec 2013 10:58:26 -0500 Subject: [CentralOH] Looking for Introductory Python Materials In-Reply-To: <1387144417.91262.YahooMailNeo@web180906.mail.ne1.yahoo.com> References: <1387144417.91262.YahooMailNeo@web180906.mail.ne1.yahoo.com> Message-ID: Jared, Here is a book that I use in my Game Developer Track at Columbus State CC. It focuses on programming games which is a good place to start. And it covers the basics of Python, including object oriented programming. Don't let the name fool you ... it does go through some complex programming designs. Good luck. Dawson, Michael, Python Programming for the absolute beginner, Third Edition pete On Sun, Dec 15, 2013 at 4:53 PM, Jared Brock wrote: > Greeting Pythonistas. I am a student with a neglegible amount of > programming experience who was referred to both Python and this group as a > way to learn the language. I am looking for suggestings on books, websites, > or other materials that can serve as a good starting place. The one online > tutorial I found (http://docs.python.org/2/tutorial/index.html) did have > examples of basic concepts but lacked any suggested problems to solve to > reinforce those concepts. > And in case someone asks, I am not currently able to make it to the Friday > DoJo's for the time being. > > Thanks for reading, and double thanks for replies. > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jaredbrock at sbcglobal.net Mon Dec 16 18:56:51 2013 From: jaredbrock at sbcglobal.net (Jared Brock) Date: Mon, 16 Dec 2013 09:56:51 -0800 (PST) Subject: [CentralOH] Looking for Introductory Python Materials In-Reply-To: References: <1387144417.91262.YahooMailNeo@web180906.mail.ne1.yahoo.com> Message-ID: <1387216611.49517.YahooMailNeo@web180905.mail.ne1.yahoo.com> Thanks for the help. I've put in a request to the library for the mentioned book, and am going through the various links and see if they have what I'm looking for.Currently looking at the Google class, the learn python site, and MIT OPW materials. I expect to find what I'm looking for in one or more of these options. Thanks again. -------------- next part -------------- An HTML attachment was scrubbed... URL: From erik.n.welch at gmail.com Mon Dec 16 19:42:35 2013 From: erik.n.welch at gmail.com (Erik Welch) Date: Mon, 16 Dec 2013 13:42:35 -0500 Subject: [CentralOH] Looking for Introductory Python Materials In-Reply-To: <1387216611.49517.YahooMailNeo@web180905.mail.ne1.yahoo.com> References: <1387144417.91262.YahooMailNeo@web180906.mail.ne1.yahoo.com> <1387216611.49517.YahooMailNeo@web180905.mail.ne1.yahoo.com> Message-ID: Here is a list of Python resources on the internet that are suitable for all levels of expertise: https://github.com/kirang89/pycrumbs/blob/master/pycrumbs.md On Mon, Dec 16, 2013 at 12:56 PM, Jared Brock wrote: > Thanks for the help. I've put in a request to the library for the > mentioned book, and am going through the various links and see if they have > what I'm looking for. Currently looking at the Google class, the learn > python site, and MIT OPW materials. I expect to find what I'm looking for > in one or more of these options. Thanks again. > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From langfod at gmail.com Tue Dec 17 02:29:47 2013 From: langfod at gmail.com (David Langford) Date: Mon, 16 Dec 2013 20:29:47 -0500 Subject: [CentralOH] Looking for Introductory Python Materials In-Reply-To: <1387144417.91262.YahooMailNeo@web180906.mail.ne1.yahoo.com> References: <1387144417.91262.YahooMailNeo@web180906.mail.ne1.yahoo.com> Message-ID: I see that the pycrumbs list got mentioned so some of these may be redundant but here are some of course sites I have found: https://www.udacity.com/course/cs101 https://www.edx.org/course/mitx/mitx-6-00-1x-introduction-computer-1122 (One section just finished though the materials are still available - it should run again for the whole course in a couple months) https://www.coursera.org/course/programming1 https://www.coursera.org/course/interactivepython https://www.khanacademy.org/science/computer-science-subject/computer-science http://www.reddit.com/r/learnpython/ http://www.learnstreet.com/lessons/study/python https://online.dr-chuck.com/index.php http://opentechschool.github.io/python-beginners/en/index.html http://programarcadegames.com/ http://interactivepython.org/courselib/static/thinkcspy/index.html On Sun, Dec 15, 2013 at 4:53 PM, Jared Brock wrote: > Greeting Pythonistas. I am a student with a neglegible amount of > programming experience who was referred to both Python and this group as a > way to learn the language. I am looking for suggestings on books, websites, > or other materials that can serve as a good starting place. The one online > tutorial I found (http://docs.python.org/2/tutorial/index.html) did have > examples of basic concepts but lacked any suggested problems to solve to > reinforce those concepts. > And in case someone asks, I am not currently able to make it to the Friday > DoJo's for the time being. > > Thanks for reading, and double thanks for replies. > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jep200404 at columbus.rr.com Sat Dec 21 04:02:12 2013 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Fri, 20 Dec 2013 22:02:12 -0500 Subject: [CentralOH] =?utf-8?q?2013-12-13_=E9=81=93=E5=A0=B4_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz8=?= Message-ID: <20131220220212.046a86c9.jep200404@columbus.rr.com> 4 folks http://drupalcampohio.org/drupalcamp-ohio-2013 http://www.meetup.com/Central-Ohio-Drupal/events/146963472/ use pytest instead of unittest https://pypi.python.org/pypi/pytest https://wiki.python.org/moin/PyTest oh my: wp:Fallingwater get the in-depth tour wp:Kentuck Knob wp:Polymath Park sleep in a Usonian house wp:Robber_baron_(industrialist) scallion, green onion, spring onion coconut milk packets laksa paste wp:laksa From jep200404 at columbus.rr.com Sat Dec 21 04:15:25 2013 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Fri, 20 Dec 2013 22:15:25 -0500 Subject: [CentralOH] =?utf-8?q?2013-12-20_=E9=81=93=E5=A0=B4_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz8=?= Message-ID: <20131220221525.6fe4d82f.jep200404@columbus.rr.com> Knuth & McIlroy http://www.leancrew.com/all-this/2011/12/more-shell-less-egg/ Why Pascal is Not My Favorite Programming Language Brian W. Kernighan, April 2, 1981 AT&T Bell Laboratories, Murray Hill, New Jersey 07974 http://cm.bell-labs.com/cm/cs/cstr/100.ps.gz http://www.lysator.liu.se/c/bwk-on-pascal.html "Compatibility means deliberately repeating other people's mistakes." "wp:" prefix means Wikipedia. E.g., "wp:foo" indicates http://en.wikipedia.org/wiki/Foo Review Brandon Rhodes presentation about structure of code lightning version of PyCon Ireland 2013 presentation https://mail.python.org/pipermail/centraloh/2013-October/001867.html What is the Pace of Pace Wheeler in "http://rhodesmill.org/brandon/slides/2013-10-pyconie/"? isolate I/O code nifty: tr -cs A-Za-z '\n' wp:David Wheeler (computer scientist) wp:Burrows?Wheeler transform wp:trie From jep200404 at columbus.rr.com Sun Dec 29 13:52:18 2013 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Sun, 29 Dec 2013 07:52:18 -0500 Subject: [CentralOH] =?utf-8?q?2013-12-27_=E9=81=93=E5=A0=B4_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz8=?= Message-ID: <20131229075218.39fd8649.jep200404@columbus.rr.com> A Raspberry Pi was given away for free. It was the desirable B model with 512 MB of RAM. "wp:" prefix means Wikipedia. E.g., "wp:foo" indicates http://en.wikipedia.org/wiki/Foo @@@@@@@@@@@@ from a browser, upload file to server that is running Django. then want Django to process the uploaded https://docs.djangoproject.com/en/dev/topics/files/ https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.FileField http://stackoverflow.com/questions/5871730/need-a-minimal-django-file-upload-example wp:Albania wp:Albanian_language http://www.djangobook.com/en/2.0/index.html Brandon Rhodes's Astronomy presentation came up again as a good tour of what Ipython Notebook can do. https://mail.python.org/pipermail/centraloh/2013-February/001551.html wp:Convex function excellent super nerdy with classic old personal computers wp:Computer Chess (film) The Austin Goodwill Computer Museum is credited. http://goodwillcomputermuseum.org/about.html Likely they lent parts of their collection for making the movie. wp:Erhard Seminars Training wp:Do Androids Dream of Electric Sheep? wp:Yagi-Uda antenna 102.1 MHz FM 0300 to 1500 wp:WCRX-LP http://nedbatchelder.com/code/cog/ http://susansenator.com/makingpeace.html From jep200404 at columbus.rr.com Mon Dec 30 23:39:43 2013 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Mon, 30 Dec 2013 17:39:43 -0500 Subject: [CentralOH] XY Problem In-Reply-To: References: <20131210165730.1c12b5b8.jep200404@columbus.rr.com> Message-ID: <20131230173943.121e4207.jep200404@columbus.rr.com> On Tue, 10 Dec 2013 17:09:26 -0500, Thomas Winningham wrote: > Wanted to mention in relation the first link or so, > the Perl people talk about the XY problem: > http://www.perlmonks.org/index.pl?node_id=542341 That's a great link. Now just to confuse things, let's see what reaction we get from XY about XY being a problem.