Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #93426
| References | <fd370a7b-ea6a-48e5-90f4-9d86b89a745e@googlegroups.com> |
|---|---|
| Date | 2015-07-02 10:05 -0500 |
| Subject | Re: "normalizing" a value |
| From | Skip Montanaro <skip.montanaro@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.244.1435849550.3674.python-list@python.org> (permalink) |
This looks like a straightforward linear transformation issue to me (like Fahrenheit to Celsius). Add 50 to all input values, giving you values in the range 0 to 100. Then scale them into your 0 to 12 range by multiplying them by 12/100: >>> for n in range(-50, 50, 3): ... print n, n + 50, (n + 50) * 12 / 100 ... -50 0 0.0 -47 3 0.36 -44 6 0.72 -41 9 1.08 -38 12 1.44 ... 34 84 10.08 37 87 10.44 40 90 10.8 43 93 11.16 46 96 11.52 49 99 11.88 Did I misread your request in some way? Skip
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
"normalizing" a value bvdp <bob@mellowood.ca> - 2015-07-01 17:12 -0700
Re: "normalizing" a value MRAB <python@mrabarnett.plus.com> - 2015-07-02 01:30 +0100
Re: "normalizing" a value Paul Rubin <no.email@nospam.invalid> - 2015-07-01 17:36 -0700
Re: "normalizing" a value Denis McMahon <denismfmcmahon@gmail.com> - 2015-07-02 01:06 +0000
Re: "normalizing" a value random832@fastmail.us - 2015-07-01 21:27 -0400
Re: "normalizing" a value bvdp <bob@mellowood.ca> - 2015-07-01 18:49 -0700
Re: "normalizing" a value random832@fastmail.us - 2015-07-01 22:23 -0400
Re: "normalizing" a value bvdp <bob@mellowood.ca> - 2015-07-01 19:41 -0700
Re: "normalizing" a value Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-07-01 23:36 -0400
Re: "normalizing" a value bvdp <bob@mellowood.ca> - 2015-07-02 10:03 -0700
Re: "normalizing" a value Steven D'Aprano <steve@pearwood.info> - 2015-07-02 12:15 +1000
Re: "normalizing" a value bvdp <bob@mellowood.ca> - 2015-07-01 19:42 -0700
Re: "normalizing" a value Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-07-02 05:41 +0100
Re: "normalizing" a value Skip Montanaro <skip.montanaro@gmail.com> - 2015-07-02 10:05 -0500
csiph-web