def relgrowth_all_countries(self, countryName): """ACCUMULATED PLOTS ALL COUNTRIES TOGETHER""" # Plot total Cases for all countries in one plot acc = plot( self.data, self.config, "Date", "COVID19", keys=[ "RelativeGrowth*{}".format( self.config["COVID19"]["GrowingRateMulti"]) ], do_not_plot=["Date", "deaths", "recovered"], PlotLabel="{}".format(countryName), ylabel="Confirmed (%)", ) if self.casesrelgrowth: self.casesrelgrowth *= acc else: self.casesrelgrowth = acc # Plot total Recovered for all countries in one plot rec = plot( self.data, self.config, "Date", "COVID19", keys=[ "RelativeGrowth*{}".format( self.config["COVID19"]["GrowingRateMulti"]) ], do_not_plot=["Date", "deaths", "confirmed"], PlotLabel="{}".format(countryName), ylabel="Recovered (%)", ) if self.recoveredrelgrowth: self.recoveredrelgrowth *= rec else: self.recoveredrelgrowth = rec # Plot total Death for all countries in one plot deaths = plot( self.data, self.config, "Date", "COVID19", keys=[ "RelativeGrowth*{}".format( self.config["COVID19"]["GrowingRateMulti"]) ], do_not_plot=["Date", "recovered", "confirmed"], PlotLabel="{}".format(countryName), ylabel="Deaths (%)", ) if self.deathsrelgrowth: self.deathsrelgrowth *= deaths else: self.deathsrelgrowth = deaths
def run(self): """Runs the script""" # Plot all Measurements self.basePlots = plot( self.data, self.config, self.xaxis, self.analysisName, plot_only=("MPV",), do_not_plot=self.donts, ) import pandas as pd import hvplot.pandas df = pd.DataFrame({ "30": [25949, 21177, 33], "20": [21392, 25618, 2957], "10": [30952, 17625, 1410], "5": [34443, 16300, 257], "0": [34352, 15194, 448], "-10": [42386, 7420, 166], "-17": [41868, 7723, 168], "Clustersize": [3, 4, 5], }) df = df.groupby("Clustersize").mean() bars = df.hvplot.bar(x="Clustersize", legend='top_left', y=["-17","-10","0","5","10","20","30"]) group_specific_order = [3, 4, 5] variable_specific_order = ["-17","-10","0","5","10","20","30"] # Note that group and Variable are the variable names of your dimensions here # when you use this on a different grouped barchart, then please change to the # names of your own dimensions. bars = bars.redim.values( group=group_specific_order, Variable=variable_specific_order, ) # CCE measurements # Plot all Measurements self.basePlots2 = plot( self.data, self.config, "voltage", self.analysisName, plot_only=("m17d", "m10d", "0d","5d","10d","20d", "30d"), do_not_plot=self.donts, ) # self.basePlots = applyPlotOptions(self.basePlots, {'Curve': {'color': "hv.Cycle('PiYG')"}}) self.PlotDict["BasePlots"] = self.basePlots + self.basePlots2 self.PlotDict["All"] = self.basePlots + bars.sort().opts(width=1000, height=800) + self.basePlots2 return self.PlotDict
def run(self): """Runs the script""" for it, entry in enumerate(self.data["keys"]): print(entry) currents = self.data[entry]["data"]["Current"].values plateau = self.config[self.analysisname].get("plateau", 0.02) sum = 0 n = 0 voltages = self.data[entry]["data"]["Voltage"].values for i in range(len(currents)): #print(currents[len(currents)-1-i]) if 1 - (currents[len(currents) - 1 - i] / currents[len(currents) - 1 - i - 1]) > plateau: sum = 0 for j in range(i): sum += currents[len(currents) - 1 - j] n = i print(voltages[len(voltages) - 1 - i]) break ave = sum * 1. / n maximum = max(currents) diff = maximum - ave #s0 = diff/(1.6e-19*5.415e9*0.00505) #flute2 s0 = diff / (1.6e-19 * 5.415e9 * 0.00723) #flute4 print("max =", maximum) print("average =", ave) print("diff =", diff) print("s0 =", s0) myvalue = "%.3f" % s0 name = "_".join(entry.split("_")[2:5]) label = name + "_s0 = " + myvalue + " cm/s" label = label.replace("-", "_") self.data["keys"][it] = label self.data[label] = self.data.pop(entry) #print(self.data["HPK_VPX33234-001_PSS_HM-WW_1stflute2_GCD_27_5_2020_9h7m27s"]["data"]["Current"].values[-1]) #print(self.config[self.analysisname].get("plateau", 0.02)) # Convert the units to the desired ones for meas in self.measurements: unit = (self.config[self.analysisname].get(meas, {}).get( "UnitConversion", None)) if unit: self.data = convert_to_EngUnits(self.data, meas, unit) # Plot all Measurements self.basePlots = plot( self.data, self.config, self.measurements[0], self.analysisname, do_not_plot=[self.measurements[0]], ) self.PlotDict["All"] = self.basePlots #print(type(self.PlotDict["All"])) return self.PlotDict
def accumulated_all_countries(self, countryName): """ACCUMULATED PLOTS ALL COUNTRIES TOGETHER""" # Plot total Cases for all countries in one plot acc = plot( self.data, self.config, "Date", "COVID19", keys=["Accumulated"], do_not_plot=["Date", "deaths", "recovered"], PlotLabel="{}".format(countryName), ) if self.cases: self.cases *= acc else: self.cases = acc # Plot total Recovered for all countries in one plot rec = plot( self.data, self.config, "Date", "COVID19", keys=["Accumulated"], do_not_plot=["Date", "deaths", "confirmed"], PlotLabel="{}".format(countryName), ) if self.recovered: self.recovered *= rec else: self.recovered = rec # Plot total Death for all countries in one plot deaths = plot( self.data, self.config, "Date", "COVID19", keys=["Accumulated"], do_not_plot=["Date", "recovered", "confirmed"], PlotLabel="{}".format(countryName), ) if self.deaths: self.deaths *= deaths else: self.deaths = deaths
def run(self): """Runs the script""" self.analysis() # Convert the units to the desired ones for meas in self.measurements: unit = (self.config[self.analysisname].get(meas, {}).get( "UnitConversion", None)) if unit: self.data = convert_to_EngUnits(self.data, meas, unit) # Plot all Measurements self.basePlots = plot( self.data, self.config, self.xaxis, self.analysisname, do_not_plot=[self.xaxis], ) self.PlotDict["All"] = self.basePlots # Plot all special Plots: # Histogram Plot self.Histogram = dospecialPlots( self.data, self.config, self.analysisname, "Histogram", self.measurements, **self.config[self.analysisname].get( "AuxOptions", {}).get("singleHistogram", {})) if self.Histogram: self.PlotDict["Histogram"] = self.Histogram self.PlotDict["All"] = self.PlotDict["All"] + self.Histogram # Whiskers Plot self.WhiskerPlots = dospecialPlots(self.data, self.config, self.analysisname, "BoxWhisker", self.measurements) if self.WhiskerPlots: self.PlotDict["Whiskers"] = self.WhiskerPlots self.PlotDict["All"] = self.PlotDict["All"] + self.WhiskerPlots return self.PlotDict
def run(self): """Runs the script""" # Add the measurement to the list # Plot all IV measurements # (data, config, xaxis_measurement, analysis_name, do_not_plot=(), plot_only=(), keys=None, **kwargs) IVplot = None IVSubplot = None self.PlotDict["All"] = None for file in self.data["keys"]: if "IV" in file: for meas in self.measurements: self.config[self.analysisName][meas + "IV"] = self.config[ self.analysisName]["current"] tempplot = plot( self.data, self.config, self.xaxis, self.analysisName, plot_only=(meas, ), keys=(file, ), do_not_plot=self.donts, PlotLabel=meas, ) tempplot = customize_plot(tempplot, "current", self.config[self.analysisName]) if IVplot: IVplot *= tempplot else: IVplot = tempplot if IVSubplot: IVSubplot += tempplot else: IVSubplot = tempplot IVplot = customize_plot(IVplot, "current", self.config[self.analysisName]) # Plot all CV measurements # (data, config, xaxis_measurement, analysis_name, do_not_plot=(), plot_only=(), keys=None, **kwargs) CVplot = None for file in self.data["keys"]: if "CV" in file: for meas in self.measurements: self.config[self.analysisName][meas + "CV"] = self.config[ self.analysisName]["capacitance"] tempplot = plot( self.data, self.config, self.xaxis, self.analysisName, plot_only=(meas, ), keys=(file, ), do_not_plot=self.donts, PlotLabel=meas + "CV", ) if CVplot: CVplot *= tempplot else: CVplot = tempplot CVplot = customize_plot(CVplot, "capacitance", self.config[self.analysisName]) # Add full depletion point to 1/c^2 curve c2plot = None for file in self.data["keys"]: if "1C2" in file: for meas in self.measurements: self.config[self.analysisName][meas + "1c2"] = self.config[ self.analysisName]["1C2"] tempplot = plot( self.data, self.config, self.xaxis, self.analysisName, plot_only=(meas, ), keys=(file, ), do_not_plot=self.donts, PlotLabel=meas + "1c2", ) if c2plot: c2plot *= tempplot else: c2plot = tempplot c2plot = customize_plot(c2plot, "1C2", self.config[self.analysisName]) if IVplot: self.PlotDict["All"] = IVplot self.PlotDict["All"] += IVSubplot if CVplot and self.PlotDict["All"]: self.PlotDict["All"] += CVplot + c2plot elif CVplot and not self.PlotDict["All"]: self.PlotDict["All"] = CVplot + c2plot # Reconfig the plots to be sure self.PlotDict["All"] = config_layout( self.PlotDict["All"], **self.config[self.analysisName].get("Layout", {})) return self.PlotDict
def run(self): """Runs the script""" # Add the measurement to the list # Plot all IV measurements # (data, config, xaxis_measurement, analysis_name, do_not_plot=(), plot_only=(), keys=None, **kwargs) IVplot = None self.PlotDict["All"] = None for file in self.data["keys"]: if "IV" in file: for meas in self.measurements: self.config[self.analysisName][meas + "IV"] = self.config[ self.analysisName]["current"] tempplot = plot( self.data, self.config, self.xaxis, self.analysisName, plot_only=(meas, ), keys=(file, ), do_not_plot=self.donts, PlotLabel=meas + "IV", ) if IVplot: IVplot *= tempplot else: IVplot = tempplot IVplot = customize_plot(IVplot, "current", self.config[self.analysisName]) # Plot all CV measurements # (data, config, xaxis_measurement, analysis_name, do_not_plot=(), plot_only=(), keys=None, **kwargs) CVplot = None for file in self.data["keys"]: if "CV" in file: for meas in self.measurements: self.config[self.analysisName][meas + "CV"] = self.config[ self.analysisName]["capacitance"] tempplot = plot( self.data, self.config, self.xaxis, self.analysisName, plot_only=(meas, ), keys=(file, ), do_not_plot=self.donts, PlotLabel=meas + "CV", ) if CVplot: CVplot *= tempplot else: CVplot = tempplot CVplot = customize_plot(CVplot, "capacitance", self.config[self.analysisName]) # Add full depletion point to 1/c^2 curve c2plot = None for file in self.data["keys"]: if "1C2" in file: for meas in self.measurements: self.config[self.analysisName][meas + "1c2"] = self.config[ self.analysisName]["1C2"] tempplot = plot( self.data, self.config, self.xaxis, self.analysisName, plot_only=(meas, ), keys=(file, ), do_not_plot=self.donts, PlotLabel=meas + "1c2", ) if c2plot: c2plot *= tempplot else: c2plot = tempplot c2plot = customize_plot(c2plot, "1C2", self.config[self.analysisName]) # if self.config[self.analysisName].get("1C2", {}).get("DoFullDepletionCalculation", False): # try: # if self.basePlots.Overlay.CV_CURVES_hyphen_minus_Full_depletion.children: # c2plot = self.basePlots.Overlay.CV_CURVES_hyphen_minus_Full_depletion.opts(clone = True) ## else: c2plot = self.basePlots.Curve.CV_CURVES_hyphen_minus_Full_depletion.opts(clone = True) # fdestimation = self.find_full_depletion(c2plot, self.data, self.config, PlotLabel="Full depletion estimation") # self.PlotDict["All"] += fdestimation # self.PlotDict["BasePlots"] += fdestimation # except Exception as err: # self.log.warning("No full depletion calculation possible... Error: {}".format(err)) # Reconfig the plots to be sure # self.PlotDict["All"] = config_layout(self.PlotDict["All"], **self.config[self.analysisName].get("Layout", {})) self.PlotDict["All"] = IVplot + CVplot + c2plot # Reconfig the plots to be sure self.PlotDict["All"] = config_layout( self.PlotDict["All"], **self.config[self.analysisName].get("Layout", {})) return self.PlotDict
def accumulated_all_countries_normalizes(self, countryName, inhabitants): # Normalize to mio inhabitants factor = float(inhabitants) / 1e6 # Change data for data in ["confirmed", "deaths", "recovered"]: self.data["Accumulated"]["data"][ data] = self.data["Accumulated"]["data"][data] / factor #self.data["Accumulated"]["data"].insert(0, "{}Norm".format(data), self.data["Accumulated"]["data"][data]/factor) # Not very efficient #self.data["Accumulated"]["measurements"].append(data) #self.data["Accumulated"]["units"].append("#/1e6") #self.data["columns"].append("{}Norm".format(data)) #self.config["COVID19"]["{}Norm".format(data)] = self.config["COVID19"][data] # Plot total Cases for all countries in one plot acc = plot(self.data, self.config, "Date", "COVID19", keys=["Accumulated"], do_not_plot=[ "Date", "deaths", "recovered", "DeathsNorm", "RecoveredNorm" ], PlotLabel="{}".format(countryName)) if self.casesNorm: self.casesNorm *= acc else: self.casesNorm = acc # Plot total Recovered for all countries in one plot rec = plot(self.data, self.config, "Date", "COVID19", keys=["Accumulated"], do_not_plot=[ "Date", "deaths", "confirmed", "DeathsNorm", "ConfirmedNorm" ], PlotLabel="{}".format(countryName)) if self.recoveredNorm: self.recoveredNorm *= rec else: self.recoveredNorm = rec # Plot total Death for all countries in one plot deaths = plot(self.data, self.config, "Date", "COVID19", keys=["Accumulated"], do_not_plot=[ "Date", "recovered", "confirmed", "RecoveredNorm", "ConfirmedNorm" ], PlotLabel="{}".format(countryName)) if self.deathsNorm: self.deathsNorm *= deaths else: self.deathsNorm = deaths