def pqcost(gencost, ng, on=None):
    'Splits the gencost variable into two pieces if costs are given for Qg.\n\n    Checks whether C{gencost} has cost information for reactive power\n    generation (rows C{ng+1} to C{2*ng}). If so, it returns the first C{ng}\n    rows in C{pcost} and the last C{ng} rows in C{qcost}. Otherwise, leaves\n    C{qcost} empty. Also does some error checking.\n    If C{on} is specified (list of indices of generators which are on line)\n    it only returns the rows corresponding to these generators.\n\n    @author: Ray Zimmerman (PSERC Cornell)\n    '
    if (on is None):
        on = arange(ng)
    if (gencost.shape[0] == ng):
        pcost = gencost[on, :]
        qcost = array([])
    elif (gencost.shape[0] == (2 * ng)):
        pcost = gencost[on, :]
        qcost = gencost[(on + ng), :]
    else:
        stderr.write('pqcost: gencost has wrong number of rows\n')
    return (pcost, qcost)
Splits the gencost variable into two pieces if costs are given for Qg.

Checks whether C{gencost} has cost information for reactive power
generation (rows C{ng+1} to C{2*ng}). If so, it returns the first C{ng}
rows in C{pcost} and the last C{ng} rows in C{qcost}. Otherwise, leaves
C{qcost} empty. Also does some error checking.
If C{on} is specified (list of indices of generators which are on line)
it only returns the rows corresponding to these generators.

@author: Ray Zimmerman (PSERC Cornell)
def pqcost(gencost, ng, on=None):
    'Splits the gencost variable into two pieces if costs are given for Qg.\n\n    Checks whether C{gencost} has cost information for reactive power\n    generation (rows C{ng+1} to C{2*ng}). If so, it returns the first C{ng}\n    rows in C{pcost} and the last C{ng} rows in C{qcost}. Otherwise, leaves\n    C{qcost} empty. Also does some error checking.\n    If C{on} is specified (list of indices of generators which are on line)\n    it only returns the rows corresponding to these generators.\n\n    @author: Ray Zimmerman (PSERC Cornell)\n    '
    if (on is None):
        on = arange(ng)
    if (gencost.shape[0] == ng):
        pcost = gencost[on, :]
        qcost = array([])
    elif (gencost.shape[0] == (2 * ng)):
        pcost = gencost[on, :]
        qcost = gencost[(on + ng), :]
    else:
        stderr.write('pqcost: gencost has wrong number of rows\n')
    return (pcost, qcost)