GXSEMPLOT class

class GXSEMPLOT(handle=0)

GXSEMPLOT class.

Oasis montaj implementation of RTE GXSEMPLOT

classmethod apply_filter_to_mask(db, filter, mask_ch, mineral_ch, mineral, mode)

Apply the filter to the mask channel

Parameters:
  • db (GXDB) – Database handle
  • filter (str) – Filter name
  • mask_ch (str) – Mask channel name
  • mineral_ch (str) – Mineral channel name
  • mineral (str) – Mineral to use (“All” or “” for all)
  • mode (int) – Mask mode (0: Append, 1: New)

New in version 6.2.

License: Geosoft Extended End-User License

Note: The mask channel is updated for the current data to reflect the actions of the filter. Those values passing get 1, those failing get 0.

classmethod convert_dummies(db, line)

Convert dummies to zero values for assay channels.

Parameters:
  • db (GXDB) – Database handle
  • line (int) – Input line to convert

New in version 6.2.

License: Geosoft Extended End-User License

Note: The is operation is controlled by the Preferences “Use dummies to indicate no data?” By default, this option is “yes” so this function will return with no changes. However, if “no”, then all ASSAY class channels will have dummy values converted to 0.0.

classmethod create_ascii_template(name, temp)

: Generate ASCII import template automatically

Parameters:
  • name (str) – Data file name
  • temp (str) – Template to make
Returns:

1 if it succeeds in creating a Template. 0 if it fails.

Return type:

int

New in version 6.2.

License: Geosoft Extended End-User License

classmethod create_database_template(name, temp)

Generate database import template automatically

Parameters:
  • name (str) – Data file name
  • temp (str) – Template to make
Returns:

1 if it succeeds in creating a Template. 0 if it fails.

Return type:

int

New in version 6.2.

License: Geosoft Extended End-User License

classmethod create_groups(db, mask_ch)

Group data by anomaly or string channel - Interactive.

Parameters:
  • db (GXDB) – Database handle
  • mask_ch (str) – Mask channel

New in version 6.2.

License: Geosoft Extended End-User License

classmethod default_groups(db)

Group data by selected anomalies.

Parameters:db (GXDB) – Database handle

New in version 6.2.

License: Geosoft Extended End-User License

classmethod edit_filter(db, filter, mask_ch, mineral_ch, mineral)

Edit and create filter on channel values

Parameters:
  • db (GXDB) – Database handle
  • filter (str) – Name of filter
  • mask_ch (str) – Mask channel name
  • mineral_ch (str) – Mineral channel name
  • mineral (str) – Mineral to restrict filter to.
Returns:

-1 - Cancel - Edits to filter discarded.

0 - Normal Return. Edits saved to filter file.

1 - Apply filter to current data only

2 - Remove filter - If removing filtered data, just

restore the data to the Min/Pos data otherwise set the mask channel to 1.

Re-entry code. If not iDUMMY, what to do inside the filter after going back in. Returned on exit, used on next input.

0 - Nothing. Don’t need to go back into this function again. 1 - Edit the filter.

Notes New and edited filters are stored in useretc in files with

the file extension ”.semfilter” If a file for the specified filter does not exist, then a new filter by that name will be created.

Return type:

int

New in version 6.2.

License: Geosoft Extended End-User License

classmethod edit_map_plot_parameters(db, mask_ch, mineral_ch, map, view)

Alter parameters in an XYplot Triplot map.

Parameters:
  • db (GXDB) – Database handle
  • mask_ch (str) – Mask channel (can be “”)
  • mineral_ch (str) – Mineral channel (can be “” for raw data)
  • map (GXMAP) – Map handle
  • view (str) – Map View

New in version 6.2.

License: Geosoft Extended End-User License

Note: The Parameters GXGUI is loaded based on settings stored in the map. The map is then re-plotted, overwriting the old one, based on the new settings. Note that the selection of data in the current GXDB is used to replot the map.

classmethod edit_plot_components(db, template)

Set group names and channels to plot in a template.

Parameters:
  • db (GXDB) – Database handle
  • template (str) – Template name

New in version 6.2.

License: Geosoft Extended End-User License

Note: The “Components” group in the INI file is edited.

