COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

• Email
• Follow

```Hello Friends,

I am trying to write imadjust function my self, but I don't know how to map between the ranges of low_in and high_in, I map low_in to low_out and I map high_in to high_out, but I don't know how to map the range between low_in and high_in to low_out and high_out,
I would appreciate any help :)
Fariba
```
 0

See related articles to this posting

```On 3/24/2011 5:19 AM, Fariba Yousefi wrote:
> Hello Friends,
>
> I am trying to write imadjust function my self, but I don't know how
>  to map between the ranges of low_in and high_in, I map low_in to low_out
>  and I map high_in to high_out, but I don't know how to map the range
>  between low_in and high_in to low_out and high_out,
> I would appreciate any help :)
> Fariba

Just

and the code is there to see how !

--Nasser
```
 0

1 Replies
665 Views

Similar Articles

12/6/2013 5:04:42 AM
page loaded in 9774 ms. (0)

Similar Artilces:

function decorator-like function
Hi, Still learning Python, now decorators. Before diving deeply into decorators, I'd like to apply a function to another function. My "extremely simple function" should print number 3, then the sum of its 2 arguments. Say that I call f(5,7) I'd like to get, somehow, 3 then 12. I've tried the following: def d(f): print 3 return f def f(a, b): print a+b f=d(f) However, it does not work. Calling f(5,7) only returns 12, (3 is missing) How should I proceed? On Mar 27, 10:24=A0am, vsoler <vicente.so...@gmail.com> wrote: > Hi, > > Still learning Python, now decorators. > > Before diving deeply into decorators, I'd like to apply a function to > another function. > > My "extremely simple function" should print number 3, then the sum of > its 2 arguments. > > Say that I call =A0 f(5,7) > I'd like to get, somehow, 3 then 12. > > I've tried the following: > > def d(f): > =A0 =A0 print 3 > =A0 =A0 return f > > def f(a, b): > =A0 =A0 print a+b > > f=3Dd(f) > > However, it does not work. Calling f

Re: Function stopping a function
In my situation, there is a device with keyboard that allows some user input. In the same time, the device is connected to a standard PC, and there may be some communication there. The lengthy_function() resides and executes in the device, and so is cancel(). Lengthy_function() is pretty linear: according to some conditions, the user is asked for this or that. Than, with the new conditions, lenghty_function() may need to communicate with the PC. And now, with the updated conditions, may ask more stuff from user. At any time the user can press a CANCEL button, or the PC can generate a CANCEL. What I have now is a global variable which cancel() will change and then, each "if" statement in lenghty_function() will check that variable, together with its specific condition. I was hopping that there may be a more elegant solution. No threads involved in my design (apart for what the device may have to handle events like button-press and serial communication). Thanks everyone for your answers. Regards, SxN ____________________________________________________________________________________ Get easy, one-click access to your favorites. Make Yahoo! your homepage

When is a function not a function?
I've got a collection of functions that accept a function or object (paired with a method name) as a callback. For the longest time I have relied on this test. (typeof cb == 'function') This should work as well, but I am not sure how well it degrades in older browsers. I think there are issues with functions created in another context (eg frame) as well. (cb instanceof Function) Then I came across this. (!!fn && typeof fn != "string" && !fn.nodeName && fn.constructor != Array && /function/i.test( fn + "" )) I'm sure...; wrote: > I've got a collection of functions that accept a function or object > (paired with a method name) as a callback. > > For the longest time I have relied on this test. > > (typeof cb == 'function') > > This should work as well, but I am not sure how well it degrades in > older browsers. I think there are issues with functions created in > another context (eg frame) as well. > > (cb instanceof Function) > > Then I came across this. > > (!!fn && typeof fn != "string" && !fn.nodeName &&

Function returns a function
Hello, I want a "function factory" function in python. To do this I made a class like such (this is for Tkinter, in case your wondering): class FunctionMaker: def __init__(self, avar, function, label) self.var = avar self.function = function self.label = label def __call__(self, e=None): self.avar.set(self.label) self.function() It seems that it would make more sense to make this a function and add it to the mixin I am writing. But I'm not quite sure how to do this without making lambdas, which seem a little messy and also look to be on the brink of deprecation (really not trying to start a lambda pro/con thread here). Any ideas on how to do this with a regular function, or is the way I've done it the pythonic choice? James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ James Stroud <jstroud@mbi.ucla.edu> writes: > Any ideas on how to do this with a regular function, or is the way I've done > it the pythonic choice? I think you're trying to do something like this: def FunctionMaker(avar, func, label): def callback

function in a function accessing vars
Hi all, I wanted to solve a small problem, and I have a function that is typically meant only as a function belonging inside another function. >From the inner function I want to access a variable from the outer function like; def A(): some_var = 1 def B(): some_var += 1 B() But this does not work, the function B does not recognize the some_var. In my mind I thought the scope would propagate to the new function and the vars would still be accessible. How can I go about this? With regards - Jorgen Jorgen Bodde wrote: > Hi all, > > I wanted to solve a small problem, and I have a function that is > typically meant only as a function belonging inside another function. >>From the inner function I want to access a variable from the outer > function like; > > def A(): > some_var = 1 > def B(): > some_var += 1 > > B() > > > But this does not work, the function B does not recognize the > some_var. In my mind I thought the scope would propagate to the new > function and the vars would still be accessible. > > How can I go about this? The problem here is the way python determines which

