How to use set_properties method in autotest

Best Python code snippet using autotest_python

make_plot.py

Source:make_plot.py Github

copy

Full Screen

1"""2This routine is the main plotting routine. The routine needs to be passed3the matplotlib_user_interface variable ("plotgui") which which the data4values and options (plus the plot variables) are stored.5Routines:6make_plot The main plottine routine, which reads many options and applies7 them as needed.8"""9import numpy10import matplotlib11from matplotlib.collections import PatchCollection12from matplotlib.patches import Rectangle, Ellipse, FancyArrow13from matplotlib.ticker import MultipleLocator14import general_utilities15def make_plot(plotgui, current=None):16 """17 Read the parameters and the data sets, and produce the plot.18 This is the main plotting routine where the graphs are produced. It19 looks at the (many) parameters to determine how the plot should be20 made.21 Parameters22 ----------23 plotgui: a matplotlib_user_interface object for the plot24 current: an optional integer value to override plotgui.current_plot25 Returns26 -------27 None28 """29 if current is None:30 current = plotgui.current_plot31 myfont = {'family': plotgui.fontname[current-1],32 'weight': plotgui.fontweight[current-1],33 'size': plotgui.fontsize[current-1]}34 matplotlib.rc('font', **myfont)35 plotgui.subplot[current-1].clear()36 if plotgui.hide_subplot[current-1]:37 plotgui.subplot[current-1].axis('off')38 logxflag = plotgui.xparameters[current-1]['logarithmic']39 logyflag = plotgui.yparameters[current-1]['logarithmic']40 hlogxflag = plotgui.xparameters[current-1]['hybridlog']41 hlogyflag = plotgui.yparameters[current-1]['hybridlog']42 invertxflag = plotgui.xparameters[current-1]['invert']43 invertyflag = plotgui.yparameters[current-1]['invert']44 hidexflag = plotgui.xparameters[current-1]['hide']45 hideyflag = plotgui.yparameters[current-1]['hide']46 hidexticksflag = plotgui.xparameters[current-1]['hideticks']47 hideyticksflag = plotgui.yparameters[current-1]['hideticks']48 hidexlabelsflag = plotgui.xparameters[current-1]['hidelabels']49 hideylabelsflag = plotgui.yparameters[current-1]['hidelabels']50 inversexticksflag = \51 plotgui.xparameters[current-1]['inverseticks']52 inverseyticksflag = \53 plotgui.yparameters[current-1]['inverseticks']54 bothxticksflag = plotgui.xparameters[current-1]['bothticks']55 bothyticksflag = plotgui.yparameters[current-1]['bothticks']56 oppositexflag = plotgui.xparameters[current-1]['oppositeaxis']57 oppositeyflag = plotgui.yparameters[current-1]['oppositeaxis']58 majorxgridlinesflag = plotgui.xparameters[ current-1][59 'majorgridlines']60 minorxgridlinesflag = plotgui.xparameters[ current-1][61 'minorgridlines']62 majorygridlinesflag = plotgui.yparameters[ current-1][63 'majorgridlines']64 minorygridlinesflag = plotgui.yparameters[ current-1][65 'minorgridlines']66 gridoptionx = minorxgridlinesflag + 2*majorxgridlinesflag67 gridoptiony = minorygridlinesflag + 2*majorygridlinesflag68 gridflags1 = [[False, 'both', 'x'], [True, 'minor', 'x'],69 [True, 'major', 'x'], [True, 'both', 'x']]70 gridflags2 = [[False, 'both', 'y'], [True, 'minor', 'y'],71 [True, 'major', 'y'], [True, 'both', 'y']]72 try:73 xminorticks = \74 float(plotgui.xparameters[current-1]['minorticks'])75 except ValueError:76 xminorticks = 0.077 try:78 yminorticks = \79 float(plotgui.yparameters[current-1]['minorticks'])80 except ValueError:81 yminorticks = 0.082 for loop in range(plotgui.nsets):83 if (plotgui.set_properties[loop]['display']) \84 and (plotgui.set_properties[loop]['plot'] == current):85 if plotgui.set_properties[loop]['errors']:86 xerrors = numpy.zeros((2, len(plotgui.xdata[loop]['values'])),87 dtype=numpy.float32)88 xerrors[0, :] = numpy.copy(plotgui.xdata[loop]['lowerror'])89 xerrors[1, :] = numpy.copy(plotgui.xdata[loop]['higherror'])90 yerrors = numpy.zeros((2, len(plotgui.xdata[loop]['values'])),91 dtype=numpy.float32)92 yerrors[0, :] = numpy.copy(plotgui.ydata[loop]['lowerror'])93 yerrors[1, :] = numpy.copy(plotgui.ydata[loop]['higherror'])94 try:95 if plotgui.set_properties[loop]['symbol'] == 'histogram':96 barwidth = plotgui.xdata[loop]['values'][1] - \97 plotgui.xdata[loop]['values'][0]98 xoff = plotgui.xdata[loop]['values'][1:] - \99 plotgui.xdata[loop]['values'][0:-1]100 xoff = numpy.append(xoff, xoff[-1])101 plotgui.subplot[current-1].bar(102 plotgui.xdata[loop]['values'] - xoff/2.,103 plotgui.ydata[loop]['values'],104 width=barwidth,105 color='white',106 edgecolor=plotgui.set_properties[loop]['colour'],107 linewidth=1)108 elif logyflag == 0 and logxflag == 0 and hlogxflag == 0 \109 and hlogyflag == 0:110 if plotgui.set_properties[loop]['symbol'] is None:111 plotgui.subplot[current-1].plot(112 plotgui.xdata[loop]['values'],113 plotgui.ydata[loop]['values'],114 color=plotgui.set_properties[loop]['colour'],115 linestyle=116 plotgui.set_properties[loop]['linestyle'],117 linewidth=118 plotgui.set_properties[loop]['linewidth'])119 elif plotgui.set_properties[loop]['linestyle'] is None:120 plotgui.subplot[current-1].plot(121 plotgui.xdata[loop]['values'],122 plotgui.ydata[loop]['values'],123 color=plotgui.set_properties[loop]['colour'],124 marker=plotgui.set_properties[loop]['symbol'],125 linestyle='none', markersize=126 plotgui.set_properties[loop]['symbolsize'])127 else:128 plotgui.subplot[current-1].plot(129 plotgui.xdata[loop]['values'],130 plotgui.ydata[loop]['values'],131 color=plotgui.set_properties[loop]['colour'],132 marker=plotgui.set_properties[loop]['symbol'],133 linestyle=134 plotgui.set_properties[loop]['linestyle'],135 markersize=136 plotgui.set_properties[loop]['symbolsize'],137 linewidth=138 plotgui.set_properties[loop]['linewidth'])139 if plotgui.set_properties[loop]['errors']:140 plotgui.subplot[current-1].errorbar(141 plotgui.xdata[loop]['values'],142 plotgui.ydata[loop]['values'], yerrors, xerrors,143 fmt='None',144 ecolor=plotgui.set_properties[loop]['colour'],145 elinewidth=146 plotgui.set_properties[loop]['linewidth'])147 if xminorticks > 0:148 plotgui.subplot[current-1].xaxis.\149 set_minor_locator(MultipleLocator(xminorticks))150 xtl = int(151 plotgui.xparameters[152 current-1]['ticklength'] // 2)153 plotgui.subplot[current-1].tick_params(154 axis='x', which='minor', length=xtl)155 if yminorticks > 0:156 plotgui.subplot[current-1].yaxis.\157 set_minor_locator(MultipleLocator(yminorticks))158 ytl = int(159 plotgui.yparameters[160 current-1]['ticklength'] // 2)161 plotgui.subplot[current-1].tick_params(162 axis='x', which='minor', length=ytl)163 elif hlogyflag == 0 and hlogxflag == 1:164 newxvalues = general_utilities.hybrid_transform(165 plotgui.xdata[loop]['values'])166 if logyflag == 0:167 if plotgui.set_properties[loop]['symbol'] is None:168 plotgui.subplot[current-1].plot(169 newxvalues, plotgui.ydata[loop]['values'],170 color=plotgui.set_properties[loop]['colour'],171 linestyle=172 plotgui.set_properties[loop]['linestyle'],173 linewidth=174 plotgui.set_properties[loop]['linewidth'])175 elif plotgui.set_properties[loop]['linestyle'] is \176 None:177 plotgui.subplot[current-1].plot(178 newxvalues, plotgui.ydata[loop]['values'],179 color=plotgui.set_properties[loop]['colour'],180 marker=181 plotgui.set_properties[loop]['symbol'],182 linestyle='none',183 markersize=184 plotgui.set_properties[loop]['symbolsize'])185 else:186 plotgui.subplot[current-1].plot(187 newxvalues, plotgui.ydata[loop]['values'],188 color=plotgui.set_properties[loop]['colour'],189 marker=190 plotgui.set_properties[loop]['symbol'],191 linestyle=192 plotgui.set_properties[loop]['linestyle'],193 markersize=194 plotgui.set_properties[loop]['symbolsize'],195 linewidth=196 plotgui.set_properties[loop]['linewidth'])197 if yminorticks > 0:198 plotgui.subplot[current-1].yaxis.\199 set_minor_locator(200 MultipleLocator(yminorticks))201 ytl = int(202 plotgui.xparameters[current-1]203 ['ticklength'] // 2)204 plotgui.subplot[current-1].\205 tick_params(axis='y', which='minor',206 length=ytl)207 else:208 if plotgui.set_properties[loop]['symbol'] is None:209 plotgui.subplot[current-1].semilogy(210 newxvalues, plotgui.ydata[loop]['values'],211 color=plotgui.set_properties[loop]['colour'],212 linestyle=213 plotgui.set_properties[loop]['linestyle'],214 linewidth=215 plotgui.set_properties[loop]['linewidth'])216 elif plotgui.set_properties[loop]['linestyle'] is \217 None:218 plotgui.subplot[219 current-1].semilogy(220 newxvalues, plotgui.ydata[loop]['values'],221 color=222 plotgui.set_properties[loop]['colour'],223 marker=224 plotgui.set_properties[loop]['symbol'],225 linestyle='none', markersize=226 plotgui.set_properties[loop]['symbolsize']227 )228 else:229 plotgui.subplot[current-1].semilogy(230 newxvalues, plotgui.ydata[loop]['values'],231 color=plotgui.set_properties[loop]['colour'],232 marker=233 plotgui.set_properties[loop]['symbol'],234 linestyle=235 plotgui.set_properties[loop]['linestyle'],236 markersize=237 plotgui.set_properties[loop]['symbolsize'],238 linewidth=239 plotgui.set_properties[loop]['linewidth'])240 if xminorticks > 0:241 plotgui.subplot[current-1].xaxis.\242 set_minor_locator(MultipleLocator(xminorticks))243 xtl = int(244 plotgui.xparameters[245 current-1]['ticklength'] // 2)246 plotgui.subplot[current-1].tick_params(247 axis='x', which='minor', length=xtl)248 elif hlogyflag == 1 and hlogxflag == 0:249 newyvalues = general_utilities.hybrid_transform(250 plotgui.ydata[loop]['values'])251 if logxflag == 0:252 if plotgui.set_properties[loop]['symbol'] is None:253 plotgui.subplot[current-1].plot(254 plotgui.xdata[loop]['values'], newyvalues,255 color=plotgui.set_properties[loop]['colour'],256 linestyle=257 plotgui.set_properties[loop]['linestyle'],258 linewidth=259 plotgui.set_properties[loop]['linewidth'])260 elif plotgui.set_properties[loop]['linestyle'] is \261 None:262 plotgui.subplot[current-1].plot(263 plotgui.xdata[loop]['values'], newyvalues,264 color=plotgui.set_properties[loop]['colour'],265 marker=266 plotgui.set_properties[loop]['symbol'],267 linestyle='none',268 markersize=269 plotgui.set_properties[loop]['symbolsize'])270 else:271 plotgui.subplot[current-1].plot(272 plotgui.xdata[loop]['values'], newyvalues,273 color=plotgui.set_properties[loop]['colour'],274 marker=275 plotgui.set_properties[loop]['symbol'],276 linestyle=277 plotgui.set_properties[loop]['linestyle'],278 markersize=279 plotgui.set_properties[loop]['symbolsize'],280 linewidth=281 plotgui.set_properties[loop]['linewidth'])282 if xminorticks > 0:283 plotgui.subplot[current-1].xaxis.\284 set_minor_locator(MultipleLocator(285 xminorticks))286 xtl = int(287 plotgui.xparameters[288 current-1]['ticklength']289 // 2)290 plotgui.subplot[current-1].tick_params(291 axis='x', which='minor', length=xtl)292 else:293 if plotgui.set_properties[loop]['symbol'] is None:294 plotgui.subplot[current-1].semilogx(295 plotgui.xdata[loop]['values'],296 newyvalues,297 color=plotgui.set_properties[loop]['colour'],298 linestyle=299 plotgui.set_properties[loop]['linestyle'],300 linewidth=301 plotgui.set_properties[loop]['linewidth'])302 elif plotgui.set_properties[loop]['linestyle'] is \303 None:304 plotgui.subplot[current-1].semilogx(305 plotgui.xdata[loop]['values'],306 newyvalues,307 color=plotgui.set_properties[loop]['colour'],308 marker=plotgui.set_properties[loop]['symbol'],309 linestyle='none',310 markersize=311 plotgui.set_properties[loop]['symbolsize'])312 else:313 plotgui.subplot[current-1].semilogx(314 plotgui.xdata[loop]['values'],315 newyvalues,316 color=plotgui.set_properties[loop]['colour'],317 marker=318 plotgui.set_properties[loop]['symbol'],319 linestyle=320 plotgui.set_properties[loop]['linestyle'],321 markersize=322 plotgui.set_properties[loop]['symbolsize'],323 linewidth=324 plotgui.set_properties[loop]['linewidth'])325 if xminorticks > 0:326 plotgui.subplot[current-1].xaxis.\327 set_minor_locator(MultipleLocator(328 xminorticks))329 xtl = int(330 plotgui.xparameters[331 current-1]['ticklength']332 // 2)333 plotgui.subplot[current-1].tick_params(334 axis='x', which='minor', length=xtl)335 elif hlogyflag == 1 and hlogxflag == 1:336 newxvalues = general_utilities.hybrid_transform(337 plotgui.xdata[loop]['values'])338 newyvalues = general_utilities.hybrid_transform(339 plotgui.ydata[loop]['values'])340 if plotgui.set_properties[loop]['symbol'] is None:341 plotgui.subplot[current-1].plot(342 newxvalues, newyvalues,343 color=plotgui.set_properties[loop]['colour'],344 linestyle=345 plotgui.set_properties[loop]['linestyle'],346 linewidth=347 plotgui.set_properties[loop]['linewidth'])348 elif plotgui.set_properties[loop]['linestyle'] is None:349 plotgui.subplot[current-1].plot(350 newxvalues, newyvalues,351 color=plotgui.set_properties[loop]['colour'],352 marker=plotgui.set_properties[loop]['symbol'],353 linestyle='none',354 markersize=355 plotgui.set_properties[loop]['symbolsize'])356 else:357 plotgui.subplot[current-1].plot(358 newxvalues, newyvalues,359 color=plotgui.set_properties[loop]['colour'],360 marker=plotgui.set_properties[loop]['symbol'],361 linestyle=362 plotgui.set_properties[loop]['linestyle'],363 markersize=364 plotgui.set_properties[loop]['symbolsize'],365 linewidth=366 plotgui.set_properties[loop]['linewidth'])367 elif logyflag == 0 and logxflag == 1 and hlogxflag == 0:368 if plotgui.set_properties[loop]['symbol'] is None:369 plotgui.subplot[current-1].semilogx(370 plotgui.xdata[loop]['values'],371 plotgui.ydata[loop]['values'],372 color=plotgui.set_properties[loop]['colour'],373 linestyle=374 plotgui.set_properties[loop]['linestyle'],375 linewidth=376 plotgui.set_properties[loop]['linewidth'])377 elif plotgui.set_properties[loop]['linestyle'] is None:378 plotgui.subplot[current-1].semilogx(379 plotgui.xdata[loop]['values'],380 plotgui.ydata[loop]['values'],381 color=plotgui.set_properties[loop]['colour'],382 marker=plotgui.set_properties[loop]['symbol'],383 linestyle='None',384 markersize=385 plotgui.set_properties[loop]['symbolsize'])386 else:387 plotgui.subplot[current-1].semilogx(388 plotgui.xdata[loop]['values'],389 plotgui.ydata[loop]['values'],390 color=plotgui.set_properties[loop]['colour'],391 marker=plotgui.set_properties[loop]['symbol'],392 linestyle=393 plotgui.set_properties[loop]['linestyle'],394 markersize=395 plotgui.set_properties[loop]['symbolsize'],396 linewidth=397 plotgui.set_properties[loop]['linewidth'])398 if plotgui.set_properties[loop]['errors']:399 plotgui.subplot[current-1].errorbar(400 plotgui.xdata[loop]['values'],401 plotgui.ydata[loop]['values'], xerrors, yerrors,402 fmt=None, ecolor=403 plotgui.set_properties[loop]['colour'],404 elinewidth=405 plotgui.set_properties[loop]['linewidth'])406 if yminorticks > 0:407 plotgui.subplot[current-1].\408 yaxis.set_minor_locator(409 MultipleLocator(yminorticks))410 ytl = int(411 plotgui.xparameters[current-1][412 'ticklength'] // 2)413 plotgui.subplot[current-1].tick_params(414 axis='y', which='minor', length=ytl)415 elif logxflag == 0 and logyflag == 1 and hlogyflag == 0:416 if plotgui.set_properties[loop]['symbol'] is None:417 plotgui.subplot[current-1].semilogy(418 plotgui.xdata[loop]['values'],419 plotgui.ydata[loop]['values'],420 color=plotgui.set_properties[loop]['colour'],421 linestyle=422 plotgui.set_properties[loop]['linestyle'],423 linewidth=424 plotgui.set_properties[loop]['linewidth'])425 elif plotgui.set_properties[loop]['linestyle'] is None:426 plotgui.subplot[current-1].semilogy(427 plotgui.xdata[loop]['values'],428 plotgui.ydata[loop]['values'],429 color=plotgui.set_properties[loop]['colour'],430 marker=plotgui.set_properties[loop]['symbol'],431 linestyle='None',432 markersize=433 plotgui.set_properties[loop]['symbolsize'])434 else:435 plotgui.subplot[current-1].semilogy(436 plotgui.xdata[loop]['values'],437 plotgui.ydata[loop]['values'],438 color=plotgui.set_properties[loop]['colour'],439 marker=plotgui.set_properties[loop]['symbol'],440 linestyle=441 plotgui.set_properties[loop]['linestyle'],442 markersize=443 plotgui.set_properties[loop]['symbolsize'],444 linewidth=445 plotgui.set_properties[loop]['linewidth'])446 if plotgui.set_properties[loop]['errors']:447 plotgui.subplot[current-1].errorbar(448 plotgui.xdata[loop]['values'],449 plotgui.ydata[loop]['values'], xerrors, yerrors,450 fmt=None,451 ecolor=plotgui.set_properties[loop]['colour'],452 elinewidth=453 plotgui.set_properties[loop]['linewidth'])454 if xminorticks > 0:455 plotgui.subplot[current-1].xaxis.\456 set_minor_locator(MultipleLocator(xminorticks))457 xtl = int(458 plotgui.xparameters[459 current-1]['ticklength'] // 2)460 plotgui.subplot[current-1].tick_params(461 axis='x', which='minor', length=xtl)462 elif logxflag == 1 and logyflag == 1:463 if plotgui.set_properties[loop]['symbol'] is None:464 plotgui.subplot[current-1].loglog(465 plotgui.xdata[loop]['values'],466 plotgui.ydata[loop]['values'],467 color=468 plotgui.set_properties[loop]['colour'],469 linestyle=470 plotgui.set_properties[loop]['linestyle'],471 linewidth=472 plotgui.set_properties[loop]['linewidth'])473 elif plotgui.set_properties[loop]['linestyle'] is None:474 plotgui.subplot[current-1].loglog(475 plotgui.xdata[loop]['values'],476 plotgui.ydata[loop]['values'],477 color=plotgui.set_properties[loop]['colour'],478 marker=plotgui.set_properties[loop]['symbol'],479 linestyle='None',480 markersize=481 plotgui.set_properties[loop]['symbolsize'])482 else:483 plotgui.subplot[current-1].loglog(484 plotgui.xdata[loop]['values'],485 plotgui.ydata[loop]['values'],486 color=plotgui.set_properties[loop]['colour'],487 marker=plotgui.set_properties[loop]['symbol'],488 linestyle=489 plotgui.set_properties[loop]['linestyle'],490 markersize=491 plotgui.set_properties[loop]['symbolsize'],492 linewidth=493 plotgui.set_properties[loop]['linewidth'])494 if plotgui.set_properties[loop]['errors']:495 plotgui.subplot[current-1].errorbar(496 plotgui.xdata[loop]['values'],497 plotgui.ydata[loop]['values'],498 xerrors, yerrors, fmt=None,499 ecolor=plotgui.set_properties[loop]['colour'],500 elinewidth=501 plotgui.set_properties[loop]['linewidth'])502 else:503 # One should not get here, but if the flags do not504 # correspond to the expected options use a linear505 # plot as the default506 if plotgui.set_properties[loop]['symbol'] is None:507 plotgui.subplot[current-1].plot(508 plotgui.xdata[loop]['values'],509 plotgui.ydata[loop]['values'],510 color=plotgui.set_properties[loop]['colour'],511 linestyle=512 plotgui.set_properties[loop]['linestyle'],513 linewidth=514 plotgui.set_properties[loop]['linewidth'])515 elif plotgui.set_properties[loop]['linestyle'] is None:516 plotgui.subplot[current-1].plot(517 plotgui.xdata[loop]['values'],518 plotgui.ydata[loop]['values'],519 color=plotgui.set_properties[loop]['colour'],520 marker=plotgui.set_properties[loop]['symbol'],521 linestyle='none',522 markersize=523 plotgui.set_properties[loop]['symbolsize'])524 else:525 plotgui.subplot[current-1].plot(526 plotgui.xdata[loop]['values'],527 plotgui.ydata[loop]['values'],528 color=plotgui.set_properties[loop]['colour'],529 marker=plotgui.set_properties[loop]['symbol'],530 linestyle=531 plotgui.set_properties[loop]['linestyle'],532 markersize=533 plotgui.set_properties[loop]['symbolsize'],534 linewidth=535 plotgui.set_properties[loop]['linewidth'])536 if plotgui.set_properties[loop]['errors']:537 plotgui.subplot[current-1].errorbar(538 plotgui.xdata[loop]['values'],539 plotgui.ydata[loop]['values'], yerrors, xerrors,540 fmt='None',541 ecolor=plotgui.set_properties[loop]['colour'],542 elinewidth=543 plotgui.set_properties[loop]['linewidth'])544 if xminorticks > 0:545 plotgui.subplot[current-1].xaxis.\546 set_minor_locator(MultipleLocator(xminorticks))547 xtl = int(plotgui.xparameters[548 current-1]['ticklength'] // 2)549 plotgui.subplot[current-1].tick_params(550 axis='x', which='minor', length=xtl)551 if yminorticks > 0:552 plotgui.subplot[553 current-1].yaxis.set_minor_locator(554 MultipleLocator(yminorticks))555 ytl = int(plotgui.yparameters[556 current-1]['ticklength'] // 2)557 plotgui.subplot[current-1].tick_params(558 axis='y', which='minor', length=ytl)559 except Exception:560 pass561 if bothyticksflag == 1:562 plotgui.subplot[current-1].tick_params(563 left=True, right=True, which='both')564 else:565 plotgui.subplot[current-1].tick_params(566 left=True, right=False, which='both')567 if bothxticksflag == 1:568 plotgui.subplot[current-1].tick_params(569 bottom=True, top=True, which='both')570 else:571 plotgui.subplot[current-1].tick_params(572 bottom=True, top=False, which='both')573 for n1 in range(plotgui.number_of_lines):574 if plotgui.plot_lines[n1]['plot'] == current:575 xlvalues = numpy.asarray([plotgui.plot_lines[n1]['xstart'],576 plotgui.plot_lines[n1]['xend']])577 if hlogxflag == 1:578 xlvalues[0] = general_utilities.hybrid_transform(579 xlvalues[0])580 xlvalues[1] = general_utilities.hybrid_transform(581 xlvalues[1])582 ylvalues = numpy.asarray([plotgui.plot_lines[n1]['ystart'],583 plotgui.plot_lines[n1]['yend']])584 if hlogyflag == 1:585 ylvalues[0] = general_utilities.hybrid_transform(586 ylvalues[0])587 ylvalues[1] = general_utilities.hybrid_transform(588 ylvalues[1])589 plotgui.subplot[current-1].plot(590 xlvalues, ylvalues,591 color=plotgui.plot_lines[n1]['line_colour'],592 linestyle=plotgui.plot_lines[n1]['line_type'],593 linewidth=plotgui.plot_lines[n1]['line_thickness'])594 patches = []595 for n1 in range(plotgui.number_of_boxes):596 if plotgui.plot_boxes[n1]['plot'] == current:597 xcorner = plotgui.plot_boxes[n1]['xstart']598 ycorner = plotgui.plot_boxes[n1]['ystart']599 delx = plotgui.plot_boxes[n1]['xend'] \600 - plotgui.plot_boxes[n1]['xstart']601 dely = plotgui.plot_boxes[n1]['yend'] \602 - plotgui.plot_boxes[n1]['ystart']603 if delx < 0.:604 xcorner = xcorner + delx605 delx = -delx606 if dely < 0.:607 ycorner = ycorner + dely608 dely = -dely609 if hlogxflag == 1:610 xc1 = xcorner611 xc2 = xcorner+delx612 xcorner = general_utilities.hybrid_transform(xc1)613 delx = general_utilities.hybrid_transform(xc2) - xcorner614 if hlogyflag == 1:615 yc1 = ycorner616 yc2 = ycorner+dely617 ycorner = general_utilities.hybrid_transform(yc1)618 dely = general_utilities.hybrid_transform(yc2) - ycorner619 rect = Rectangle(620 (xcorner, ycorner), delx, dely,621 angle=plotgui.plot_boxes[n1]['rotation'],622 edgecolor=plotgui.plot_boxes[n1]['line_colour'],623 linestyle=plotgui.plot_boxes[n1]['line_type'],624 linewidth=plotgui.plot_boxes[n1]['line_thickness'],625 facecolor=plotgui.plot_boxes[n1]['fill_colour'])626 plotgui.subplot[current-1].add_artist(rect)627 patches.append(rect)628 if len(patches) > 0:629 pc = PatchCollection(patches)630 plotgui.subplot[current-1].add_collection(pc)631 patches = []632 for n1 in range(plotgui.number_of_ellipses):633 if plotgui.plot_ellipses[n1]['plot'] == current:634 xcenter = plotgui.plot_ellipses[n1]['xposition']635 ycenter = plotgui.plot_ellipses[n1]['yposition']636 delx = plotgui.plot_ellipses[n1]['major']637 dely = plotgui.plot_ellipses[n1]['minor']638 if hlogxflag == 1:639 xc1 = xcorner640 xc2 = xcorner+delx641 xcorner = general_utilities.hybrid_transform(xc1)642 delx = general_utilities.hybrid_transform(xc2) - xcorner643 if hlogyflag == 1:644 yc1 = ycorner645 yc2 = ycorner+dely646 ycorner = general_utilities.hybrid_transform(yc1)647 dely = general_utilities.hybrid_transform(yc2) - ycorner648 ellip = Ellipse(649 (xcenter, ycenter), delx, dely,650 angle=plotgui.plot_ellipses[n1]['rotation'],651 edgecolor=plotgui.plot_ellipses[n1]['line_colour'],652 linestyle=plotgui.plot_ellipses[n1]['line_type'],653 linewidth=plotgui.plot_ellipses[n1]['line_thickness'],654 facecolor=plotgui.plot_ellipses[n1]['fill_colour'])655 plotgui.subplot[current-1].add_artist(ellip)656 patches.append(ellip)657 if len(patches) > 0:658 pc = PatchCollection(patches)659 plotgui.subplot[current-1].add_collection(pc)660 patches = []661 for n1 in range(plotgui.number_of_vectors):662 if plotgui.plot_vectors[n1]['plot'] == current:663 x1 = plotgui.plot_vectors[n1]['xstart']664 y1 = plotgui.plot_vectors[n1]['ystart']665 xlength = plotgui.plot_vectors[n1]['xend'] \666 - plotgui.plot_vectors[n1]['xstart']667 ylength = plotgui.plot_vectors[n1]['yend'] \668 - plotgui.plot_vectors[n1]['ystart']669 delx = plotgui.plot_vectors[n1]['delx']670 dely = plotgui.plot_vectors[n1]['dely']671 if hlogxflag == 1:672 xs1 = general_utilities.hybrid_transform(x1)673 xs2 = general_utilities.hybrid_transform(674 plotgui.plot_vectors[n1]['xend'])675 xlength = xs2 - xs1676 delx = xs2 - general_utilities.hybrid_transform(677 plotgui.plot_vectors[n1]['xend']-delx)678 if hlogyflag == 1:679 ys1 = general_utilities.hybrid_transform(y1)680 ys2 = general_utilities.hybrid_transform(681 plotgui.plot_vectors[n1]['yend'])682 ylength = ys2 - ys1683 delx = ys2 - general_utilities.hybrid_transform(684 plotgui.plot_vectors[n1]['yend']-dely)685 arrow = FancyArrow(686 x1, y1, xlength, ylength, head_width=delx,687 head_length=dely, fill=plotgui.plot_vectors[n1]['fill'],688 edgecolor=plotgui.plot_vectors[n1]['line_colour'],689 linestyle=plotgui.plot_vectors[n1]['line_type'],690 linewidth=plotgui.plot_vectors[n1]['line_thickness'],691 facecolor=plotgui.plot_vectors[n1]['fill_colour'])692 plotgui.subplot[current-1].add_artist(arrow)693 patches.append(arrow)694 if len(patches) > 0:695 pc = PatchCollection(patches)696 plotgui.subplot[current-1].add_collection(pc)697 if plotgui.plot_frame[current-1] > 0.:698 plotgui.subplot[current-1].spines['bottom'].set_linewidth(699 plotgui.plot_frame[current-1])700 plotgui.subplot[current-1].spines['top'].set_linewidth(701 plotgui.plot_frame[current-1])702 plotgui.subplot[current-1].spines['left'].set_linewidth(703 plotgui.plot_frame[current-1])704 plotgui.subplot[current-1].spines['right'].set_linewidth(705 plotgui.plot_frame[current-1])706 else:707 plotgui.subplot[current-1].spines['bottom'].set_linewidth(708 0.5)709 plotgui.subplot[current-1].spines['top'].set_linewidth(710 0.5)711 plotgui.subplot[current-1].spines['left'].set_linewidth(712 0.5)713 plotgui.subplot[current-1].spines['right'].set_linewidth(714 0.5)715 xisinverted = plotgui.subplot[current-1].xaxis_inverted()716 yisinverted = plotgui.subplot[current-1].yaxis_inverted()717 if (invertxflag == 1 and (not xisinverted)) or \718 (invertxflag == 0 and xisinverted):719 plotgui.subplot[current-1].invert_xaxis()720 if (invertyflag == 1 and (not yisinverted)) or \721 (invertyflag == 0 and yisinverted):722 plotgui.subplot[current-1].invert_yaxis()723 if plotgui.matplotlib_rounding.get():724 xmin1, xmax1 = plotgui.subplot[current-1].get_xbound()725 ymin1, ymax1 = plotgui.subplot[current-1].get_ybound()726 if plotgui.original_range[current-1]:727 plotgui.plot_range[current-1][0] = xmin1728 plotgui.plot_range[current-1][1] = xmax1729 plotgui.plot_range[current-1][2] = ymin1730 plotgui.plot_range[current-1][3] = ymax1731 plotgui.original_range[current-1] = False732 if hlogxflag == 0:733 plotgui.subplot[current-1].set_xbound(734 plotgui.plot_range[current-1][0],735 plotgui.plot_range[current-1][1])736 else:737 xrange = numpy.asarray([plotgui.plot_range[current-1][0],738 plotgui.plot_range[current-1][1]],739 dtype=numpy.float32)740 xrange1 = general_utilities.hybrid_transform(xrange)741 plotgui.subplot[current-1].set_xbound(xrange1[0],742 xrange1[1])743 newxvalues = general_utilities.hybrid_transform(744 plotgui.xdata[loop]['values'])745 tickmarks, ticklabels = general_utilities.hybrid_labels(xrange1)746 plotgui.subplot[current-1].set_xticks(tickmarks)747 plotgui.subplot[current-1].set_xticklabels(ticklabels)748 if hlogyflag == 0:749 plotgui.subplot[current-1].set_ybound(750 plotgui.plot_range[current-1][2],751 plotgui.plot_range[current-1][3])752 else:753 yrange = numpy.asarray([plotgui.plot_range[current-1][2],754 plotgui.plot_range[current-1][3]],755 dtype=numpy.float32)756 yrange1 = general_utilities.hybrid_transform(yrange)757 plotgui.subplot[current-1].set_ybound(yrange1[0],758 yrange1[1])759 newyvalues = general_utilities.hybrid_transform(760 plotgui.ydata[loop]['values'])761 tickmarks, ticklabels = general_utilities.hybrid_labels(yrange1)762 plotgui.subplot[current-1].set_yticks(tickmarks)763 plotgui.subplot[current-1].set_yticklabels(ticklabels)764 plotgui.subplot[current-1].set_xlabel(765 plotgui.xparameters[current-1]['label'],766 family=plotgui.fontname[current-1],767 size=plotgui.fontsize[current-1],768 weight=plotgui.fontweight[current-1])769 plotgui.subplot[current-1].set_ylabel(770 plotgui.yparameters[current-1]['label'],771 family=plotgui.fontname[current-1],772 size=plotgui.fontsize[current-1],773 weight=plotgui.fontweight[current-1])774 try:775 plotgui.subplot[current-1].set_title(776 plotgui.title[current-1],777 family=plotgui.fontname[current-1],778 size=plotgui.fontsize[current-1],779 weight=plotgui.fontweight[current-1])780 except Exception:781 pass782 # Adjust the margins if the plot_margin value is set.783 left = plotgui.bounding_box[current-1][0] + plotgui.plot_margin784 right = plotgui.bounding_box[current-1][0] \785 + plotgui.bounding_box[current-1][2] - plotgui.plot_margin786 bottom = plotgui.bounding_box[current-1][1] + plotgui.plot_margin787 top = plotgui.bounding_box[current-1][1] \788 + plotgui.bounding_box[current-1][3] - plotgui.plot_margin789 plotgui.subplot[current-1].set_position(790 [left, bottom, right-left, top-bottom], which='both')791 if plotgui.number_of_labels > 0:792 for loop in range(plotgui.number_of_labels):793 if current == plotgui.plot_labels[loop]['plot']:794 xpos1 = plotgui.plot_labels[loop]['xposition']795 if plotgui.xparameters[current-1]['hybridlog'] == 1:796 xpos1 = general_utilities.hybrid_transform(xpos1)797 ypos1 = plotgui.plot_labels[loop]['yposition']798 if plotgui.xparameters[current-1]['hybridlog'] == 1:799 ypos1 = general_utilities.hybrid_transform(ypos1)800 plotgui.subplot[current-1].text(801 xpos1, ypos1,802 plotgui.plot_labels[loop]['labelstring'],803 {'color': plotgui.plot_labels[loop]['colour'],804 'fontsize': plotgui.plot_labels[loop]['size'],805 'fontfamily': plotgui.plot_labels[loop]['font'],806 'fontweight': plotgui.plot_labels[loop]['fontweight']})807 try:808 legend_flag = plotgui.legend_variable[current-1].get()809 except Exception:810 legend_flag = 0811 if legend_flag:812 plotgui.generate_legend(None)813 legend_option = plotgui.legend_options[current-1].get()814 legend_position = None815 if legend_option == 'user':816 try:817 str1 = plotgui.legend_position_field.get()818 values = str1.split()819 if len(values) == 2:820 xlpos = float(values[0])821 ylpos = float(values[1])822 legend_position = [xlpos, ylpos]823 plotgui.legend_user_position[current-1] = \824 legend_position825 except ValueError:826 legend_option = 'best'827 else:828 legend_option = plotgui.legend_position[current-1]829 if legend_option is None:830 legend_position = 'best'831 try:832 legend_frame = plotgui.legend_frame[current-1].get()833 except Exception:834 legend_frame = 0835 if legend_position is None:836 plotgui.subplot[current-1].legend(837 handles=plotgui.legend_handles[current-1],838 labels=plotgui.legend_labels[current-1],839 loc=legend_option, frameon=legend_frame)840 else:841 plotgui.subplot[current-1].legend(842 handles=plotgui.legend_handles[current-1],843 labels=plotgui.legend_labels[current-1],844 loc=legend_position, frameon=legend_frame)845 if oppositexflag == 1:846 plotgui.subplot[current-1].get_xaxis().set_ticks_position(847 "top")848 plotgui.subplot[current-1].get_xaxis().set_label_position(849 "top")850 if oppositeyflag == 1:851 plotgui.subplot[current-1].get_yaxis().set_ticks_position(852 "right")853 plotgui.subplot[current-1].get_yaxis().set_label_position(854 "right")855 if inversexticksflag == 1:856 plotgui.subplot[current-1].tick_params(857 axis='x', direction='in', length=858 plotgui.xparameters[current-1]['ticklength'])859 plotgui.subplot[current-1].tick_params(860 axis='x', direction='in', which='minor')861 else:862 plotgui.subplot[current-1].tick_params(863 axis='x', direction='out', length=864 plotgui.xparameters[current-1]['ticklength'])865 plotgui.subplot[current-1].tick_params(866 axis='x', direction='out', which='minor')867 if inverseyticksflag == 1:868 plotgui.subplot[current-1].tick_params(869 axis='y', direction='in', length=870 plotgui.yparameters[current-1]['ticklength'])871 plotgui.subplot[current-1].tick_params(axis='y',872 direction='in',873 which='minor')874 else:875 plotgui.subplot[current-1].tick_params(876 axis='y', direction='out', length=877 plotgui.yparameters[current-1]['ticklength'])878 plotgui.subplot[current-1].tick_params(axis='y',879 direction='out',880 which='minor')881 if plotgui.grid_linetype[current-1] is None:882 stylestring = 'None'883 else:884 stylestring = plotgui.grid_linetype[current-1]885 if plotgui.grid_colour[current-1] is None:886 colourvalue = 'black'887 else:888 colourvalue = plotgui.grid_colour[current-1]889 if (gridoptionx == 0) and (gridoptiony == 0):890 plotgui.subplot[current-1].grid(b=False, axis='both',891 which='both')892 else:893 if gridoptionx == 0:894 plotgui.subplot[current-1].grid(b=False, axis='x',895 which='both')896 else:897 plotgui.subplot[current-1].grid(898 b=gridflags1[gridoptionx][0],899 which=gridflags1[gridoptionx][1],900 axis=gridflags1[gridoptionx][2], linestyle=stylestring,901 color=colourvalue)902 if gridoptiony == 0:903 plotgui.subplot[current-1].grid(b=False, axis='y',904 which='both')905 else:906 plotgui.subplot[current-1].grid(907 b=gridflags2[gridoptiony][0],908 which=gridflags2[gridoptiony][1],909 axis=gridflags2[gridoptiony][2], linestyle=stylestring,910 color=colourvalue)911 if hidexticksflag == 1:912 plotgui.subplot[current-1].get_xaxis().set_ticks([])913 if hideyticksflag == 1:914 plotgui.subplot[current-1].get_yaxis().set_ticks([])915 if hidexlabelsflag == 1:916 plotgui.subplot[current-1].get_xaxis().set_ticklabels([])917 if hideylabelsflag == 1:918 plotgui.subplot[current-1].get_yaxis().set_ticklabels([])919 if hidexflag == 1:920 plotgui.subplot[current-1].get_xaxis().set_visible(False)921 else:922 plotgui.subplot[current-1].get_xaxis().set_visible(True)923 if hideyflag == 1:924 plotgui.subplot[current-1].get_yaxis().set_visible(False)925 else:926 plotgui.subplot[current-1].get_yaxis().set_visible(True)927 try:928 if plotgui.equal_aspect[current-1]:929 plotgui.figure.gca().set_aspect('equal', adjustable='box')930 else:931 plotgui.figure.gca().set_aspect('auto')932 except:933 print(plotgui.equal_aspect)934 plotgui.figure.gca().set_aspect('auto')935 plotgui.canvas.draw()936 # The follow is duplicate information, but may be used to set tick937 # intervals....938 if not plotgui.matplotlib_rounding.get():939 plotgui.xparameters[current-1]['minimum'] = \940 plotgui.plot_range[current-1][0]941 plotgui.xparameters[current-1]['maximum'] = \942 plotgui.plot_range[current-1][1]943 plotgui.yparameters[current-1]['minimum'] = \944 plotgui.plot_range[current-1][2]945 plotgui.yparameters[current-1]['maximum'] = \946 plotgui.plot_range[current-1][3]947 else:948 xr1, xr2 = plotgui.subplot[current-1].get_xbound()949 yr1, yr2 = plotgui.subplot[current-1].get_ybound()950 plotgui.xparameters[current-1]['minimum'] = xr1951 plotgui.xparameters[current-1]['maximum'] = xr2952 plotgui.yparameters[current-1]['minimum'] = yr1...

Full Screen

Full Screen

items_temp.py

Source:items_temp.py Github

copy

Full Screen

...11# try:12# self.c_items = pickle.load(open("items_main.camp", "rb"))13# except:14# # Simple Weapons15# self.c_items["Iron Sword"] = Inanimate("Iron Sword", 0, 1, 20, "An Iron Sword", 1, 4).set_properties(1, 6, "slashing")16# self.c_items["Club"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")17# self.c_items["Dagger"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")18# self.c_items["GreatClub"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")19# self.c_items["Handaxe"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")20# self.c_items["Javelin"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")21# self.c_items["Light Hammer"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")22# self.c_items["Mace"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")23# self.c_items["Quarterstaff"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")24# self.c_items["Sickle"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")25# self.c_items["Spear"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")26#27# # Martial Melee Weapons28# self.c_items["Battleaxe"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")29# self.c_items["Flail"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")30# self.c_items["Glaive"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")31# self.c_items["Greataxe"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")32# self.c_items["Greatsword"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")33# self.c_items["Halberd"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")34# self.c_items["Lance"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")35# self.c_items["Longsword"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")36# self.c_items["Maul"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")37# self.c_items["Morningstar"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")38# self.c_items["Pike"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")39# self.c_items["Rapier"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")40# self.c_items["Scimitar"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")41# self.c_items["Shortsword"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")42# self.c_items["Trident"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")43# self.c_items["War Pick"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")44# self.c_items["Warhammer"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")45# self.c_items["Whip"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")46#47# # Ranged Weapons48# self.c_items["Crossbow (Light)"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")49# self.c_items["Dart"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")50# self.c_items["Shortbow"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")51# self.c_items["Sling"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")52#53# # Martial Ranged Weapons54# self.c_items["Blowgun"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")55# self.c_items["Crossbow (Hand)"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")56# self.c_items["Crossbow (Heavy)"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")57# self.c_items["Longbow"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")58# self.c_items["Net"] = Inanimate("Iron Sword", 0, 1, 20, "Deals +2 Damage", 1, 4).set_properties(1, 6, "slashing")59#60# # Armor61# self.c_items["Padded Armor"] = Inanimate("Padded Armor", 1, 2, 20, "Provides +10 AC", 1, 6).set_properties(11, "dexterity", True)62# self.c_items["Leather Armor"] = Inanimate("Leather Armor", 1, 2, 20, "Provides +10 AC", 1, 6).set_properties(11, "dexterity")63# self.c_items["Studded Leather Armor"] = Inanimate("Studded Leather Armor", 1, 2, 20, "Provides +10 AC", 1, 6).set_properties(12, "dexterity")64# self.c_items["Hide Armor"] = Inanimate("Hide Armor", 1, 2, 20, "Provides +10 AC", 1, 6).set_properties(12, "dexterity")65# self.c_items["Chain Shirt"] = Inanimate("Chain Shirt", 1, 2, 20, "Provides +10 AC", 1, 6).set_properties(13, "dexterity")66# self.c_items["Scale Mail"] = Inanimate("Scale Mail", 1, 2, 20, "Provides +10 AC", 1, 6).set_properties(14, "dexterity", True)67# self.c_items["Breastplate"] = Inanimate("Breastplate", 1, 2, 20, "Provides +10 AC", 1, 6).set_properties(14, "dexterity")68# self.c_items["Half Plate"] = Inanimate("Half Plate", 1, 2, 20, "Provides +10 AC", 1, 6).set_properties(15, "dexterity", True)69# self.c_items["Ring Mail"] = Inanimate("Ring Mail", 1, 2, 20, "Provides +10 AC", 1, 6).set_properties(14, None, True)70# self.c_items["Chain Mail"] = Inanimate("Chain Mail", 1, 2, 20, "Provides +10 AC", 1, 6).set_properties(16, None, True)71# self.c_items["Splint Armor"] = Inanimate("Splint Armor", 1, 2, 20, "Provides +10 AC", 1, 6).set_properties(17, None, True)72# self.c_items["Plate Armor"] = Inanimate("Plate Armor", 1, 2, 20, "Provides +10 AC", 1, 6).set_properties(18, None, True)73#74# # Consumables75# self.c_items["Mana Potion"] = Inanimate("Mana Potion", 2, 3, 30, "Restores Mana", 6, 0.5)76# self.c_items["Mana Potion"] = Inanimate("Mana Potion", 2, 3, 30, "Restores Mana", 6, 0.5)77# self.c_items["Mana Potion"] = Inanimate("Mana Potion", 2, 3, 30, "Restores Mana", 6, 0.5)78# self.c_items["Mana Potion"] = Inanimate("Mana Potion", 2, 3, 30, "Restores Mana", 6, 0.5)79# self.c_items["Mana Potion"] = Inanimate("Mana Potion", 2, 3, 30, "Restores Mana", 6, 0.5)80#81# pickle.dump(self.c_items, open("items_main.camp", "wb"))82#83# try:84# self.custom = pickle.load(open("items_custom.camp", "rb"))85# except: pass86#...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful