So I have a function called find_positions which gives off values like [101,207] [99, 87] [34, 56] etc.

I then have a centre of mass function called CoM which when any region is put in, can find the centre of mass of that region.

Herein lies the problem. I need to create a third function, called CoM_positions which takes the data points from find_positions, then using the CoM function refines these positions making them more clear. Haven;t got a clue how to link the 2 functions, so if anyone can help i'd be grateful,

furret

Call the function where needed to perform its duties.
;)

It would be something along these lines, see "Functions" here:

def CoM_positions(value_in):
    if some_condition:     ## or whatever
        CoM_return = CoM(value_in)
        print CoM_return, value_in
        return CoM_return

return_value = find_positions(positions)
better_values= CoM_positions(return_value)
print better_values
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.