obspy.core.util.misc.complexify_string

complexify_string(line)[source]

Converts a string in the form “(real, imag)” into a complex type.

Parameters:

line (str) – String in the form "(real, imag)".

Return type:

complex

Returns:

Complex number.

Example

>>> complexify_string("(1,2)")
(1+2j)
>>> complexify_string(" ( 1 , 2 ) ")
(1+2j)