qcodes/dataset/plotting.py
def _convert_complex_to_real(
    parameter: DSPlotData, conversion: str, degrees: bool
) -> Tuple[DSPlotData, DSPlotData]:
    """
    Do the actual conversion and turn one parameter into two.
    Should only be called from within _complex_to_real_preparser.
    """

    phase_unit = 'deg' if degrees else 'rad'

    converters = {
        'data': {'real_and_imag': lambda x: (np.real(x), np.imag(x)),
                 'mag_and_phase': lambda x: (np.abs(x),
                                             np.angle(x, deg=degrees))},
        'labels': {'real_and_imag': lambda l: (l + ' [real]', l + ' [imag]'),
                   'mag_and_phase': lambda l: (l + ' [mag]', l + ' [phase]')},
        'units': {'real_and_imag': lambda u: (u, u),
                  'mag_and_phase': lambda u: (u, phase_unit)},
        'names': {'real_and_imag': lambda n: (n + '_real', n + '_imag'),
                  'mag_and_phase': lambda n: (n + '_mag', n + '_phase')}}

    new_data = converters['data'][conversion](parameter['data'])
    new_labels = converters['labels'][conversion](parameter['label'])
    new_units = converters['units'][conversion](parameter['unit'])
    new_names = converters['names'][conversion](parameter['name'])

    parameter1: DSPlotData = {
        "name": new_names[0],
        "label": new_labels[0],
        "unit": new_units[0],
        "data": new_data[0],
        "shape": parameter["shape"],
    }

    parameter2: DSPlotData = {
        "name": new_names[1],
        "label": new_labels[1],
        "unit": new_units[1],
        "data": new_data[1],
        "shape": parameter["shape"],
    }

    return parameter1, parameter2

    Do the actual conversion and turn one parameter into two.
    Should only be called from within _complex_to_real_preparser.
    
Do the actual conversion and turn one parameter into two.
Should only be called from within _complex_to_real_preparser.
Do the actual conversion and turn one parameter into two . Should only be called from within _complex_to_real_preparser .
def _convert_complex_to_real(
    parameter: DSPlotData, conversion: str, degrees: bool
) -> Tuple[DSPlotData, DSPlotData]:
    phase_unit = 'deg' if degrees else 'rad'
    converters = {
        'data': {'real_and_imag': lambda x: (np.real(x), np.imag(x)),
                 'mag_and_phase': lambda x: (np.abs(x),
                                             np.angle(x, deg=degrees))},
        'labels': {'real_and_imag': lambda l: (l + ' [real]', l + ' [imag]'),
                   'mag_and_phase': lambda l: (l + ' [mag]', l + ' [phase]')},
        'units': {'real_and_imag': lambda u: (u, u),
                  'mag_and_phase': lambda u: (u, phase_unit)},
        'names': {'real_and_imag': lambda n: (n + '_real', n + '_imag'),
                  'mag_and_phase': lambda n: (n + '_mag', n + '_phase')}}
    new_data = converters['data'][conversion](parameter['data'])
    new_labels = converters['labels'][conversion](parameter['label'])
    new_units = converters['units'][conversion](parameter['unit'])
    new_names = converters['names'][conversion](parameter['name'])
    parameter1: DSPlotData = {
        "name": new_names[0],
        "label": new_labels[0],
        "unit": new_units[0],
        "data": new_data[0],
        "shape": parameter["shape"],
    }
    parameter2: DSPlotData = {
        "name": new_names[1],
        "label": new_labels[1],
        "unit": new_units[1],
        "data": new_data[1],
        "shape": parameter["shape"],
    }
    return parameter1, parameter2
def _convert_complex_to_real ( parameter : DSPlotData , conversion : str , degrees : bool ) -> Tuple [ DSPlotData , DSPlotData ] : phase_unit = 'deg' if degrees else 'rad' converters = { 'data' : { 'real_and_imag' : lambda x : ( np . real ( x ) , np . imag ( x ) ) , 'mag_and_phase' : lambda x : ( np . abs ( x ) , np . angle ( x , deg = degrees ) ) } , 'labels' : { 'real_and_imag' : lambda l : ( l + ' [real]' , l + ' [imag]' ) , 'mag_and_phase' : lambda l : ( l + ' [mag]' , l + ' [phase]' ) } , 'units' : { 'real_and_imag' : lambda u : ( u , u ) , 'mag_and_phase' : lambda u : ( u , phase_unit ) } , 'names' : { 'real_and_imag' : lambda n : ( n + '_real' , n + '_imag' ) , 'mag_and_phase' : lambda n : ( n + '_mag' , n + '_phase' ) } } new_data = converters [ 'data' ] [ conversion ] ( parameter [ 'data' ] ) new_labels = converters [ 'labels' ] [ conversion ] ( parameter [ 'label' ] ) new_units = converters [ 'units' ] [ conversion ] ( parameter [ 'unit' ] ) new_names = converters [ 'names' ] [ conversion ] ( parameter [ 'name' ] ) parameter1 : DSPlotData = { "name" : new_names [ 0 ] , "label" : new_labels [ 0 ] , "unit" : new_units [ 0 ] , "data" : new_data [ 0 ] , "shape" : parameter [ "shape" ] , } parameter2 : DSPlotData = { "name" : new_names [ 1 ] , "label" : new_labels [ 1 ] , "unit" : new_units [ 1 ] , "data" : new_data [ 1 ] , "shape" : parameter [ "shape" ] , } return parameter1 , parameter2
Do the actual conversion and turn one parameter into two.
Do the actual conversion and turn one parameter into two .
"""
    Do the actual conversion and turn one parameter into two.
    Should only be called from within _complex_to_real_preparser.
    """
parameter
DSPlotData
conversion
str
degrees
bool