def segments_to_numpy ( segments ) : segments = numpy . array ( segments , dtype = SEGMENT_DATATYPE , ndmin = 2 ) # each segment in a row segments = segments if SEGMENTS_DIRECTION == 0 else numpy . transpose ( segments ) return segments
how to restrict a multi dimensional array output to 3 significant figures in python numpy
given a list of 4 - element tuples transforms it into a numpy array
def segments_to_numpy(segments):
    """given a list of 4-element tuples, transforms it into a numpy array"""
    segments = numpy.array(segments, dtype=SEGMENT_DATATYPE, ndmin=2)  # each segment in a row
    segments = segments if SEGMENTS_DIRECTION == 0 else numpy.transpose(segments)
    return segments