Looks first in useretc, then in etc. Looks first for file prefix “semtemplate” then “xyt” or “tri” The altered template will be output to the useretc directory with the file extension “semtemplate”.

classmethod edit_plot_parameters(db, template)

Set TriPlot parameters in a template.

Parameters:
  • db (GXDB) – Database handle
  • template (str) – Template name

New in version 6.2.

License: Geosoft Extended End-User License

Note: The “Parameters” group in the INI file is edited.

Looks first in useretc, then in etc. Looks first for file prefix “semtemplate” then “xyt” or “tri” The altered template will be output to the useretc directory with the file extension “semtemplate”.

classmethod export_overlay(overlay, map, mview, group, plot_type, x_stage, x_oxide, y_stage, y_oxide, z_stage, z_oxide, extension)

Create overlay map and file from a group.

Parameters:
  • overlay (str) – Overlay file name
  • map (str) – Associated map
  • mview (GXMVIEW) – View with group
  • group (str) – Group name
  • plot_type (int) – SEMPLOT_PLOT constants
  • x_stage (str) – XStage
  • x_oxide (str) – XOxide
  • y_stage (str) – YStage
  • y_oxide (str) – YOxide
  • z_stage (str) – ZStage
  • z_oxide (str) – ZOxide
  • extension (int) – SEMPLOT_EXT constants

New in version 6.2.

License: Geosoft Extended End-User License

Note: The group is written to a new map, and an overlay file is created which points to this map.

classmethod export_view(db, lst, new_db, view, mask_ch, mineral_ch, mineral)

Create a “View” database

Parameters:
  • db (GXDB) – Original raw data database
  • lst (GXLST) – List of lines (anomlies) to export
  • new_db (GXDB) – Destination database
  • view (int) – View to export - One of SEMPLOT_XXX_STAGE
  • mask_ch (str) – Mask channel (“” for None)
  • mineral_ch (str) – Mineral channel
  • mineral (str) – Mineral to export (“” for all)

New in version 6.2.

License: Geosoft Extended End-User License

classmethod export_view2(db, lst, new_db, view, mask_ch, mineral_ch, mineral, export)

Create a “View” database, with channel selection

Parameters:
  • db (GXDB) – Original raw data database
  • lst (GXLST) – List of lines (anomlies) to export
  • new_db (GXDB) – Destination database
  • view (int) – View to export - One of SEMPLOT_XXX_STAGE
  • mask_ch (str) – Mask channel (“” for None)
  • mineral_ch (str) – Mineral channel
  • mineral (str) – Mineral to export (“” for all)
  • export (int) – SEMPLOT_EXPORT constants Channel selection

New in version 7.1.

License: Geosoft Extended End-User License

classmethod filter_lst(lst)

Fill a GXLST with existing GXSEMPLOT filters

Parameters:lst (GXLST) – GXLST to fill.

New in version 6.2.

License: Geosoft Extended End-User License

Note: “Supplied” filters are stored in etc, while user-edited and new filters are stored in useretc. This function finds all files with the extension ”.semfilter”, first in useretc, then in etc, and adds the file names (without the extension) to the GXLST. The name with the extension is stored as the value. The GXLST is cleared first.

classmethod filter_mineral_pos_data(db, mask_ch, mineral_ch, mineral, pos)

Filter raw data by position and mineral values

Parameters:
  • db (GXDB) – Database handle
  • mask_ch (str) – Mask channel
  • mineral_ch (str) – Mineral channel
  • mineral (str) – Mineral (string) - “C”, “I” etc.
  • pos (int) – Grain position

New in version 6.2.

License: Geosoft Extended End-User License

Note: The Mask channel will be updated so that those data values which “pass” get “1” and those that “fail” get dummy “*” NO DATA IS REMOVED. Works on all selected lines of data.

classmethod get_associated_lst(db, group, lst)

Get the associated channels for this group in a GXLST

Parameters:
  • db (GXDB) – Database handle
  • group (int) – Data Group handle
  • lst (GXLST) – GXLST to copy channels into

New in version 6.2.

License: Geosoft Extended End-User License

classmethod get_current_mineral_lst(db, mineral_ch, lst)

Retrieve GXLST of minerals in selected lines.

Parameters:
  • db (GXDB) – Database handle
  • mineral_ch (str) – Mineral channel name
  • lst (GXLST) – GXLST object

