def pceManifold(json, title, xtype, ytype, xlabel, ylabel, lxrange, uxrange, lyrange, uyrange, trace_type, x_trace, y_trace, trace_name, queue): engine = PlotControlEngine(json) xtrace = [] ytrace = [] if x_trace is not None and y_trace is not None and trace_type is not None: try: xtrace = array([float(y) for y in x_trace if extractor(y)]) ytrace = array([float(x) for x in y_trace if extractor(x)]) except ValueError: print( 'Exception raised in pceManifold() when attempting to cast types' ) engine.addTrace(xtrace, ytrace, trace_name, trace_type) if lxrange is not None and uxrange is not None: engine.changeXRange(lxrange, uxrange) if lyrange is not None and uyrange is not None: engine.changeYRange(lyrange, uyrange) if xtype is not None: engine.changeXType(xtype) if ytype is not None: engine.changeYType(ytype) if xlabel is not None: engine.changeXLabel(xlabel) if ylabel is not None: engine.changeYLabel(ylabel) if title is not None: engine.changeTitle(title) queue.put(engine.render())
def __init__(self, _sample, _svgr=None): self.rock = _sample self.tortuosidade = [] self.svgr = None self.rock.setPhi([p / 100 for p in _sample.getPhi()]) # convert porosity from % to decimal if _svgr is None: _svgr = [] else: self.svgr = [float(y) for y in _svgr if extractor(y)]
def histogramManifold(data, _nbins, queue): if _nbins == '': _nbins=0 data = np.array([float(y) for y in data if extractor(y)]) try: ndata = pd.DataFrame(data) nbins = int(_nbins) except ValueError: return 'Error' hst = Histogram(data, nbins) hst.plot() queue.put([hst.plot_path, hst.json])
def boxplotDataCleaner(_data): #flatten, remove strs and then convert to df ndata = pd.DataFrame(_data).transpose() rows = ndata.shape[1] columns = ndata.shape[0] auxdata = [] for c in range(columns): d = [float(x) for x in list(ndata.iloc[c]) if extractor(x)] auxdata.append(d) return pd.DataFrame(auxdata).transpose()
def statisticsManifold(_xdata: list, method: str, quartile, percentile, queue): xdata = np.array([float(x) for x in _xdata if extractor(x)]) st = Statistics(xdata) methods = [ 'Média aritmética', 'Média Ponderada', 'Mediana', 'Moda', 'Variância Pop.', 'Variância Am.', 'Desvio Padrão Pop.', 'Desvio Padrão Am.', 'Máximo', 'Mínimo', 'Amplitude', 'Quartil', 'Percentil' ] container = [] if method == methods[0]: container.append(st.average()) if method == methods[1]: container.append(st.average()) if method == methods[2]: container.append(st.median()) if method == methods[3]: container.append(st.mode()) if method == methods[4]: container.append(st.varP()) if method == methods[5]: container.append(st.varS()) if method == methods[6]: container.append(st.stdevP()) if method == methods[7]: container.append(st.stdevS()) if method == methods[8]: container.append(st.max()) if method == methods[9]: container.append(st.min()) if method == methods[10]: container.append(st.range()) if method == methods[11]: container.append(st.quartile(quartile)) if method == methods[12]: container.append(st.percentile(percentile)) queue.put(container)