Scaling waves for long ranges on log axis plots

jjweimer
jjweimer's picture
Posts: 1325
Joined: 2007-08-14
Location: United States

I have just run in to a case where some clever trick may be needed.

I am trying to generate a theoretical curve that extends over nine orders of magnitude in x. Features of interest appear at 10^9, 10^13, and 10^16 in the scale. Using linear scales on the data waves, I loose resolution on features at the low end. I suspect that I have one of two options:

* Create an explicit x wave that is scaled logarithmically.
* Increase the number of data points in my scaled wave to recover the resolution at the lowest end.

Independently, I might wish for a new built-in feature to SetScale that would scale the x by logarithmic steps increments. Perhaps the x-scaling could even be designated by a function call (much as the TransformAxis package creates a new scaling axis).

SetScale/F=ScaleFunction x, ...
 
Function ScaleFunction(p) : SetScale Function
     variable p
 
     return log(p)
end

Is this idea worth any thought?

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH


HJDrescher
Posts: 349
Joined: 2015-01-20
Location: Germany

Maybe you could remodel your function/wave to do the exponential/logarithmic part inside and use a linear x-scale (and of course adjust the label accordingly). As a drawback, the automatic tick features will probably fail, to my experience.

I'd support the request for log wave scaling. However, I'm aware that this will cause a lot of trouble 'below the surface'.

HJ


Posts: 1936
Joined: 2007-06-29
Location: United States

You probably have already figured this out:

Make/N=(desiredPoints)/O/D xwave
SetScale/I x log(startx),log(endx),xwave
xwave = 10^x

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com


jjweimer
jjweimer's picture
Posts: 1325
Joined: 2007-08-14
Location: United States

In the meantime, I do an equivalent to below for the three functions.

Function calc_epdipole(ep0, tau, xx)
	variable ep0, tau, xx
 
	variable rtnv
 
	rtnv = ep0/((xx^2*tau^2) + 1)
 
	return rtnv
end
 
 
Function Update_Waves()
 
	wave xe, eprd
 
	variable ep0, tau, dep
 
	variable ynD
 
	// molecular (dipolar)
	ControlInfo/W=Inputs check_d
	ynD = v_value
	ControlInfo/W=Inputs slider_ep0
	ep0 = v_value
	ControlInfo/W=Inputs slider_tau
	tau = 10^(v_value)
 
	eprd = ynD*calc_epdipole(ep0, tau, xe[p])
 
...
end

The graph shows eprd vs xe (and others). I generated xe as xe = 10^(8 + p*(2e-4)) over 45001 points.

The inherent ability to set the scale on waves by a function would be cool.

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH

AttachmentSize
polarizationplot.png204.94 KB

[ last edited April 9, 2018 - 15:35 ]

Back to top