New in version 6.2.

License: Geosoft Extended End-User License

Note: If the mineral channel name is not specified, it returns just the “X” (Unknown) item.

classmethod get_current_position_lst(db, lst)

Retrieve GXLST of positions in selected lines.

Parameters:

New in version 6.2.

License: Geosoft Extended End-User License

classmethod get_full_mineral_lst(lst)

Retrieve GXLST of all minerals in Semplot_Minerals.csv

Parameters:lst (GXLST) – GXLST object

New in version 6.2.

License: Geosoft Extended End-User License

classmethod get_full_position_lst(lst)

Retrieve GXLST of all possible mineral positions.

Parameters:lst (GXLST) – GXLST object

New in version 6.2.

License: Geosoft Extended End-User License

classmethod get_grouping_lst(db, lst)

Get list of items to group symbols by.

Parameters:
  • db (GXDB) – Database handle
  • lst (GXLST) – List to hold items

New in version 6.2.

License: Geosoft Extended End-User License

Note: The first item is “Anomaly”, which gives the line names, The second item (if the channel exists in the database) is the Sample Number. After this are included all string channels which are NOT oxides or elements. (The list can include the mineral). Channel symbol is the GXLST value (except for the first item - “Anomaly”)

classmethod get_mineral_channel_name(db, mineral_ch)

Retrieve the mineral channel name.

Parameters:
  • db (GXDB) – Database handle
  • mineral_ch (str_ref) – Mineral channel name

New in version 6.3.

License: Geosoft Extended End-User License

Note: First looks at the GXSEMPLOT.MINERAL_CHANNEL value. If not found, returns the first MINERAL class channel found. If still not found, returns a blank string.

classmethod import_ascii_wizard(name, temp, anomaly)

Generate a GXSEMPLOT ASCII import template.

Parameters:
  • name (str) – Data file name
  • temp (str) – Template to make
  • anomaly (str_ref) – Anomaly name (can be “”)

New in version 6.3.

License: Geosoft Extended End-User License

Note: If the anomaly name is not included, then the input data must have an “Anom_Name” field.

classmethod import_bin(db, data, template, line, flight, date)

Import blocked binary or archive ASCII data

Parameters:
  • db (GXDB) – Database
  • data (str) – Import data file name
  • template (str) – Import template name
  • line (str) – Optional Line name (see note 3.)
  • flight (int) – Optional Flight number
  • date (float) – Optional date

New in version 6.2.

License: Geosoft Extended End-User License

Note: This wrapper is for GXSEMPLOT, and does not require the import licence.

  1. Binary import templates have extension .I2 by convention. See BINARY.I2 for a description of the template format. Archive import templates have extension .I3 by convention. See ARCHIVE.I3 for a description of the template format.
  2. Both the import template and data file must exist.
  3. If a line already exists in the database, a new version is created unless a line name is passed in. In this case, the specified name is used and the imported channels on the previous line will be destroyed.

See also

GXDU.lab_template in du.gxh

classmethod import_database_ado(name, temp)

Generate a template file for importing semplot databases.

Parameters:
  • name (str) – Data file name
  • temp (str) – Template to make

New in version 6.2.

License: Geosoft Extended End-User License

classmethod import_database_odbc(connection, temp)

Generate a template file for importing ODBC databases.

Parameters:
  • connection (str_ref) – Connection string (input and returned)
  • temp (str_ref) – Template file (returned)

New in version 6.2.

License: Geosoft Extended End-User License

classmethod init_group_symbols_used(db)

Initializes memory of symbols used in plotting.

Parameters:db (GXDB) – Database handle

New in version 6.2.

License: Geosoft Extended End-User License

Note: Maintains a list of the symbols used in plotting. Call before Plotting one or more legends - symbols are accumulated. plot_symbol_legend uses this information to create a legend.

is_null()

Check if this is a null (undefined) instance

Returns:True if this is a null (undefined) instance, False otherwise.
Return type:bool
classmethod mineral_id(db, resid, min_ch, res_ch)

Identify minerals from the oxide channels.

Parameters:
  • db (GXDB) – Database
  • resid (float) – Maximum residual value (in % of the total oxide)
  • min_ch (int) – Mineral channel (Locked RW)
  • res_ch (int) – Residual channel (Locked RW)

