RANFRAC

Evaluate a random fraction map


EnvironmentsPYTHON :: EASI
Quick linksDescription :: Parameters :: Parameter descriptions :: Details :: Examples :: Acknowledgements :: Related

Back to top

Description


Evaluates a set of 32R channels to be a random fraction vector map. Each channel of the map corresponds to a fraction vector element. On a pixel-by-pixel basis, the sum of the channels will be 1. The fraction of 1 in each channel of the map at each pixel location is pseudorandomly generated. RANFRAC deletes pre-existing image metadata from input file.
Back to top

Parameters


ranfrac(file, dboc)

Name Type Caption Length Value range
FILE * str Input file name 1 -    
DBOC * List[int] Output raster channel(s) 1 -    

* Required parameter
Back to top

Parameter descriptions

FILE

Specifies the name of the existing file to receive the fraction map.

DBOC

Specifies the output channels in the input file to comprise the fraction vector map. The channels must all be of type 32R.

Back to top

Details

The specified output channels are evaluated to a fraction vector map. Denote the computed N-dimensional output channel band vector at pixel location p by frac_p (fraction vector p). Pixel p in the ith specified output channel is given the value of the ith element of frac_p.

The fraction vectors are pseudorandomly generated. The elements of each fraction vector are non-negative, and sum to 1.

Back to top

Examples

This example illustrates the verification of the correctness of ENDMEMB.

Create an image file to contain a 3-channel random fraction vector map and a 224 channel synthetic image:

from pci.cim import cim

file	=	"synth.pix"
dbsz	=	[100, 100]
pxsz	=	[1, 1]
dbnc	=	[0,0,0,227]
dblayout	=	"pixel"
tex1    =       ""
tex2    =       ""

cim( file, tex1, tex2, dbsz, pxsz, dbnc, dblayout )

Evaluate channels 225, 226, 227 to a random fraction vector map:

from pci.ranfrac import ranfrac

file	=	'synth.pix'
dboc = [225, 226, 227]

ranfrac( file, dboc )

Evaluate channels 1 to 224 to a synthetic image. The three input endmember spectra may be extracted from cuprad.pix using the Focus spectra plotting window. Here, the endmember spectra are stored USGS format file "in.spl":

from pci.spmix import spmix

file	=	'synth.pix'
specfile	= 'in.spl'
dbic	=	[225,226,227]
dboc = [1, -224]

spmix( file, specfile, dbic, dboc )

Use ENDMEMB to compute endmembers for the synthetic image and write them out USGS-format spectra file "out.spl" :

from pci.endmemb import endmemb

file	=	'synth.pix'
dbic	=	dboc
wlenint	=        []
valonly	=        ""
dbiw	=        []
dbib	=        []
nendmemb	=	[3]
errsetsz	=	[10]
bvanglthr	=	[5]
specfilo	=	'out.spl'
filotype	=	'spl'
rtlevel	=	[0]

endmemb( file, dbic, wlenint, valonly, dbiw, dbib, nendmemb, errsetsz, bvanglthr, specfilo, filotype, rtlevel )
Back to top

Acknowledgements

PCI Geomatics received financial support from the Canadian Space Agency/L'Agence Spatiale Canadienne through the Earth Observation Application Development Program (EOADP) for the development of this software, under contract 9F028-0-4902/12.

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.