From e92a9eb6ad03a301d29d67cc0baca5c5c350bc13 Mon Sep 17 00:00:00 2001 From: Kyle Mills Date: Tue, 25 Oct 2022 20:19:28 +0000 Subject: [PATCH 01/13] updated setup to fix dependency --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 7ea5083..783015f 100644 --- a/setup.py +++ b/setup.py @@ -1,11 +1,11 @@ from setuptools import setup setup( name='Plot1Qbit', - version='0.16', + version='0.17', author='Kyle Mills', author_email="kyle.mills@uoit.net", description="Set matplotlib style to conform with 1QBit's brand policies", packages=['plot1qbit'], - install_requires=['matplotlib>=3.1.0', 'gif', 'tqdm', 'inspect', 'numpy'], + install_requires=['matplotlib>=3.1.0', 'gif', 'tqdm', 'numpy'], include_package_data=True ) From 2c61b53364a51de86417cf2fa8d5521d46e888c3 Mon Sep 17 00:00:00 2001 From: Kyle Mills Date: Mon, 5 Dec 2022 17:40:27 +0000 Subject: [PATCH 02/13] added report maker --- plot1qbit/__init__.py | 1 + setup.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/plot1qbit/__init__.py b/plot1qbit/__init__.py index 7d88568..1f37a0d 100644 --- a/plot1qbit/__init__.py +++ b/plot1qbit/__init__.py @@ -1,2 +1,3 @@ import plot1qbit.initiate from plot1qbit.util import plot_to_gif +import plot1qbit.report_maker diff --git a/setup.py b/setup.py index 783015f..65140fb 100644 --- a/setup.py +++ b/setup.py @@ -1,11 +1,11 @@ from setuptools import setup setup( name='Plot1Qbit', - version='0.17', + version='0.18', author='Kyle Mills', author_email="kyle.mills@uoit.net", description="Set matplotlib style to conform with 1QBit's brand policies", packages=['plot1qbit'], - install_requires=['matplotlib>=3.1.0', 'gif', 'tqdm', 'numpy'], + install_requires=['tabulate', 'matplotlib>=3.1.0', 'gif', 'tqdm', 'numpy'], include_package_data=True ) From 4765a45815e495101d7faad126e8750aa2abc92a Mon Sep 17 00:00:00 2001 From: Kyle Mills Date: Thu, 15 Dec 2022 22:20:11 +0000 Subject: [PATCH 03/13] added __init__.py --- plot1qbit/report_maker/__init__.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 plot1qbit/report_maker/__init__.py diff --git a/plot1qbit/report_maker/__init__.py b/plot1qbit/report_maker/__init__.py new file mode 100644 index 0000000..934d565 --- /dev/null +++ b/plot1qbit/report_maker/__init__.py @@ -0,0 +1 @@ +from plot1qbit.report_maker.output import * \ No newline at end of file From f8206aad6ebebe5fc0534bea235d269373744695 Mon Sep 17 00:00:00 2001 From: Kyle Mills Date: Thu, 15 Dec 2022 22:20:37 +0000 Subject: [PATCH 04/13] added report_maker --- plot1qbit/report_maker/jquery-3.6.0.min.js | 2 + plot1qbit/report_maker/lightbox.min.css | 1 + plot1qbit/report_maker/lightbox.min.js | 15 ++ plot1qbit/report_maker/masonry.pkgd.min.js | 9 + plot1qbit/report_maker/output.py | 268 +++++++++++++++++++++ plot1qbit/report_maker/style.css | 96 ++++++++ 6 files changed, 391 insertions(+) create mode 100644 plot1qbit/report_maker/jquery-3.6.0.min.js create mode 100644 plot1qbit/report_maker/lightbox.min.css create mode 100644 plot1qbit/report_maker/lightbox.min.js create mode 100644 plot1qbit/report_maker/masonry.pkgd.min.js create mode 100644 plot1qbit/report_maker/output.py create mode 100644 plot1qbit/report_maker/style.css diff --git a/plot1qbit/report_maker/jquery-3.6.0.min.js b/plot1qbit/report_maker/jquery-3.6.0.min.js new file mode 100644 index 0000000..200b54e --- /dev/null +++ b/plot1qbit/report_maker/jquery-3.6.0.min.js @@ -0,0 +1,2 @@ +/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.6.0",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||D,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,D=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",y.option=!!ce.lastChild;var ge={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function je(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function De(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function qe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Le(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var _t,zt=[],Ut=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=zt.pop()||S.expando+"_"+wt.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Ut.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ut.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Ut,"$1"+r):!1!==e.jsonp&&(e.url+=(Tt.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,zt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((_t=E.implementation.createHTMLDocument("").body).innerHTML="
",2===_t.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=Fe(y.pixelPosition,function(e,t){if(t)return t=We(e,n),Pe.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0.nav{left:0}.lb-nav a{outline:0;background-image:url(data:image/gif;base64,R0lGODlhAQABAPAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==)}.lb-next,.lb-prev{height:100%;cursor:pointer;display:block}.lb-nav a.lb-prev{width:34%;left:0;float:left;background:url(../images/prev.png) left 48% no-repeat;filter:alpha(Opacity=0);opacity:0;-webkit-transition:opacity .6s;-moz-transition:opacity .6s;-o-transition:opacity .6s;transition:opacity .6s}.lb-nav a.lb-prev:hover{filter:alpha(Opacity=100);opacity:1}.lb-nav a.lb-next{width:64%;right:0;float:right;background:url(../images/next.png) right 48% no-repeat;filter:alpha(Opacity=0);opacity:0;-webkit-transition:opacity .6s;-moz-transition:opacity .6s;-o-transition:opacity .6s;transition:opacity .6s}.lb-nav a.lb-next:hover{filter:alpha(Opacity=100);opacity:1}.lb-dataContainer{margin:0 auto;padding-top:5px;width:100%;border-bottom-left-radius:4px;border-bottom-right-radius:4px}.lb-dataContainer:after{content:"";display:table;clear:both}.lb-data{padding:0 4px;color:#ccc}.lb-data .lb-details{width:85%;float:left;text-align:left;line-height:1.1em}.lb-data .lb-caption{font-size:13px;font-weight:700;line-height:1em}.lb-data .lb-caption a{color:#4ae}.lb-data .lb-number{display:block;clear:left;padding-bottom:1em;font-size:12px;color:#999}.lb-data .lb-close{display:block;float:right;width:30px;height:30px;background:url(../images/close.png) top right no-repeat;text-align:right;outline:0;filter:alpha(Opacity=70);opacity:.7;-webkit-transition:opacity .2s;-moz-transition:opacity .2s;-o-transition:opacity .2s;transition:opacity .2s}.lb-data .lb-close:hover{cursor:pointer;filter:alpha(Opacity=100);opacity:1} \ No newline at end of file diff --git a/plot1qbit/report_maker/lightbox.min.js b/plot1qbit/report_maker/lightbox.min.js new file mode 100644 index 0000000..c468cbc --- /dev/null +++ b/plot1qbit/report_maker/lightbox.min.js @@ -0,0 +1,15 @@ +/*! + * Lightbox v2.11.2 + * by Lokesh Dhakar + * + * More info: + * http://lokeshdhakar.com/projects/lightbox2/ + * + * Copyright Lokesh Dhakar + * Released under the MIT license + * https://github.com/lokesh/lightbox2/blob/master/LICENSE + * + * @preserve + */ +!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],b):"object"==typeof exports?module.exports=b(require("jquery")):a.lightbox=b(a.jQuery)}(this,function(a){function b(b){this.album=[],this.currentImageIndex=void 0,this.init(),this.options=a.extend({},this.constructor.defaults),this.option(b)}return b.defaults={albumLabel:"Image %1 of %2",alwaysShowNavOnTouchDevices:!1,fadeDuration:600,fitImagesInViewport:!0,imageFadeDuration:600,positionFromTop:50,resizeDuration:700,showImageNumberLabel:!0,wrapAround:!1,disableScrolling:!1,sanitizeTitle:!1},b.prototype.option=function(b){a.extend(this.options,b)},b.prototype.imageCountLabel=function(a,b){return this.options.albumLabel.replace(/%1/g,a).replace(/%2/g,b)},b.prototype.init=function(){var b=this;a(document).ready(function(){b.enable(),b.build()})},b.prototype.enable=function(){var b=this;a("body").on("click","a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]",function(c){return b.start(a(c.currentTarget)),!1})},b.prototype.build=function(){if(!(a("#lightbox").length>0)){var b=this;a('
').appendTo(a("body")),this.$lightbox=a("#lightbox"),this.$overlay=a("#lightboxOverlay"),this.$outerContainer=this.$lightbox.find(".lb-outerContainer"),this.$container=this.$lightbox.find(".lb-container"),this.$image=this.$lightbox.find(".lb-image"),this.$nav=this.$lightbox.find(".lb-nav"),this.containerPadding={top:parseInt(this.$container.css("padding-top"),10),right:parseInt(this.$container.css("padding-right"),10),bottom:parseInt(this.$container.css("padding-bottom"),10),left:parseInt(this.$container.css("padding-left"),10)},this.imageBorderWidth={top:parseInt(this.$image.css("border-top-width"),10),right:parseInt(this.$image.css("border-right-width"),10),bottom:parseInt(this.$image.css("border-bottom-width"),10),left:parseInt(this.$image.css("border-left-width"),10)},this.$overlay.hide().on("click",function(){return b.end(),!1}),this.$lightbox.hide().on("click",function(c){"lightbox"===a(c.target).attr("id")&&b.end()}),this.$outerContainer.on("click",function(c){return"lightbox"===a(c.target).attr("id")&&b.end(),!1}),this.$lightbox.find(".lb-prev").on("click",function(){return 0===b.currentImageIndex?b.changeImage(b.album.length-1):b.changeImage(b.currentImageIndex-1),!1}),this.$lightbox.find(".lb-next").on("click",function(){return b.currentImageIndex===b.album.length-1?b.changeImage(0):b.changeImage(b.currentImageIndex+1),!1}),this.$nav.on("mousedown",function(a){3===a.which&&(b.$nav.css("pointer-events","none"),b.$lightbox.one("contextmenu",function(){setTimeout(function(){this.$nav.css("pointer-events","auto")}.bind(b),0)}))}),this.$lightbox.find(".lb-loader, .lb-close").on("click",function(){return b.end(),!1})}},b.prototype.start=function(b){function c(a){d.album.push({alt:a.attr("data-alt"),link:a.attr("href"),title:a.attr("data-title")||a.attr("title")})}var d=this,e=a(window);e.on("resize",a.proxy(this.sizeOverlay,this)),this.sizeOverlay(),this.album=[];var f,g=0,h=b.attr("data-lightbox");if(h){f=a(b.prop("tagName")+'[data-lightbox="'+h+'"]');for(var i=0;ik||g.height>j)&&(g.width/k>g.height/j?(i=k,h=parseInt(g.height/(g.width/i),10),f.width(i),f.height(h)):(h=j,i=parseInt(g.width/(g.height/h),10),f.width(i),f.height(h))),c.sizeContainer(f.width(),f.height())},g.src=this.album[b].link,this.currentImageIndex=b},b.prototype.sizeOverlay=function(){var b=this;setTimeout(function(){b.$overlay.width(a(document).width()).height(a(document).height())},0)},b.prototype.sizeContainer=function(a,b){function c(){d.$lightbox.find(".lb-dataContainer").width(g),d.$lightbox.find(".lb-prevLink").height(h),d.$lightbox.find(".lb-nextLink").height(h),d.$overlay.focus(),d.showImage()}var d=this,e=this.$outerContainer.outerWidth(),f=this.$outerContainer.outerHeight(),g=a+this.containerPadding.left+this.containerPadding.right+this.imageBorderWidth.left+this.imageBorderWidth.right,h=b+this.containerPadding.top+this.containerPadding.bottom+this.imageBorderWidth.top+this.imageBorderWidth.bottom;e!==g||f!==h?this.$outerContainer.animate({width:g,height:h},this.options.resizeDuration,"swing",function(){c()}):c()},b.prototype.showImage=function(){this.$lightbox.find(".lb-loader").stop(!0).hide(),this.$lightbox.find(".lb-image").fadeIn(this.options.imageFadeDuration),this.updateNav(),this.updateDetails(),this.preloadNeighboringImages(),this.enableKeyboardNav()},b.prototype.updateNav=function(){var a=!1;try{document.createEvent("TouchEvent"),a=!!this.options.alwaysShowNavOnTouchDevices}catch(a){}this.$lightbox.find(".lb-nav").show(),this.album.length>1&&(this.options.wrapAround?(a&&this.$lightbox.find(".lb-prev, .lb-next").css("opacity","1"),this.$lightbox.find(".lb-prev, .lb-next").show()):(this.currentImageIndex>0&&(this.$lightbox.find(".lb-prev").show(),a&&this.$lightbox.find(".lb-prev").css("opacity","1")),this.currentImageIndex1&&this.options.showImageNumberLabel){var c=this.imageCountLabel(this.currentImageIndex+1,this.album.length);this.$lightbox.find(".lb-number").text(c).fadeIn("fast")}else this.$lightbox.find(".lb-number").hide();this.$outerContainer.removeClass("animating"),this.$lightbox.find(".lb-dataContainer").fadeIn(this.options.resizeDuration,function(){return a.sizeOverlay()})},b.prototype.preloadNeighboringImages=function(){if(this.album.length>this.currentImageIndex+1){(new Image).src=this.album[this.currentImageIndex+1].link}if(this.currentImageIndex>0){(new Image).src=this.album[this.currentImageIndex-1].link}},b.prototype.enableKeyboardNav=function(){this.$lightbox.on("keyup.keyboard",a.proxy(this.keyboardAction,this)),this.$overlay.on("keyup.keyboard",a.proxy(this.keyboardAction,this))},b.prototype.disableKeyboardNav=function(){this.$lightbox.off(".keyboard"),this.$overlay.off(".keyboard")},b.prototype.keyboardAction=function(a){var b=a.keyCode;27===b?(a.stopPropagation(),this.end()):37===b?0!==this.currentImageIndex?this.changeImage(this.currentImageIndex-1):this.options.wrapAround&&this.album.length>1&&this.changeImage(this.album.length-1):39===b&&(this.currentImageIndex!==this.album.length-1?this.changeImage(this.currentImageIndex+1):this.options.wrapAround&&this.album.length>1&&this.changeImage(0))},b.prototype.end=function(){this.disableKeyboardNav(),a(window).off("resize",this.sizeOverlay),this.$lightbox.fadeOut(this.options.fadeDuration),this.$overlay.fadeOut(this.options.fadeDuration),this.options.disableScrolling&&a("body").removeClass("lb-disable-scrolling")},new b}); +//# sourceMappingURL=lightbox.min.map \ No newline at end of file diff --git a/plot1qbit/report_maker/masonry.pkgd.min.js b/plot1qbit/report_maker/masonry.pkgd.min.js new file mode 100644 index 0000000..53386ae --- /dev/null +++ b/plot1qbit/report_maker/masonry.pkgd.min.js @@ -0,0 +1,9 @@ +/*! + * Masonry PACKAGED v4.2.2 + * Cascading grid layout library + * https://masonry.desandro.com + * MIT License + * by David DeSandro + */ + +!function(t,e){"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("jquery")):t.jQueryBridget=e(t,t.jQuery)}(window,function(t,e){"use strict";function i(i,r,a){function h(t,e,n){var o,r="$()."+i+'("'+e+'")';return t.each(function(t,h){var u=a.data(h,i);if(!u)return void s(i+" not initialized. Cannot call methods, i.e. "+r);var d=u[e];if(!d||"_"==e.charAt(0))return void s(r+" is not a valid method");var l=d.apply(u,n);o=void 0===o?l:o}),void 0!==o?o:t}function u(t,e){t.each(function(t,n){var o=a.data(n,i);o?(o.option(e),o._init()):(o=new r(n,e),a.data(n,i,o))})}a=a||e||t.jQuery,a&&(r.prototype.option||(r.prototype.option=function(t){a.isPlainObject(t)&&(this.options=a.extend(!0,this.options,t))}),a.fn[i]=function(t){if("string"==typeof t){var e=o.call(arguments,1);return h(this,t,e)}return u(this,t),this},n(a))}function n(t){!t||t&&t.bridget||(t.bridget=i)}var o=Array.prototype.slice,r=t.console,s="undefined"==typeof r?function(){}:function(t){r.error(t)};return n(e||t.jQuery),i}),function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return-1==n.indexOf(e)&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{},n=i[t]=i[t]||{};return n[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=i.indexOf(e);return-1!=n&&i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){i=i.slice(0),e=e||[];for(var n=this._onceEvents&&this._onceEvents[t],o=0;oe;e++){var i=h[e];t[i]=0}return t}function n(t){var e=getComputedStyle(t);return e||a("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See https://bit.ly/getsizebug1"),e}function o(){if(!d){d=!0;var e=document.createElement("div");e.style.width="200px",e.style.padding="1px 2px 3px 4px",e.style.borderStyle="solid",e.style.borderWidth="1px 2px 3px 4px",e.style.boxSizing="border-box";var i=document.body||document.documentElement;i.appendChild(e);var o=n(e);s=200==Math.round(t(o.width)),r.isBoxSizeOuter=s,i.removeChild(e)}}function r(e){if(o(),"string"==typeof e&&(e=document.querySelector(e)),e&&"object"==typeof e&&e.nodeType){var r=n(e);if("none"==r.display)return i();var a={};a.width=e.offsetWidth,a.height=e.offsetHeight;for(var d=a.isBorderBox="border-box"==r.boxSizing,l=0;u>l;l++){var c=h[l],f=r[c],m=parseFloat(f);a[c]=isNaN(m)?0:m}var p=a.paddingLeft+a.paddingRight,g=a.paddingTop+a.paddingBottom,y=a.marginLeft+a.marginRight,v=a.marginTop+a.marginBottom,_=a.borderLeftWidth+a.borderRightWidth,z=a.borderTopWidth+a.borderBottomWidth,E=d&&s,b=t(r.width);b!==!1&&(a.width=b+(E?0:p+_));var x=t(r.height);return x!==!1&&(a.height=x+(E?0:g+z)),a.innerWidth=a.width-(p+_),a.innerHeight=a.height-(g+z),a.outerWidth=a.width+y,a.outerHeight=a.height+v,a}}var s,a="undefined"==typeof console?e:function(t){console.error(t)},h=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],u=h.length,d=!1;return r}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("desandro-matches-selector/matches-selector",e):"object"==typeof module&&module.exports?module.exports=e():t.matchesSelector=e()}(window,function(){"use strict";var t=function(){var t=window.Element.prototype;if(t.matches)return"matches";if(t.matchesSelector)return"matchesSelector";for(var e=["webkit","moz","ms","o"],i=0;is?"round":"floor";r=Math[a](r),this.cols=Math.max(r,1)},n.getContainerWidth=function(){var t=this._getOption("fitWidth"),i=t?this.element.parentNode:this.element,n=e(i);this.containerWidth=n&&n.innerWidth},n._getItemLayoutPosition=function(t){t.getSize();var e=t.size.outerWidth%this.columnWidth,i=e&&1>e?"round":"ceil",n=Math[i](t.size.outerWidth/this.columnWidth);n=Math.min(n,this.cols);for(var o=this.options.horizontalOrder?"_getHorizontalColPosition":"_getTopColPosition",r=this[o](n,t),s={x:this.columnWidth*r.col,y:r.y},a=r.y+t.size.outerHeight,h=n+r.col,u=r.col;h>u;u++)this.colYs[u]=a;return s},n._getTopColPosition=function(t){var e=this._getTopColGroup(t),i=Math.min.apply(Math,e);return{col:e.indexOf(i),y:i}},n._getTopColGroup=function(t){if(2>t)return this.colYs;for(var e=[],i=this.cols+1-t,n=0;i>n;n++)e[n]=this._getColGroupY(n,t);return e},n._getColGroupY=function(t,e){if(2>e)return this.colYs[t];var i=this.colYs.slice(t,t+e);return Math.max.apply(Math,i)},n._getHorizontalColPosition=function(t,e){var i=this.horizontalColIndex%this.cols,n=t>1&&i+t>this.cols;i=n?0:i;var o=e.size.outerWidth&&e.size.outerHeight;return this.horizontalColIndex=o?i+t:this.horizontalColIndex,{col:i,y:this._getColGroupY(i,t)}},n._manageStamp=function(t){var i=e(t),n=this._getElementOffset(t),o=this._getOption("originLeft"),r=o?n.left:n.right,s=r+i.outerWidth,a=Math.floor(r/this.columnWidth);a=Math.max(0,a);var h=Math.floor(s/this.columnWidth);h-=s%this.columnWidth?0:1,h=Math.min(this.cols-1,h);for(var u=this._getOption("originTop"),d=(u?n.top:n.bottom)+i.outerHeight,l=a;h>=l;l++)this.colYs[l]=Math.max(d,this.colYs[l])},n._getContainerSize=function(){this.maxY=Math.max.apply(Math,this.colYs);var t={height:this.maxY};return this._getOption("fitWidth")&&(t.width=this._getContainerFitWidth()),t},n._getContainerFitWidth=function(){for(var t=0,e=this.cols;--e&&0===this.colYs[e];)t++;return(this.cols-t)*this.columnWidth-this.gutter},n.needsResizeLayout=function(){var t=this.containerWidth;return this.getContainerWidth(),t!=this.containerWidth},i}); \ No newline at end of file diff --git a/plot1qbit/report_maker/output.py b/plot1qbit/report_maker/output.py new file mode 100644 index 0000000..037b358 --- /dev/null +++ b/plot1qbit/report_maker/output.py @@ -0,0 +1,268 @@ +##### +#https://stackoverflow.com/a/49016797 +import io +import os +import base64 +import datetime +import matplotlib.pyplot as plt + +from plot1qbit.initiate import newc + +import logging +import os +import re, json + +special = {"*":"red","|":"green","^":"orange","!":"yellow"} + +def code(s): + for key in special.keys(): + s = s.replace(key, "") + return s + +def color_override(codename): + for key in special.keys(): + if key in codename: + return special[key] + +def alpha_override(codename): + if '/' in codename: + return 0.8 #a comparison + else: + return 0.8 + +def linestyle_override(codename): + if '/' in codename: # a comparison + return 'solid' + else: + return 'solid' + +def linewidth_override(codename): + if '/' in codename: #a comparison + return 1.0 + else: + return 2.0 + +def resolve_read_params_json(s): + f = re.sub("_[0-9]*_","_",s) + logging.info("Reading learning parameters file: {f}") + return json.loads(open(f,"r").read()) + +def gif_to_html(filename, full_wide=False): + with open(filename, 'rb') as F: + bytes = F.read() + + encoded = base64.b64encode(bytes) + + wide = "fullwidth" if full_wide else "onethird" + #url=f"data:image/svg+xml;base64, {encoded.decode('utf-8')}" + url=f"data:image/gif;base64, {encoded.decode('utf-8')}" + html = f"""
+ + + +
""" + return html + + + +def fig_to_html(fig, full_wide=False): + if isinstance(fig, plt.Figure): + img = io.BytesIO() + fig.savefig(img, format='png', + bbox_inches='tight', + dpi=100) + img.seek(0) + plt.close(fig) + + encoded = base64.b64encode(img.getvalue()) + + + wide = "fullwidth" if full_wide else "onethird" + #url=f"data:image/svg+xml;base64, {encoded.decode('utf-8')}" + url=f"data:image/png;base64, {encoded.decode('utf-8')}" + html = f"""
+ + + +
""" + return html + else: + print("Argument fig must be of type matplotlib.pyplot.Figure") + raise NotImplementedError + +def dict_to_table(info): + from tabulate import tabulate + content = f"""
""" + content += tabulate(info.items(), tablefmt='html') + content += "
" + return content + +class TabCollection(object): + def __init__(self, name): + self.tabs = {} + self.tab_order = [] + self.collection_name = name + + self._o_collection_name = f"

{self.collection_name}

" + self._o_start_tab_collection = "
" + self._o_end_tab_collection = "
" + self._o_enddiv = "" + self._o_end_tab = "" + self._o_br = "
" + + def _compute_dynamic_strings(self): + self._o_start_first_tab = f"
" + self._o_start_subsequent_tab = f"
" + + def _o_tab_name(self, name): + return f"

{code(name)}

" + + @property + def header(self): + return "" + + def new_tab(self, name): + self.tab_order.append(name) + self.tabs[name] = [] + + def add_to_tab(self, item, tab_name=None): + if tab_name is None: + tab_name = self.tab_order[-1] + #If it's a plot, convert to HTML + if isinstance(item, plt.Figure): + item = fig_to_html(item, full_wide=True) + + if isinstance(item, dict): + item = dict_to_table(item) + + + + if isinstance(item, str) and item[-4:]==".gif": + item = gif_to_html(item) + + + self.tabs[tab_name].append(item) + + + def write(self): + self._compute_dynamic_strings() + s = "" + s += self._o_collection_name + s += self._o_start_tab_collection + + for ix,tab in enumerate(self.tab_order): + if ix==0: + s+=self._o_start_first_tab + else: + s+=self._o_start_subsequent_tab + s+= self._o_tab_name(name=tab) + for item in self.tabs[tab]: + s+=item + s+=self._o_end_tab + + s += self._o_end_tab_collection + s += self._o_br + return s + + +class Report(object): + def __init__(self, name, info={}): + self.info = info + self.content = [] + self.name = name + + def new_tab_collection(self, name): + return TabCollection(name) + + @property + def _o_header(self): + + head = "" + + with open("/".join(__file__.split('/')[:-1]) + '/style.css', 'r') as C: + head+= "" + + with open("/".join(__file__.split('/')[:-1]) + '/jquery-3.6.0.min.js', 'r') as C: + head+= "" + + with open("/".join(__file__.split('/')[:-1]) + '/lightbox.min.css', 'r') as C: + head+= "" + + with open("/".join(__file__.split('/')[:-1]) + '/masonry.pkgd.min.js', 'r') as C: + head+= "" + + + head += """ + + \n""" + return head + + def add_plot(self, plot): + self.content.append(fig_to_html(plot)) + + def add_content(self, content): + if isinstance(content, TabCollection): + #if a TabCollection instance is passed, call its write method. + self.content.append(content.write()) + elif isinstance(content, plt.Figure): + self.add_plot(plot=content) + else: + self.content.append(content) + + def write(self): + os.makedirs("./reports", exist_ok=True) + with open(f'./reports/report_{self.name}.html', 'w') as F: + F.write("\n") + F.write(self._o_header) + F.write("\n\n") + + F.write(f"""

{self.name}

+

{self.info.get('description','')}

+
""") + + from tabulate import tabulate + F.write("""

Information

+
""") + F.write(tabulate(self.info.items(), tablefmt='html')) + F.write("
") + + + + for c in self.content: + F.write(c) + + + F.write(f"
Report generated on {datetime.datetime.now().strftime('%A, %b %d, %Y at %H:%M:%S')}.
") + with open("/".join(__file__.split('/')[:-1]) + '/lightbox.min.js', 'r') as C: + F.write("") + F.write("""""") + F.write('') + + diff --git a/plot1qbit/report_maker/style.css b/plot1qbit/report_maker/style.css new file mode 100644 index 0000000..808f0ac --- /dev/null +++ b/plot1qbit/report_maker/style.css @@ -0,0 +1,96 @@ +body { + background-color:#F5FCFF; + font-family: "Brandon", "Brandon Text", sans-serif; + margin:auto; +} + +hr { + width:50%; + margin:auto; + margin-top:20px; + margin-bottom:20px; +} + + + +h1,h2,h3 { + text-align:center; + font-weight: normal; + margin: 0; + padding: 10px; +} + +tr:nth-child(even){background-color: #E6EEF4} +tr:nth-child(odd){background-color: #E1EFF9;} +td { + padding:5px; + padding-left:10px; + padding-right:10px; +} + +table { + margin-left:auto; + margin-right:auto +} + +.tabcollection { + margin:auto; +} + +.tabcollectionparent{ + margin: 10px; + background-color: #E7EFF5; + border: 2px solid #79858E; +} + +.collectionname { + background-color: #E7EFF5; +} + +.singletab { + min-width:300px; + border: solid 2px #5C97CF; + border-radius: 5px; + background-color: #f5fcff; + margin: 5px; + /* display:inline-block; */ +} + +.firsttab { + float: left; +} +.subsequenttab { +} + +.onethird { + max-width: 700px; +} +.fullwidth { + max-width: 400px; +} + +.plotcontainer { + padding:3px; + margin: auto; +} + +.grow { transition: all .2s ease-in-out; } +.grow:hover { transform: scale(1.5); display: block;} + + +.textline { + max-width: 30%; + padding: 3px; + margin:auto; +} + +.center { + text-align: center; +} + +.title { + padding: 3px; + font-size: 200%; +} + + From 20d576d6d3ce872f271b4382cf493466bdd84699 Mon Sep 17 00:00:00 2001 From: Kyle Mills Date: Mon, 16 Jan 2023 19:53:31 +0000 Subject: [PATCH 05/13] updated report javascript; fixed jquery transition timing leading to misshapen divs --- plot1qbit/report_maker/output.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plot1qbit/report_maker/output.py b/plot1qbit/report_maker/output.py index 037b358..3f93edb 100644 --- a/plot1qbit/report_maker/output.py +++ b/plot1qbit/report_maker/output.py @@ -199,15 +199,17 @@ def _o_header(self): var $container = $('.tabcollection'); $container.masonry('reloadItems'); $container.masonry(); - },500); + },100); + + } $(document).ready(function(){ $('.collectionname').click(function() { - $(this).siblings().toggle('slide'); + $(this).siblings().toggle(50); masonryUpdate(); }); $('.tabname').click(function() { - $(this).siblings().toggle('slide'); + $(this).siblings().toggle(50); masonryUpdate(); }); $('.tabcollection').masonry({ From ec7ecf2b8a56a390cbf3a1a1328c3e47e8b7abb0 Mon Sep 17 00:00:00 2001 From: Kyle Mills Date: Mon, 16 Jan 2023 19:53:56 +0000 Subject: [PATCH 06/13] updated setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 65140fb..69faffc 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup setup( name='Plot1Qbit', - version='0.18', + version='0.19', author='Kyle Mills', author_email="kyle.mills@uoit.net", description="Set matplotlib style to conform with 1QBit's brand policies", From bf21f0d33ed486a3cdc99ffdff348d73b3831bd4 Mon Sep 17 00:00:00 2001 From: Kyle Mills Date: Tue, 21 Feb 2023 18:16:14 +0000 Subject: [PATCH 07/13] fixed missing package in setup.pu --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 69faffc..e912b85 100644 --- a/setup.py +++ b/setup.py @@ -1,11 +1,11 @@ from setuptools import setup setup( name='Plot1Qbit', - version='0.19', + version='0.20', author='Kyle Mills', author_email="kyle.mills@uoit.net", description="Set matplotlib style to conform with 1QBit's brand policies", - packages=['plot1qbit'], + packages=['plot1qbit', 'plot1qbit.report_maker'], install_requires=['tabulate', 'matplotlib>=3.1.0', 'gif', 'tqdm', 'numpy'], include_package_data=True ) From 164c04f14c345c6778076e97f21e6a572a32b123 Mon Sep 17 00:00:00 2001 From: Kyle Mills Date: Wed, 29 Mar 2023 18:15:04 +0000 Subject: [PATCH 08/13] Added rainbow function ( plot1qbit.rainbow() ) to get a more diverse colour cycler --- plot1qbit/__init__.py | 1 + plot1qbit/initiate.py | 8 ++++++++ setup.py | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/plot1qbit/__init__.py b/plot1qbit/__init__.py index 1f37a0d..f599661 100644 --- a/plot1qbit/__init__.py +++ b/plot1qbit/__init__.py @@ -1,3 +1,4 @@ import plot1qbit.initiate +from plot1qbit.initiate import rainbow from plot1qbit.util import plot_to_gif import plot1qbit.report_maker diff --git a/plot1qbit/initiate.py b/plot1qbit/initiate.py index c2c54cc..08d318b 100644 --- a/plot1qbit/initiate.py +++ b/plot1qbit/initiate.py @@ -3,6 +3,12 @@ import os import matplotlib import numpy as np +from cycler import cycler + + +def rainbow(): + rainbow_cycler = cycler(color=['red','orange','yellow','green','blue','magenta','purple', 'violet', 'darkblue','cyan']) + plt.rc('axes', prop_cycle=rainbow_cycler) here=os.path.abspath(__file__).replace("initiate.py","") @@ -46,3 +52,5 @@ plt.register_cmap('1qbit5', flag5) + + diff --git a/setup.py b/setup.py index e912b85..3f81e44 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup setup( name='Plot1Qbit', - version='0.20', + version='0.21', author='Kyle Mills', author_email="kyle.mills@uoit.net", description="Set matplotlib style to conform with 1QBit's brand policies", From 2bc6607ec7b1c41ea11e8fdab6fbbcb43d8f0b98 Mon Sep 17 00:00:00 2001 From: Kyle Mills Date: Fri, 31 Mar 2023 19:59:41 +0000 Subject: [PATCH 09/13] added pyplot to init for single-line invokation --- plot1qbit/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plot1qbit/__init__.py b/plot1qbit/__init__.py index f599661..8c4c0ba 100644 --- a/plot1qbit/__init__.py +++ b/plot1qbit/__init__.py @@ -1,3 +1,4 @@ +import matplotlib.pyplot as pyplot import plot1qbit.initiate from plot1qbit.initiate import rainbow from plot1qbit.util import plot_to_gif From 6805bdf501263a9eb16964bd657ed3d9d9734208 Mon Sep 17 00:00:00 2001 From: Kyle Mills Date: Fri, 31 Mar 2023 20:03:54 +0000 Subject: [PATCH 10/13] added plot1qbit.blue() (and aliases) to revert from rainbow --- plot1qbit/__init__.py | 2 +- plot1qbit/initiate.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/plot1qbit/__init__.py b/plot1qbit/__init__.py index 8c4c0ba..a92d315 100644 --- a/plot1qbit/__init__.py +++ b/plot1qbit/__init__.py @@ -1,5 +1,5 @@ import matplotlib.pyplot as pyplot import plot1qbit.initiate -from plot1qbit.initiate import rainbow +from plot1qbit.initiate import rainbow, blue, blues, 1qbit, default from plot1qbit.util import plot_to_gif import plot1qbit.report_maker diff --git a/plot1qbit/initiate.py b/plot1qbit/initiate.py index 08d318b..350e928 100644 --- a/plot1qbit/initiate.py +++ b/plot1qbit/initiate.py @@ -10,6 +10,14 @@ def rainbow(): rainbow_cycler = cycler(color=['red','orange','yellow','green','blue','magenta','purple', 'violet', 'darkblue','cyan']) plt.rc('axes', prop_cycle=rainbow_cycler) +def blue(): + blue_cycler= cycler(color=['00aeef','1c2b39','0075bc','72808a','67cdf2','003262']) + plt.rc('axes', prop_cycle=blue_cycler) + +blues = blue +default = blue +1qbit = blue + here=os.path.abspath(__file__).replace("initiate.py","") From 7052931e368a8ae6d619c177fda36c74b3ed716e Mon Sep 17 00:00:00 2001 From: Kyle Mills Date: Fri, 31 Mar 2023 20:04:59 +0000 Subject: [PATCH 11/13] 1qbit --> qbit; invalid name --- plot1qbit/__init__.py | 2 +- plot1qbit/initiate.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plot1qbit/__init__.py b/plot1qbit/__init__.py index a92d315..17a6a35 100644 --- a/plot1qbit/__init__.py +++ b/plot1qbit/__init__.py @@ -1,5 +1,5 @@ import matplotlib.pyplot as pyplot import plot1qbit.initiate -from plot1qbit.initiate import rainbow, blue, blues, 1qbit, default +from plot1qbit.initiate import rainbow, blue, blues, qbit, default from plot1qbit.util import plot_to_gif import plot1qbit.report_maker diff --git a/plot1qbit/initiate.py b/plot1qbit/initiate.py index 350e928..88d98da 100644 --- a/plot1qbit/initiate.py +++ b/plot1qbit/initiate.py @@ -16,7 +16,7 @@ def blue(): blues = blue default = blue -1qbit = blue +qbit = blue here=os.path.abspath(__file__).replace("initiate.py","") From f876bec7fe46be027ceebd95301cbfa21f75e978 Mon Sep 17 00:00:00 2001 From: Kyle Mills Date: Mon, 3 Apr 2023 19:10:51 +0000 Subject: [PATCH 12/13] added ImageGrid class --- plot1qbit/util.py | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/plot1qbit/util.py b/plot1qbit/util.py index ab4c509..24e2135 100644 --- a/plot1qbit/util.py +++ b/plot1qbit/util.py @@ -1,5 +1,48 @@ import matplotlib.pyplot as plt import gif +import numpy as np + +class ImageGrid(): + + """Simple method to hold an NxM grid of sx x sy images. + + Example: + + N=5 + M=4 + + digits_img = ImgArray(N, M, 8, 8) + + counter = 0 + + for i in range(N): + for j in range(M): + digits_img.insert(i, j, np.ones((8,8))*counter) + counter += 1 + + plt.imshow(digits_img.img) + + """ + + def __init__(self, N, M, sx, sy, negative_space_value=np.nan): + self.Nx = N + self.Ny = M + self.sx = sx + self.sy = sy + + self._img = np.zeros((N*sx + N + 1, M*sy + M + 1)) + negative_space_value + + def insert(self, i, j, data): + assert data.shape[0] == self.sx, f"Unexpected width. Got {data.shape[0]}. Expected {self.sx}." + assert data.shape[1] == self.sy, f"Unexpected height. Got {data.shape[1]}. Expected {self.sy}." + self._img[1+i*(self.sx+1):1+i*(self.sx+1)+self.sx, 1+j*(self.sy+1):1+j*(self.sy+1)+self.sy] = data + + def get(self): + return self._img + + @property + def img(self): + return self.get() From de4408bedb0a578373ad4875511348804bed1c66 Mon Sep 17 00:00:00 2001 From: Kyle Mills Date: Mon, 3 Apr 2023 19:11:15 +0000 Subject: [PATCH 13/13] increment version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 3f81e44..ee32b7f 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup setup( name='Plot1Qbit', - version='0.21', + version='0.22', author='Kyle Mills', author_email="kyle.mills@uoit.net", description="Set matplotlib style to conform with 1QBit's brand policies",