New in version 6.3.

License: Geosoft Extended End-User License

Note: Finds the best mineral matching the composition for each row of oxide values. Works using linear programming and the simplex method to maximize the oxides used to create each of the possible output minerals. The mineral leaving the least leftover is selected, as long as the residual (measured as a percent of the total) is less than or equal to the input value.

classmethod new_filter(filter, model)

Create a new selection filter.

Parameters:
  • filter (str) – New filter name
  • model (str) – Filter to use as a model (can be “”)

New in version 6.2.

License: Geosoft Extended End-User License

Note: Creates a new, empty filter file in the useretc directory

classmethod new_template(template, type, model)

Create a new XYPlot or TriPlot template.

Parameters:
  • template (str) – New template name
  • type (int) – Unknown
  • model (str) – Template to use as a model (can be “”)

New in version 6.2.

License: Geosoft Extended End-User License

Note: The new template is written to the useretc directory, with the file extension “semfilter”. The template contains a parameter identifying it as an XY or Triplot.

Model Template: Looks first in useretc, then in etc. Looks first for file prefix “semtemplate” then “xyt” or “tri”

Because there are so many shared parameters, it is possible to use an XYPlot template as a model for a TriPlot, and vica-verca, with few complications. (e.g. needing to define a “Z” component)

classmethod null()

A null (undefined) instance of GXSEMPLOT

Returns:A null GXSEMPLOT
Return type:GXSEMPLOT
classmethod overlay_lst(lst, extension, type)

Fill a list with the available plot overlay names

Parameters:

New in version 6.2.

License: Geosoft Extended End-User License

Note: Looks first in useretc, then in etc. See SEMPLOT_EXT constants definitions above for which files to look for.

classmethod plot(db, template, mask_ch, mineral_ch, map, map_mode, plot_symb)

Plot an XYPlot or TriPlot based on the template.

Parameters:
  • db (GXDB) – Database handle
  • template (str) – Template file name
  • mask_ch (str) – Mask channel (can be “”)
  • mineral_ch (str) – Mineral channel (can be “” for raw data)
  • map (str) – Map name
  • map_mode (int) – Map open mode; one of MAP_WRITEXXX (see map.gxh)
  • plot_symb (int) – Plot symbols (O: No, 1:Yes) ?

New in version 6.2.

License: Geosoft Extended End-User License

Note: The “Components” and “Parameters” groups in the INI file are used. Only values with mask values of 1 are plotted, if the mask channel is specified.

Call “reset_used_channel” prior to this function in order to track the values actually plotted.

Call init_group_symbols_used prior to this function to reset recording of the symbols used in plotting (for legends etc).

classmethod plot_symbol_legend(db, mview, x_min, y_min, y_max, symb_size)

Plot a symbol legend in a view.

Parameters:
  • db (GXDB) – Database handle
  • mview (GXMVIEW) – View to plot into
  • x_min (float) – X Minimum
  • y_min (float) – Y Minimum
  • y_max (float) – Y Maximum
  • symb_size (float) – Symbol size

New in version 6.2.

License: Geosoft Extended End-User License

Note: This function depends on init_group_symbols_used before the plot for which this legend is created is made. The symbols and groups to use in the legend are stored to a database blob after the plot is made. These values are recovered by this function to make the legend at the specified location.

classmethod prop_symb(db, map, view, chan, mask_ch, mineral_ch, log, area, base, scale, symb, wt, line_col, fill_col, legend)

Plot a proportional symbol plot.

