GXNASVD class

class GXNASVD(handle=0)[source]

GXNASVD class.

The GXNASVD class provides functionality for Noise-Adjusted Singular Value Decomposition (NASVD) analysis of spectral data. This class wraps the GamMontaj library functions for performing Hovgaard-normalized SVD analysis and spectral reconstruction.

The database (GXDB) provided to the NASVD class is cached and used for later reconstruction, so the database must remain valid for the lifetime of the NASVD object.

__init__(handle=0)[source]
classmethod create(db, channel, mask_channel, num_components, start, end)[source]

Create an NASVD object and perform SVD analysis

Parameters:
  • db (GXDB) – GXDB Object

  • channel (str) – Spectral data channel name

  • mask_channel (str) – mask_channel name (optional)

  • num_components (int) – Number of eigenvectors to calculate (1 to min(M,N))

  • start (int) – Inclusive starting index of the spectral data, ranging from (1, numChannels). Provide 1 or GS_S4DM to use the beginning of the spectrum.

  • end (int) – Inclusive ending index of the spectral data, ranging from (1, numChannels). Provide numChannels or GS_S4DM to use the end of the spectrum.

Returns:

NASVD Object

Return type:

GXNASVD

New in version 2025.2.

License: Geosoft End-User License

Note: Creates an NASVD object and performs the initial Hovgaard-normalized SVD analysis on the specified spectral channel data. The analysis extracts eigenvectors, scores, and singular values that can be used for spectral reconstruction and noise reduction.

The input data is automatically normalized using the Hovgaard method before SVD. Results are stored internally in the NASVD object for later reconstruction use, including a line list of all lines that were used to calculate the eigenvectors. Subsequent spectra reconstruction will apply to the original list of lines used to create the NASVD object.

It is common in radiometrics processing to exclude certain channels from smoothing operations. To facilitate this, ‘start’ and ‘end’ are provided as inclusive 1-based indices to define the range of spectral data to be used in the analysis. Use 1 or GS_S4DM for ‘start’ to indicate the beginning of the spectrum, and use GS_S4DM for ‘end’ to indicate the end of the spectrum.

The optional mask channel allows the pre-selection of rows to include in the analysis. A dummy value in the mask channel indicates points not included. Valid data points should be indicated with “1”.

classmethod deserialize(output_directory)[source]

Create an NASVD object and perform SVD analysis

Parameters:

output_directory (str) – The output directory containing the serialized files. The directory must exist and contain allrequired files, including eigenvectors, singular values, and scores.

Returns:

NASVD Object

Return type:

GXNASVD

New in version 2025.2.

License: Geosoft End-User License

Note:

get_cumulative_eigenvector_contribution(vv)[source]

Calculate the variance explained by each component

Parameters:

vv (GXVV) – VV to receive cumulative eigenvector contribution percentages

New in version 2025.2.

License: Geosoft End-User License

Note: Calculates cumulative eigenvector contribution percentages for each component based on their singular values. This helps determine how many components are needed to achieve a desired level of accuracy in the reconstruction.

get_eigen_vector(component, vv)[source]

Get eigenvector data for a specific component

Parameters:
  • component (int) – Component index (0-based)

  • vv (GXVV) – VV to receive eigenvector data

New in version 2025.2.

License: Geosoft End-User License

Note: Retrieves the eigenvector data for the specified component index. The eigenvector represents the spectral pattern for that component.

classmethod get_maximum_element_count(maximum)[source]

Get the maximum number of elements that can be processed by NASVD

Parameters:

maximum (int_ref) – Maximum number of elements (rows * columns) that can be processed by NASVD

New in version 2025.2.

License: Geosoft End-User License

Note: Returns the maximum number of elements that can be processed by the NASVD algorithm to avoid memory allocation failures. This value is stored as an advanced setting in Oasis montaj.

get_num_components()[source]

Get the number of components calculated during SVD analysis

Returns:

Number of components available

Return type:

int

New in version 2025.2.

License: Geosoft End-User License

get_partition_details(head, tail, total)[source]

Get the number of pass-through (head and tail) channels, and the total number of channels (head + data + tail).

Parameters:
  • head (int_ref) – (out) Number of head pass-through channels.

  • tail (int_ref) – (out) Number of tail pass-through channels.

  • total (int_ref) – (out) Total number of channels, including (head + data + tail).

New in version 2025.2.

License: Geosoft End-User License

Note: Retrieves the partition details for the specified NASVD object. This includes the number of pass-through channels (head and tail) and the total number of channels.

get_scores(component, vv)[source]

Get score data for a specific component

Parameters:
  • component (int) – Component index (0-based)

  • vv (GXVV) – VV to receive score data

New in version 2025.2.

License: Geosoft End-User License

Note: Retrieves the score data for the specified component index. Scores represent the strength of each component at each spatial location.

get_singular_value(component)[source]

Get a specific singular value

Parameters:

component (int) – Component index (0-based)

Returns:

The singular value

Return type:

float

New in version 2025.2.

License: Geosoft End-User License

is_null()[source]

Check if this is a null (undefined) instance

Returns:

True if this is a null (undefined) instance, False otherwise.

Return type:

bool

classmethod null()[source]

A null (undefined) instance of GXNASVD

Returns:

A null GXNASVD

Return type:

GXNASVD

reconstruct_spectrum(db, num_components_to_use, output_channel)[source]

Reconstruct spectral data using selected components

Parameters:
  • db (GXDB) – GXDB Object

  • num_components_to_use (int) – Number of leading components to use for reconstruction

  • output_channel (str) – Output channel name for reconstructed spectral data

New in version 2025.2.

License: Geosoft End-User License

Note: Performs spectral reconstruction using only the first N eigenvectors/components. This effectively filters the data by removing noise associated with higher-order components while preserving the signal in the dominant components.

The reconstructed data is written to the specified output channel on all lines used to create the NASVD object originally (see NASVD::Create, for more details).

serialize(output_directory)[source]

Serialize the NASVD object

Parameters:

output_directory (str) – The output directory to place the serialized files. A new directory will be created if it does not exist. Any existing files in the directory will be overwritten.

New in version 2025.2.

License: Geosoft End-User License

Note: Serializes the NASVD object to a format suitable for storage or transmission.