IFN function
Will any one explain why am I getting the following note in the log: " Division by zero detected for the below variable 'D' ". My conception was, if the logical expression fails, then IFN function not supposed to evaluate the second argument. Data _null_; a=10; b=0; /* If B has -ve value; then there's no note in the log b=-5; */ c=ifn(a>0, 100/a, 0); d=ifn(b>0, 100/b, 0); put _all_ '='; Run; -- AkshayA! On 17 mar, 03:37, akshaya.nathil...@GMAIL.COM (Akshaya) wrote: > Will any one explain why am I getting the following note in the log: " > Division by zero detected for the below variable 'D' ". My conception was= , > if the logical expression fails, then IFN function not supposed to evalua= te > the second argument. > > Data _null_; > > =A0 =A0a=3D10; > > =A0 =A0b=3D0; /* If B has -ve value; then there's no note in the log =A0b= =3D-5; */ > > =A0 =A0c=3Difn(a>0, 100/a, 0); > > =A0 =A0d=3Difn(b>0, 100/b, 0); > > =A0 =A0put _all_ '=3D'; > > Run; > > -- > AkshayA! Hello, You can use the function DIVIDE. Xav

Function TXmlDocument()
Is there a way to extract status/progress information from the :Write method of this function. It takes a long time on large database with many fields and the program is blind. I would like to be able to present the user with some kind of progress or status indicator in my console app. Thanks, -- Robert

besseli function
hi, may i know how to use besseli(NU,Z) function for a FIR high pass filter using Kaiser Window? What value should i put for NU and Z ? What I have done so far is as follows: [N,wn,beta] = kaiserord([0.34 0.36]*pi,[1 0],[0.001 0.001],2*pi); W = kaiser(N,beta); I have to plot FIR filter response using Kaiser Window.

Undefined Function
I've written a custome function which I would like to use in a query. The function take the value of three fields and reports back a calculated result. This works fine, however, just recently it has been reporting as an Undefined Function when I try to run the query. Is there a way to explicitly force the function to be recognised?? As I said it was working fine, and now I am getting this new error. g Gargamil, Try the following: 1. Move the function into a module, 2. Declare the function explicitly as 'Public', 3. Recompile, 4. Repair and compact, 5. Test. Cheers, Mike Gargamil wrote: > I've written a custome function which I would like to use in a query. The > function take the value of three fields and reports back a calculated > result. This works fine, however, just recently it has been reporting as an > Undefined Function when I try to run the query. Is there a way to > explicitly force the function to be recognised?? As I said it was working > fine, and now I am getting this new error. > > g

Construct this function!
:numel(k1) count = count + 1; phi_11 = @(k2,k3) phi_11_new(k1,k2,k3,beta,i); phi_22 = @(k2,k3) phi_22_new(k1,k2,k3,beta,i); phi_33 = @(k2,k3) phi_33_new(k1,k2,k3,beta,i); F_11(count) = integral2(phi_11,-100,100,-100,100); F_22(count) = integral2(phi_22,-100,100,-100,100); F_33(count) = integral2(phi_33,-100,100,-100,100); end figure hold on plot(k1,F_11,'b') plot(k1,F_22,'cyan') plot(k1,F_33,'magenta') hold off where function phi_11 = phi_11_new(k1,k2,k3,beta,i) k = sqrt(k1(i).^2 + k2.^2 + k3.^2); k30 = k3 + beta(i).*k1(i); k0 = sqrt(k1(i).^2 + k2.^2 + k30.^2); E_k0 = 1.453.*k0.^4./((1 + k0.^2).^(17/6)); C1 = (beta(i).*k1(i).^2).*(k1(i).^2 + k2.^2 - k3.*k30)./(k.^2.*(k1(i).^2 + k2.^2)); C2 = k2.*k0.^2./((k1(i).^2 + k2.^2).^(3/2)).*atan2((beta(i).*k1(i).*sqrt(k1(i).^2 + k2.^2)),(k0.^2 - k30.*k1(i).*beta(i))); xhsi1 = C1 - k2./k1(i).*C2; xhsi1_q = xhsi1.^2; phi_11 = E_k0./(4.*pi.*k0.^4).*(k0.^2 - k1(i).^2 - 2.*k1(i).*k30.*xhsi1 + (k1(i).^2 + k2.^2).*xhsi1_q); end function phi_22 = phi_22_new(k1,k2,k3,beta,i) k = sqrt(k1(i).^2 + k2.^2 + k3.^2); k30 = k3 + beta(i).*k1(i); k0 = sqrt(k1(i).^2 + k2