[Tutor] mapping/filtering a sequence
kevin parks
kp8 at mac.com
Sat Sep 5 17:21:18 CEST 2009
I can think of about 80 billion reasons why you would encounter data
outside your grid, esp. if you aren't the original producer of the
data. Imagine you are mapping something to color (RGB values) or you
are doing a signification of volcanic activity or the big bang or the
earth's magnetic field and you are getting data from an external data.
Mapping of external data happens all the time. Like the xSonify
project, a Java application to display numerical data as sound by
NASA, etc.
Sometimes (to stay with this example) the data you have doesn't fit
exactly to your grid (in this case a tuning system of musical pitches
within the 12-tone ET system or any other form of tuning which will
have discreet steps or a mix of RGB colors)
Then what you would want to do is map the data to the nearest value no?
>>Why is data being generated outside your grid?
Because it is data given to me by an outside source for example, not
necessarily data i generated myself, or it is the result of some
algorithm or natural number series or a fractal, sensor data, younameit.
>>What are the available values for the grid? Are they flexible or
permanent? A bit more info would be helpful in finding a solution.
At this moment, i have input that represents 7-bits of sensor data
resolution (128) so a fixed grid of integers 0-127 is how i am getting
this data in but i don't have all 0-127 to map it to.
For this particular hack, I am mostly getting useful values in the
range 30-85, so I am filtering out anything below 34 and above 83, but
i don't have 34-83 contiguous. I have a gap toothed integer grid of:
[34, 39, 41, 42, 43, 44, 46, 48, 49, 50, 51, 53, 54, 55, 56, 58, 60,
61, 62, 63, 65, 66, 67, 68, 70, 72, 73, 75, 77, 79, 80, 82]
I want to map each incoming integer to the closest one available. I
know, it is idiosyncratic. I also need to be able to do this with
other idiosyncratic gap toothed sets.
It's a weird, idiosyncratic, real world messy question.
If there is no easy way, it would prolly be just as easy to hack it
all up with conditionals by hand at this point.
cheers,
k
PS. Os there some reason why it suddenly takes a day to see your posts
to the tutor list appear? I thought this query didn't make it through
and gave up as i sent it yesterday and it only popped up on list just
now.
On Sep 5, 2009, at 11:47 PM, Wayne wrote:
> On Fri, Sep 4, 2009 at 12:31 PM, kevin parks <kp8 at mac.com> wrote:
> I am doing some data massage, minor mapping and filtering really and
> i find that i have a lot of this kind of kludgy code:
> <snip>
> To do some basic jiggering of some out of range off grid data.
>
> There has to be a better, more elegant, more flexible less brute
> force more pythonic way to do this kind of mapping no?
>
> Why is data being generated outside your grid? That's the first
> question you should ask, and probably the better way to address the
> problem.
>
> What are the available values for the grid? Are they flexible or
> permanent? A bit more info would be helpful in finding a solution.
>
> -Wayne
More information about the Tutor
mailing list