Module gwy :: Class Spectra
[hide private]
[frames] | no frames]

Class Spectra

source code

Collection of dataline representing point spectra.

Spectra contains an array of DataLines and coordinates representing where in a data field the spectrum was acquired.

Instance Methods [hide private]
 
__init__()
Creates a new Spectra object containing zero spectra.
source code
 
new_alike()
Creates a new Spectra object similar to an existing one, but containing zero spectra.
source code
 
data_changed()
Emits signal "data_changed" on a spectra object.
source code
 
get_si_unit_xy()
Gets SI unit used for the location co-ordinates of spectra.
source code
 
set_si_unit_xy(si_unit)
Sets the SI unit corresponding to the location co-ordinates of the spectra object.
source code
 
itoxy(i)
Gets the coordinates of one spectrum.
source code
 
xytoi(x, y)
Finds the index of the spectrum closest to the location specified by the coordinates x and y.
source code
 
setpos(i, x, y)
Sets the location coordinates of a spectrum.
source code
 
get_n_spectra()
Gets the number of spectra in a spectra object.
source code
 
get_spectrum(i)
Gets a dataline that contains the spectrum at index i.
source code
 
set_spectrum(i, new_spectrum)
Replaces the ith spectrum in the spectra object with a the supplied spectrum, new_spectrum.
source code
 
set_spectrum_selected(i, selected)
Sets selected state of a spectrum in a spectra object.
source code
 
get_spectrum_selected(i)
Gets the selected state of a spectrum in a spectra object.
source code
 
add_spectrum(new_spectrum, x, y)
Appends a new_spectrum to the spectra collection with a position of x, y.
source code
 
remove_spectrum(i)
Removes the ith spectrum from the Spectra collection.
source code
 
get_title()
Gets the title of spectra.
source code
 
set_title(title)
Sets the title of the spectra collection.
source code
 
get_spectrum_x_label()
Gets the spectrum abscissa label of a spectra object.
source code
 
set_spectrum_x_label(label)
Sets the spectrum abscissa label of a spectra object.
source code
 
get_spectrum_y_label()
Gets the spectrum ordinate label of a spectra object.
source code
 
set_spectrum_y_label(label)
Sets the spectrum ordinate label of a spectra object.
source code
 
clear()
Removes all spectra from the collection.
source code
 
find_nearest(x, y, n)
Gets the list of the indices to spectra ordered by their distance from a given point.
source code
 
duplicate()
Convenience macro doing gwy_serializable_duplicate() with all the necessary typecasting.
source code
Method Details [hide private]

__init__()
(Constructor)

source code 

Creates a new Spectra object containing zero spectra.

Returns:
A newly created spectra. (Spectra)

Since: 2.7

new_alike()

source code 

Creates a new Spectra object similar to an existing one, but containing zero spectra.

Use Spectra.duplicate() if you want to copy a spectra object including the spectra in it.

Returns:
A newly created Spectra object. (Spectra)

Since: 2.7

data_changed()

source code 

Emits signal "data_changed" on a spectra object.

Since: 2.7

get_si_unit_xy()

source code 

Gets SI unit used for the location co-ordinates of spectra.

Returns:
SI unit corresponding to the the location co-ordinates of spectra object. Its reference count is not incremented. (SIUnit)

Since: 2.7

set_si_unit_xy(si_unit)

source code 

Sets the SI unit corresponding to the location co-ordinates of the spectra object.

It does not assume a reference on si_unit, instead it adds its own reference.

Parameters:
  • si_unit - SI unit to be set. (SIUnit)

Since: 2.7

itoxy(i)

source code 

Gets the coordinates of one spectrum.

Parameters:
  • i - Index of a spectrum. (int)
Returns:
Tuple consisting of 2 values (x, y). ((float), (float))

Since: 2.7

xytoi(x, y)

source code 

Finds the index of the spectrum closest to the location specified by the coordinates x and y.

