| Environments | PYTHON :: EASI :: MODELER |
| Quick links | Description :: Parameters :: Parameter descriptions :: Return Value :: Details :: Example :: References :: Related |
| Back to top |
| Back to top |
randbit(file, dbib, dbob, density, dbsn, dbsd)
| Name | Type | Caption | Length | Value range |
|---|---|---|---|---|
| FILE * | str | Input file name | 1 - | |
| DBIB | List[int] | Input bitmap segment | 0 - | |
| DBOB | List[int] | Output bitmap segment | 0 - | |
| DENSITY * | List[float] | Random sampling density (%) | 1 - 1 | 0 - 100 |
| DBSN | str | Output bitmap segment name | 0 - | Default: RANDMASK |
| DBSD | str | Output bitmap segment description | 0 - |
| Back to top |
FILE
Specifies the name of the GDB-supported file containing input bitmaps, and to which the output bitmaps will be written.
DBIB
Specifies the image bitmaps to serve as sample masks for the output bitmaps.
Duplicate segments are allowed.
DBOB
Specifies the output bitmap to receive the sample results.
The output bitmap may be the same as the input bitmap; if this parameter is not specified, new bitmap segments are created.
Duplicate bitmap segments are NOT allowed.
DENSITY
Specifies the density, in percentage, at which to sample the output bitmap mask.
If set to 100 (percent), the output bitmap will be 1 (all pixels on) everywhere the input bitmap is 1 (or everywhere, if there is no input bitmap). If set to 50, approximately half the output bits will be 1.
DBSN
Specifies a name (up to 8 characters) for the output bitmap segment. If this parameter is not specified, the default name RANDMASK is used.
DBSD
Describes (in up to 64 characters) the contents or origins of the output neural network segment.
| Back to top |
Returns: Last Segments Created
Type: PCI_INT
| Back to top |
RANDBIT generates a mask to be used for random sampling. An output bitmap suitable for use with other "maskable" functions is generated, based on a specified sampling density (DENSITY) and an input bitmap mask (DBIB).
The input bitmap parameter (DBIB) specifies the input masks from which to compute a sub-sample space. If an input bitmap is not provided, the entire image space will be sampled.
| Back to top |
Generate a sub-sample of the "Water1" training mask from irvine.pix. This can then be used to generate a signature, and the resulting classification can be compared to that generated by the original training mask.
from pci.randbit import randbit file = r"/demo/irvine.pix" dbib = [9] dbob = [] density = [50] dbsn = "" dbsd = "" mask = randbit(file, dbib, dbob, density, dbsn, dbsd)
| Back to top |
Law & Kelton, "Simulation Modelling and Analysis", P449.
© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.