Hi, here I join a script that I use to generate
a png of a file with a given range.
I don't know why but you have to execute
it two times for the range to be the one you desire.
The first time it generate the png but with the initiale
scale, and when you just execute it a second time
it  actualises the range.


I usually combine it with a script that calculate the ground
and shift the image to put the groung to zero.
If you are interested i can give you this script to.


2010/6/25 David Necas (Yeti) <[email protected]>

> On Thu, Jun 24, 2010 at 11:34:26AM +0200, Timmel, Tobias wrote:
> > For example, how do I explicitly set the color range to an upper and
> > lower limit?
>
> By setting "/0/base/max" and/or "/0/base/min" in the container to the
> corresponding values (as floats) where 0 is the channel number.
> Generally, all information that presists (which includes the color
> ranges) is stored somewhere in the container.  Some useful container
> keys are described at
>
>    http://gwyddion.net/documentation/libgwymodule/ModuleTutorial.php
>
> but unfortunately not all.  Often the easiest method to find out about
> things that can appear there is to use gwydump on a .gwy file.
>
> > Is there a general documentation how to use all these functions
> > (for that I don't have to consult this list for every single function)?
>
> Well, the pygwy documentation leaves a lot to be wished so you might
> want to look up the corresponding C function which usually has the same
> arguments (except that you explicitly pass self, of course) and is
> better described.
>
> Regards,
>
> Yeti
>
>
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit.  See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> Gwyddion-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/gwyddion-users
>
import gwy
import time
import gwyutils

plugin_menu = "/Correct Data/ExtractPng"
plugin_type = "PROCESS"
plugin_desc= "test"



# get list of available containers
cons = gwy.gwy_app_data_browser_get_containers()


FirstSave = True


# iterate thru containers and datafields
for c in cons:
    # get directory of datafields where key is key in container
    dfields = gwyutils.get_data_fields_dir(c)
    filename = c.get_string_by_name("/filename")
    basename= filename[:-4]
    
    for key in dfields.keys():
        # get processed datafield object
        
        # retrieve datafield number in container from key (for example '/0/data')
        datafield = dfields[key]
        datafield_id = key.split('/')[1]
        namefield = gwy.gwy_app_get_data_field_title(c, int(datafield_id))
        
	#To select the field of interest of the 
	if namefield != "HeightRetrace":
            continue
	    
        
        #Minimum and maximum in meters
        
	mini = 1.*10**(-9) 
	maxi = 5*10**(-9)
	
		
        c.set_double_by_name("/%s/base/min" % datafield_id, mini ) 
        c.set_double_by_name("/%s/base/max" % datafield_id, maxi )
        c.set_int32_by_name("/%s/base/range-type" % datafield_id, 1 )
        # set palette of datafield
        c.set_string_by_name("/%s/base/palette" % datafield_id, "Gwyddion.net")
       
	
        datafield.data_changed()
 	
        # export datafield to png, for the first time show export dialog
        
	time.sleep(1)
        if FirstSave:
            gwyutils.save_dfield_to_png(c, key, basename + namefield+".png", gwy.RUN_INTERACTIVE)
            FirstSave = False
        else :
            gwyutils.save_dfield_to_png(c, key, basename + namefield+".png", gwy.RUN_NONINTERACTIVE)
        
        # request redraw datawindows with datafields
	#datafield.data_changed()
	
	datafield.data_changed()
	
        
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Gwyddion-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gwyddion-users

Reply via email to