Parameters:
  • x - The x coordinate of the location of the spectrum. (float)
  • y - The y coordinate of the location of the spectrum. (float)
Returns:
The index of the nearest spectrum. If there are no curves in the spectra, -1 is returned. (int)

Since: 2.7

setpos(i, x, y)

source code 

Sets the location coordinates of a spectrum.

Parameters:
  • i - The index of a spectrum. (int)
  • x - The new x coordinate of the location of the spectrum. (float)
  • y - The new y coordinate of the location of the spectrum. (float)

Since: 2.7

get_n_spectra()

source code 

Gets the number of spectra in a spectra object.

Returns:
The number of spectra. (int)

Since: 2.7

get_spectrum(i)

source code 

Gets a dataline that contains the spectrum at index i.

Parameters:
  • i - Index of a spectrum (int)
Returns:
A DataLine containing the spectrum, owned by spectra. (DataLine)

Since: 2.7

set_spectrum(i, new_spectrum)

source code 

Replaces the ith spectrum in the spectra object with a the supplied spectrum, new_spectrum. It takes its own reference to the New_Spectrum dataline.

Parameters:
  • i - Index of a spectrum to replace (int)
  • new_spectrum - A DataLine Object containing the new spectrum. (DataLine)

Since: 2.7

set_spectrum_selected(i, selected)

source code 

Sets selected state of a spectrum in a spectra object.

Parameters:
  • i - Index of a spectrum. (int)
  • selected - True to make the spectrum selected, False to deselect it. (bool)

Since: 2.7

get_spectrum_selected(i)

source code 

Gets the selected state of a spectrum in a spectra object.

Parameters:
  • i - Index of a spectrum. (int)
Returns:
True if spectrum is selected. (bool)

Since: 2.7

add_spectrum(new_spectrum, x, y)

source code 

Appends a new_spectrum to the spectra collection with a position of x, y. Spectra.add takes a refference to the supplied spectrum.

Parameters:
  • new_spectrum - A DataLine containing the spectrum to append. (DataLine)
  • x - The physical x coordinate of the location of the spectrum. (float)
  • y - The physical y coordinate of the location of the spectrum. (float)

Since: 2.7

remove_spectrum(i)

source code 

Removes the ith spectrum from the Spectra collection. The subsequent spectra are moved down one place.

Parameters:
  • i - Index of spectrum to remove. (int)

Since: 2.7

get_title()

source code 

Gets the title of spectra.

Returns:
A pointer to the title string (owned by the spectra object). (string)

Since: 2.7

set_title(title)

source code 

Sets the title of the spectra collection.

Parameters:
  • title - The new title string. (string)

Since: 2.7

get_spectrum_x_label()

source code 

Gets the spectrum abscissa label of a spectra object.

Returns:
The abscissa label. The string is owned by spectra and must not be modified nor freed. (string)

Since: 2.40

set_spectrum_x_label(label)

source code 

Sets the spectrum abscissa label of a spectra object.

Parameters:
  • label - New abscissa label. (string)

Since: 2.40

get_spectrum_y_label()

source code 

Gets the spectrum ordinate label of a spectra object.

Returns:
The ordinate label. The string is owned by spectra and must not be modified nor freed. (string)

Since: 2.40

set_spectrum_y_label(label)

source code 

Sets the spectrum ordinate label of a spectra object.

Parameters:
  • label - New ordinate label. (string)

Since: 2.40

clear()

source code 

Removes all spectra from the collection.

Since: 2.7

find_nearest(x, y, n)

source code 

Gets the list of the indices to spectra ordered by their distance from a given point.

List positions

Parameters:
  • x - Point x-coordinate. (float)
  • y - Point y-coordinate. (float)
  • n - Number of indices to find. Array ilist must have at least this number of items. (int)
Returns:
(list)

Since: 2.7

duplicate()

source code 

Convenience macro doing gwy_serializable_duplicate() with all the necessary typecasting.

Returns:
(Spectra)

Since: 2.7