def _add_data(self, data): """Add the data matrix to the results set.""" csvlib.write_csv(self.filename, data, self.variables, append=self._init_file_done) self._init_file_done = True
def add_op(self, keys, op): """A MONTE CARLO OP is made of a set of OP points. This method adds an OP solution and its corresponding key values to the results set. """ keys = numpy.mat(numpy.array(keys)).T x = op.asmatrix() data = numpy.concatenate((x, keys), axis=0) csvlib.write_csv(self.filename, data, copy.copy(self.variables), append=True)
def add_op(self, sweepvalue, op): """A DC sweep is made of a set of OP points. This method adds an OP solution and its corresponding sweep value to the results set. """ sweepvalue = numpy.mat(numpy.array([sweepvalue])) x = op.asmatrix() data = numpy.concatenate((sweepvalue, x), axis=0) csvlib.write_csv(self.filename, data, copy.copy(self.variables), append=self._init_file_done) self._init_file_done = True
def add_line(self, time, x): """This method adds a solution and its corresponding time value to the results set. """ if not self._lock: time = numpy.mat(numpy.array([time])) data = numpy.concatenate((time, x), axis=0) csvlib.write_csv(self.filename, data, copy.copy(self.variables), append=self._init_file_done) self._init_file_done = True else: printing.print_general_error("Attempting to add values to a complete result set. BUG")
def add_line(self, omega, x): omega = numpy.mat(numpy.array([omega])) xsplit = numpy.mat(numpy.zeros((x.shape[0]*2, 1))) for i in range(x.shape[0]): xsplit[2*i, 0] = numpy.abs(x[i,0]) xsplit[2*i+1, 0] = numpy.angle(x[i,0],deg=options.ac_phase_in_deg) data = numpy.concatenate((omega, xsplit), axis=0) csvlib.write_csv(self.filename, data, self.variables, append=self._init_file_done) self._init_file_done = True
def set_results(self, t, x): """All the results are set at the same time for a PSS""" time = numpy.mat(numpy.array(t)) data = numpy.concatenate((time, x), axis=0) csvlib.write_csv(self.filename, data, self.variables, append=False)