Parameters:
  • db (GXDB) – Database handle
  • map (GXMAP) – Map to plot to
  • view (str) – View to replot
  • chan (str) – Channel name
  • mask_ch (str) – Mask channel (can be “”)
  • mineral_ch (str) – Mineral channel (
  • log (int) – Linear (0) or logarithmic (1) scaling
  • area (int) – Scale by diameter (0) or area (1)
  • base (float) – Scale base (log) data units
  • scale (float) – Scale factor (log) data units/mm
  • symb (int) – Symbol number
  • wt (int) – Symbol weight
  • line_col (int) – Symbol line color
  • fill_col (int) – Symbol fill color
  • legend (int) – Plot legend?

New in version 6.2.

License: Geosoft Extended End-User License

Note: Replots map using proportional symbols

classmethod re_plot_symbol_legend(db, mview)

Replot a symbol legend in a view.

Parameters:
  • db (GXDB) – Database handle
  • mview (GXMVIEW) – View to plot into

New in version 6.2.

License: Geosoft Extended End-User License

Note: Searches the VIEW GXREG for information on a previously created legend, and if it finds that info, replots the Legend, using the current data, group key etc.

classmethod replot(db, mask_ch, mineral_ch, map, view)

Replot an existing GXSEMPLOT plot based on current data.

Parameters:
  • db (GXDB) – Database handle
  • mask_ch (str) – Mask channel (can be “”)
  • mineral_ch (str) – Mineral channel (can be “” for raw data)
  • map (GXMAP) – Map handle
  • view (str) – Map View containing the plot

New in version 6.2.

License: Geosoft Extended End-User License

Note: Note that the selection of data in the current GXDB is used to replot the map.

Call “reset_used_channel” prior to this function in order to track the values actually plotted.

Call init_group_symbols_used prior to this function to reset recording of the symbols used in plotting (for legends etc).

classmethod reset_groups(db, mask_ch)

Re-group data using current settings.

Parameters:
  • db (GXDB) – Database handle
  • mask_ch (str) – Mask channel

New in version 6.2.

License: Geosoft Extended End-User License

classmethod reset_used_channel(db)

Set the “Plotted” channel to dummies

Parameters:db (GXDB) – Database handle

New in version 6.2.

License: Geosoft Extended End-User License

Note: This function is called before one or a series of plots to initialize the “Plotted” channel in all the selected lines to dummy values. As the plots are created, those points used in the plot are set to 1, so that at the end the database records which values have been plotted. This information can then be used to make a symbol legend. If the “Plotted” channel does not exist, it is created, associated, loaded, and filled with dummies.

classmethod select_poly(db, mview, mask_ch, mineral_ch, pply, mode)

Select data from a polygonal area on a map.

Parameters:
  • db (GXDB) – Database handle
  • mview (GXMVIEW) – View Handle
  • mask_ch (str) – Mask channel to update
  • mineral_ch (str) – Mineral channel
  • pply (GXPLY) – Polygon to select from, in the view coordinates.
  • mode (int) – Mask mode (0: Append, 1: New)

New in version 6.2.

License: Geosoft Extended End-User License

classmethod set_channel_order(db, lst)

Sets preset channel order.

Parameters:
  • db (GXDB) – Database handle
  • lst (GXLST) – Channel names, handles

New in version 6.2.

License: Geosoft Extended End-User License

Note: Sets channel order as follows:

Sample_No X and Y Locations Mineral Grain_No Position (e.g. center, edge etc.) Grain Morph Oxides (in the order they appear in Semplot_Oxides.csv) Trace Elements (Ordered as in the periodic table) Total Mask IsPlotted (flag set when a value is plotted) Other channels

Channel order is set for all “RawData” groups.

classmethod set_channel_units(db)

Set units for oxides (%) and elements (ppm)

Parameters:db (GXDB) – Database handle

New in version 6.2.

License: Geosoft Extended End-User License

Note: If the channel units are already set, then they are not changed. Oxide channels are identified from the Semplot_Oxides.csv file. Trace elements are identified from the periodic table of the elements, except for “Y”, if it is the current Y channel.

classmethod set_itr(db, ch, itr)

Put GXITR into a channel.

Parameters:
  • db (GXDB) – Database handle
  • ch (int) – Data channel handle

New in version 6.2.

License: Geosoft Extended End-User License

classmethod set_mask(db, mask_ch, mineral_ch, mineral, selected, val)

Set the mask channel ON or OFF.

Parameters:
  • db (GXDB) – Database handle
  • mask_ch (str) – Mask channel
  • mineral_ch (str) – Mineral channel
  • mineral (str) – Mineral to use (“All” or “” for all)
  • selected (int) – 0 for all lines, 1 for selected lines
  • val (int) – 0 for off, 1 for on.

New in version 6.2.

License: Geosoft Extended End-User License

classmethod sort_data(db, group, anomaly)

Sort data by Sample No, Grain and Position

Parameters:
  • db (GXDB) – Database handle
  • group (int) – Data Group handle
  • anomaly (int) – Use Anomaly channel as primary sort?

New in version 6.2.

License: Geosoft Extended End-User License

classmethod template_lst(lst, type)

Fill a list with the available plot template names

Parameters:

New in version 6.2.

License: Geosoft Extended End-User License

Note: Looks first in useretc, then in etc. Looks first for file prefix “semtemplate” then “xyt” or “tri” (New-style templates with the “semtemplate” extentsion have the plot type “triplot” or “xyplot” inside them.)

classmethod template_type(template)

Create a new XYPlot or TriPlot template.

Parameters:template (str) – Template name
Returns:SEMPLOT_PLOT_XYPLOT or SEMPLOT_PLOT_TRIPLOT Terminates if error.
Return type:int

New in version 6.2.

License: Geosoft Extended End-User License

classmethod tile_windows()

Tile currently maximimized windows.

New in version 6.2.

License: Geosoft Extended End-User License

classmethod total_oxides(db, mineral_ch)

Calculate the total oxides channel.

Parameters:
  • db (GXDB) – Database handle
  • mineral_ch (str) – Mineral channel

New in version 6.2.

License: Geosoft Extended End-User License

Note: The mineral channel is needed in order to adjust the total with the Fe Corrected Ferric and Ferrous values, and these require a mineral for their identification. If none is provided, mineral “X” (unknown) is assumed.

classmethod view_type(map, view)

Test to see if a view is an XYPlot or Triplot view.

Parameters:
  • map (GXMAP) – Input map object
  • view (str) – Input view name
Returns:

SEMPLOT_PLOT constants

Return type:

int

New in version 6.4.2.

License: Geosoft Extended End-User License

Note: First checks the view name to see if it starts with "XYplt_" or "Triplt_". Failing that it looks in the view GXREG for a value for “Components.Type”, which will be either “XYPlot” or “TriPlot”. If the view does not appear to be an XYPlot or a TriPlot view, the function returns SEMPLOT_PLOT_UNKNOWN.

SEMPLOT_GROUP_CLASS constants

GXSEMPLOT group class.

SEMPLOT_GROUP_CLASS

Semplot group class

gxapi.SEMPLOT_GROUP_CLASS = 'Semplot'

SEMPLOT_EXPORT constants

GXSEMPLOT export type selection.

SEMPLOT_EXPORT_NORMAL

Exports Sample info channels, oxides/ratios, totals, extra channels.

gxapi.SEMPLOT_EXPORT_NORMAL = 0
SEMPLOT_EXPORT_NOEXTRA

Exports Sample info, oxides/ratios, totals.

gxapi.SEMPLOT_EXPORT_NOEXTRA = 1

SEMPLOT_EXT constants

GXSEMPLOT file extension selection

SEMPLOT_EXT_ALL

Use for selection only. Selects both “Semplot” and “GXCHIMERA” type files when creating LSTs etc.

gxapi.SEMPLOT_EXT_ALL = 0
SEMPLOT_EXT_SEMPLOT

Read/write templates with extensions ”.xyt”, ”.tri” and ”.semtemplate” Read/write overlays with extensions ”.oly” and ”.semoverlay”

gxapi.SEMPLOT_EXT_SEMPLOT = 1
SEMPLOT_EXT_CHIMERA

Read/write templates with extensions ”.geosoft_template” Read/write overlays with extensions ”.geosoft_overlay”

gxapi.SEMPLOT_EXT_CHIMERA = 2

SEMPLOT_PLOT constants

GXSEMPLOT plot type selection.

SEMPLOT_PLOT_ALL

Use for selection only. Selects both “XYPlot” and “TriPlot” plots when creating LSTs etc.

gxapi.SEMPLOT_PLOT_ALL = 0
SEMPLOT_PLOT_XYPLOT

Select XY (Scatter) plot.

gxapi.SEMPLOT_PLOT_XYPLOT = 1
SEMPLOT_PLOT_TRIPLOT

Select Tri (Triangular) plot.

gxapi.SEMPLOT_PLOT_TRIPLOT = 2
SEMPLOT_PLOT_UNKNOWN

Returned as an error status from some functions.

gxapi.SEMPLOT_PLOT_UNKNOWN = 3