2022-2023/templates/tpl_evaluation.ipynb

1278 lines
3.6 MiB
Plaintext
Raw Normal View History

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "25b1d95f",
"metadata": {
"execution": {
"iopub.execute_input": "2021-11-26T20:53:46.935577Z",
"iopub.status.busy": "2021-11-26T20:53:46.935147Z",
"iopub.status.idle": "2021-11-26T20:53:47.485029Z",
"shell.execute_reply": "2021-11-26T20:53:47.485365Z"
},
"extensions": {
"jupyter_dashboards": {
"version": 1,
"views": {
"grid_default": {},
"report_default": {
"hidden": true
}
}
}
},
"papermill": {
"duration": 0.595111,
"end_time": "2021-11-26T20:53:47.485528",
"exception": false,
"start_time": "2021-11-26T20:53:46.890417",
"status": "completed"
},
"slideshow": {
"slide_type": "skip"
},
"tags": []
},
"outputs": [
{
"data": {
"text/html": [
" <script type=\"text/javascript\">\n",
" window.PlotlyConfig = {MathJaxConfig: 'local'};\n",
" if (window.MathJax) {MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});}\n",
" if (typeof require !== 'undefined') {\n",
" require.undef(\"plotly\");\n",
" define('plotly', function(require, exports, module) {\n",
" /**\n",
"* plotly.js v2.4.2\n",
"* Copyright 2012-2021, Plotly, Inc.\n",
"* All rights reserved.\n",
"* Licensed under the MIT license\n",
"*/\n",
"!function(t){if(\"object\"==typeof exports&&\"undefined\"!=typeof module)module.exports=t();else if(\"function\"==typeof define&&define.amd)define([],t);else{(\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof self?self:this).Plotly=t()}}((function(){return function t(e,r,n){function i(o,s){if(!r[o]){if(!e[o]){var l=\"function\"==typeof require&&require;if(!s&&l)return l(o,!0);if(a)return a(o,!0);var c=new Error(\"Cannot find module '\"+o+\"'\");throw c.code=\"MODULE_NOT_FOUND\",c}var u=r[o]={exports:{}};e[o][0].call(u.exports,(function(t){return i(e[o][1][t]||t)}),u,u.exports,t,e,r,n)}return r[o].exports}for(var a=\"function\"==typeof require&&require,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(t,e,r){\"use strict\";var n=t(\"../src/lib\"),i={\"X,X div\":'direction:ltr;font-family:\"Open Sans\",verdana,arial,sans-serif;margin:0;padding:0;',\"X input,X button\":'font-family:\"Open Sans\",verdana,arial,sans-serif;',\"X input:focus,X button:focus\":\"outline:none;\",\"X a\":\"text-decoration:none;\",\"X a:hover\":\"text-decoration:none;\",\"X .crisp\":\"shape-rendering:crispEdges;\",\"X .user-select-none\":\"-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;\",\"X svg\":\"overflow:hidden;\",\"X svg a\":\"fill:#447adb;\",\"X svg a:hover\":\"fill:#3c6dc5;\",\"X .main-svg\":\"position:absolute;top:0;left:0;pointer-events:none;\",\"X .main-svg .draglayer\":\"pointer-events:all;\",\"X .cursor-default\":\"cursor:default;\",\"X .cursor-pointer\":\"cursor:pointer;\",\"X .cursor-crosshair\":\"cursor:crosshair;\",\"X .cursor-move\":\"cursor:move;\",\"X .cursor-col-resize\":\"cursor:col-resize;\",\"X .cursor-row-resize\":\"cursor:row-resize;\",\"X .cursor-ns-resize\":\"cursor:ns-resize;\",\"X .cursor-ew-resize\":\"cursor:ew-resize;\",\"X .cursor-sw-resize\":\"cursor:sw-resize;\",\"X .cursor-s-resize\":\"cursor:s-resize;\",\"X .cursor-se-resize\":\"cursor:se-resize;\",\"X .cursor-w-resize\":\"cursor:w-resize;\",\"X .cursor-e-resize\":\"cursor:e-resize;\",\"X .cursor-nw-resize\":\"cursor:nw-resize;\",\"X .cursor-n-resize\":\"cursor:n-resize;\",\"X .cursor-ne-resize\":\"cursor:ne-resize;\",\"X .cursor-grab\":\"cursor:-webkit-grab;cursor:grab;\",\"X .modebar\":\"position:absolute;top:2px;right:2px;\",\"X .ease-bg\":\"-webkit-transition:background-color .3s ease 0s;-moz-transition:background-color .3s ease 0s;-ms-transition:background-color .3s ease 0s;-o-transition:background-color .3s ease 0s;transition:background-color .3s ease 0s;\",\"X .modebar--hover>:not(.watermark)\":\"opacity:0;-webkit-transition:opacity .3s ease 0s;-moz-transition:opacity .3s ease 0s;-ms-transition:opacity .3s ease 0s;-o-transition:opacity .3s ease 0s;transition:opacity .3s ease 0s;\",\"X:hover .modebar--hover .modebar-group\":\"opacity:1;\",\"X .modebar-group\":\"float:left;display:inline-block;box-sizing:border-box;padding-left:8px;position:relative;vertical-align:middle;white-space:nowrap;\",\"X .modebar-btn\":\"position:relative;font-size:16px;padding:3px 4px;height:22px;cursor:pointer;line-height:normal;box-sizing:border-box;\",\"X .modebar-btn svg\":\"position:relative;top:2px;\",\"X .modebar.vertical\":\"display:flex;flex-direction:column;flex-wrap:wrap;align-content:flex-end;max-height:100%;\",\"X .modebar.vertical svg\":\"top:-1px;\",\"X .modebar.vertical .modebar-group\":\"display:block;float:none;padding-left:0px;padding-bottom:8px;\",\"X .modebar.vertical .modebar-group .modebar-btn\":\"display:block;text-align:center;\",\"X [data-title]:before,X [data-title]:after\":\"position:absolute;-webkit-transform:translate3d(0, 0, 0);-moz-transform:translate3d(0, 0, 0);-ms-transform:translate3d(0, 0, 0);-o-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0);display:none;opacity:0;z-index:1001;pointer-events:none;top:110%;right:50%;\",\"X [data-title]:hover:before,X [data-title]:hover:after\":\"display:block;opacity:1;\",\"X [data-title]:before\":'content:\"\";position:absolute;background:transparent;border:6px solid transparent;z-index:10
"/*!\n",
" * The buffer module from node.js, for the browser.\n",
" *\n",
" * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>\n",
" * @license MIT\n",
" */function i(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,a=Math.min(r,n);i<a;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0}function a(t){return r.Buffer&&\"function\"==typeof r.Buffer.isBuffer?r.Buffer.isBuffer(t):!(null==t||!t._isBuffer)}var o=t(\"util/\"),s=Object.prototype.hasOwnProperty,l=Array.prototype.slice,c=\"foo\"===function(){}.name;function u(t){return Object.prototype.toString.call(t)}function f(t){return!a(t)&&(\"function\"==typeof r.ArrayBuffer&&(\"function\"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):!!t&&(t instanceof DataView||!!(t.buffer&&t.buffer instanceof ArrayBuffer))))}var h=e.exports=y,p=/\\s*function\\s+([^\\(\\s]*)\\s*/;function d(t){if(o.isFunction(t)){if(c)return t.name;var e=t.toString().match(p);return e&&e[1]}}function g(t,e){return\"string\"==typeof t?t.length<e?t:t.slice(0,e):t}function m(t){if(c||!o.isFunction(t))return o.inspect(t);var e=d(t);return\"[Function\"+(e?\": \"+e:\"\")+\"]\"}function v(t,e,r,n,i){throw new h.AssertionError({message:r,actual:t,expected:e,operator:n,stackStartFunction:i})}function y(t,e){t||v(t,!0,e,\"==\",h.ok)}function x(t,e,r,n){if(t===e)return!0;if(a(t)&&a(e))return 0===i(t,e);if(o.isDate(t)&&o.isDate(e))return t.getTime()===e.getTime();if(o.isRegExp(t)&&o.isRegExp(e))return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase;if(null!==t&&\"object\"==typeof t||null!==e&&\"object\"==typeof e){if(f(t)&&f(e)&&u(t)===u(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===i(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(a(t)!==a(e))return!1;var s=(n=n||{actual:[],expected:[]}).actual.indexOf(t);return-1!==s&&s===n.expected.indexOf(e)||(n.actual.push(t),n.expected.push(e),function(t,e,r,n){if(null==t||null==e)return!1;if(o.isPrimitive(t)||o.isPrimitive(e))return t===e;if(r&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;var i=b(t),a=b(e);if(i&&!a||!i&&a)return!1;if(i)return t=l.call(t),e=l.call(e),x(t,e,r);var s,c,u=T(t),f=T(e);if(u.length!==f.length)return!1;for(u.sort(),f.sort(),c=u.length-1;c>=0;c--)if(u[c]!==f[c])return!1;for(c=u.length-1;c>=0;c--)if(s=u[c],!x(t[s],e[s],r,n))return!1;return!0}(t,e,r,n))}return r?t===e:t==e}function b(t){return\"[object Arguments]\"==Object.prototype.toString.call(t)}function _(t,e){if(!t||!e)return!1;if(\"[object RegExp]\"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function w(t,e,r,n){var i;if(\"function\"!=typeof e)throw new TypeError('\"block\" argument must be a function');\"string\"==typeof r&&(n=r,r=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),n=(r&&r.name?\" (\"+r.name+\").\":\".\")+(n?\" \"+n:\".\"),t&&!i&&v(i,r,\"Missing expected exception\"+n);var a=\"string\"==typeof n,s=!t&&i&&!r;if((!t&&o.isError(i)&&a&&_(i,r)||s)&&v(i,r,\"Got unwanted exception\"+n),t&&i&&r&&!_(i,r)||!t&&i)throw i}h.AssertionError=function(t){this.name=\"AssertionError\",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return g(m(t.actual),128)+\" \"+t.operator+\" \"+g(m(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||v;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=d(e),a=n.indexOf(\"\\n\"+i);if(a>=0){var o=n.indexOf(\"\\n\",a+1);n=n.substring(o+1)}this.stack=n}}},o.inherits(h.AssertionError,Error),h.fail=v,h.ok=y,h.equal=function(t,e,r){t!=e&&v(t,e,r,\"==\",h.equal)},h.notEqual=function(t,e,r){t==e&&v(t,e,r,\"!=\",h.notEqual)},h.deepEqual=function(t,e,r){x(t,e,!1)||v(t,e,r,\"deepEqual\",h.deepEqual)},h.deepStrictEqual=function(t,e,r){x(t,e,!0)||v(t,e,r,\"deepStrictEqual\",h.deepStrictEqual)},h.notDeepEqual=function(t,e,r){x(t,e,!1)&&v(t,e,r,\"notDeepEqual\",h.notDeepEqual)},h.notDeepStrictEqual=function t(e,r,n){x(e,r,!0)&&v(e,r,n,\"notDeepStrictEqual\",t)},h.strictEqual=function(t,e
"/*!\n",
" * The buffer module from node.js, for the browser.\n",
" *\n",
" * @author Feross Aboukhadijeh <https://feross.org>\n",
" * @license MIT\n",
" */\n",
"\"use strict\";var e=t(\"base64-js\"),n=t(\"ieee754\");r.Buffer=a,r.SlowBuffer=function(t){+t!=t&&(t=0);return a.alloc(+t)},r.INSPECT_MAX_BYTES=50;function i(t){if(t>2147483647)throw new RangeError('The value \"'+t+'\" is invalid for option \"size\"');var e=new Uint8Array(t);return e.__proto__=a.prototype,e}function a(t,e,r){if(\"number\"==typeof t){if(\"string\"==typeof e)throw new TypeError('The \"string\" argument must be of type string. Received type number');return l(t)}return o(t,e,r)}function o(t,e,r){if(\"string\"==typeof t)return function(t,e){\"string\"==typeof e&&\"\"!==e||(e=\"utf8\");if(!a.isEncoding(e))throw new TypeError(\"Unknown encoding: \"+e);var r=0|f(t,e),n=i(r),o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return c(t);if(null==t)throw TypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \"+typeof t);if(B(t,ArrayBuffer)||t&&B(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('\"offset\" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('\"length\" is outside of buffer bounds');var n;n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r);return n.__proto__=a.prototype,n}(t,e,r);if(\"number\"==typeof t)throw new TypeError('The \"value\" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return a.from(n,e,r);var o=function(t){if(a.isBuffer(t)){var e=0|u(t.length),r=i(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return\"number\"!=typeof t.length||N(t.length)?i(0):c(t);if(\"Buffer\"===t.type&&Array.isArray(t.data))return c(t.data)}(t);if(o)return o;if(\"undefined\"!=typeof Symbol&&null!=Symbol.toPrimitive&&\"function\"==typeof t[Symbol.toPrimitive])return a.from(t[Symbol.toPrimitive](\"string\"),e,r);throw new TypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \"+typeof t)}function s(t){if(\"number\"!=typeof t)throw new TypeError('\"size\" argument must be of type number');if(t<0)throw new RangeError('The value \"'+t+'\" is invalid for option \"size\"')}function l(t){return s(t),i(t<0?0:0|u(t))}function c(t){for(var e=t.length<0?0:0|u(t.length),r=i(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function u(t){if(t>=2147483647)throw new RangeError(\"Attempt to allocate Buffer larger than maximum size: 0x\"+2147483647..toString(16)+\" bytes\");return 0|t}function f(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||B(t,ArrayBuffer))return t.byteLength;if(\"string\"!=typeof t)throw new TypeError('The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case\"ascii\":case\"latin1\":case\"binary\":return r;case\"utf8\":case\"utf-8\":return D(t).length;case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return 2*r;case\"hex\":return r>>>1;case\"base64\":return R(t).length;default:if(i)return n?-1:D(t).length;e=(\"\"+e).toLowerCase(),i=!0}}function h(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return\"\";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return\"\";if((r>>>=0)<=(e>>>=0))return\"\";for(t||(t=\"utf8\");;)switch(t){case\"hex\":return M(this,e,r);case\"utf8\":case\"utf-8\":return T(this,e,r);case\"ascii\":return k(this,e,r);case\"latin1\":case\"binary\":return A(this,e,r);case\"base64\":return w(this,e,r);case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return S(this,e,r);default:if(n)throw new TypeError(\"Unknown encoding: \"+t);t=(t+\"\").toLowerCase(),n=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function d(t,e,r,n,i){if(0===t.length)return-1;if(\"string\"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),N(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}i
"/*!\n",
" * Determine if an object is a Buffer\n",
" *\n",
" * @author Feross Aboukhadijeh <https://feross.org>\n",
" * @license MIT\n",
" */\n",
"e.exports=function(t){return null!=t&&(n(t)||function(t){return\"function\"==typeof t.readFloatLE&&\"function\"==typeof t.slice&&n(t.slice(0,0))}(t)||!!t._isBuffer)}},{}],454:[function(t,e,r){\"use strict\";e.exports=\"undefined\"!=typeof navigator&&(/MSIE/.test(navigator.userAgent)||/Trident\\//.test(navigator.appVersion))},{}],455:[function(t,e,r){\"use strict\";e.exports=a,e.exports.isMobile=a,e.exports.default=a;var n=/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series[46]0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,i=/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series[46]0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i;function a(t){t||(t={});var e=t.ua;if(e||\"undefined\"==typeof navigator||(e=navigator.userAgent),e&&e.headers&&\"string\"==typeof e.headers[\"user-agent\"]&&(e=e.headers[\"user-agent\"]),\"string\"!=typeof e)return!1;var r=t.tablet?i.test(e):n.test(e);return!r&&t.tablet&&t.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==e.indexOf(\"Macintosh\")&&-1!==e.indexOf(\"Safari\")&&(r=!0),r}},{}],456:[function(t,e,r){\"use strict\";e.exports=function(t){var e=typeof t;return null!==t&&(\"object\"===e||\"function\"===e)}},{}],457:[function(t,e,r){\"use strict\";var n=Object.prototype.toString;e.exports=function(t){var e;return\"[object Object]\"===n.call(t)&&(null===(e=Object.getPrototypeOf(t))||e===Object.getPrototypeOf({}))}},{}],458:[function(t,e,r){\"use strict\";e.exports=function(t){for(var e,r=t.length,n=0;n<r;n++)if(((e=t.charCodeAt(n))<9||e>13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(e<8192||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}},{}],459:[function(t,e,r){\"use strict\";e.exports=function(t){return\"string\"==typeof t&&(t=t.trim(),!!(/^[mzlhvcsqta]\\s*[-+.0-9][^mlhvzcsqta]+/i.test(t)&&/[\\dz]$/i.test(t)&&t.length>4))}},{}],460:[function(t,e,r){e.exports=function(t,e,r){return t*(1-r)+e*r}},{}],461:[function(t,e,r){!function(t,n){\"object\"==typeof r&&void 0!==e?e.exports=n():(t=t||self).mapboxgl=n()}(this,(function(){\"use strict\";var t,e,r;function n(n,i){if(t)if(e){var a=\"var sharedChunk = {}; (\"+t+\")(sharedChunk); (\"+e+\")(sharedChunk);\",o={};t(o),(r=i(o)).workerUrl=window.URL.createObjectURL(new Blob([a],{type:\"text/javascript\"}))}else e=i;else t=i}return n(0,(function(t){function e(t,e){return t(e={exports:{}},e.exports),e.exports}var r=n;function n(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=r,this.p2y=n}n.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},n.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},n.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},n.prototype.solveCurveX=function(t,e){var r,n,i,a,o;for(void 0===e&&(e=1e-6),i=t,o=0;o<8;o++){if(a=this.sampleCurveX(i)-t,Math.abs(a)<e)return i;var s=this.sampleCurveDerivativeX(i);if(Math.abs(s)<1e-6)break;i-=a/s}if((i=t)<(r=0))return r;if(i>(n=1))return n;for(;r<n;){if(a=this.sampleCurveX(i),Math.abs(a-t)<e)return i;t>a?r=i:n=i,i=.5*(n-r)+r}return i},n.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var i=a;function a(t,e){this.x=t,this.y=e}function o(t,e,n,i){var a=new r(t,e,n,i);return function(t){return a.solve(t)}}a.prototype={clone:function(){return new a(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t
"/*! Native Promise Only\n",
" v0.8.1 (c) Kyle Simpson\n",
" MIT License: http://getify.mit-license.org\n",
"*/\n",
"!function(t,r,n){r[t]=r[t]||n(),void 0!==e&&e.exports&&(e.exports=r[t])}(\"Promise\",void 0!==t?t:this,(function(){\"use strict\";var t,e,n,i=Object.prototype.toString,a=void 0!==r?function(t){return r(t)}:setTimeout;try{Object.defineProperty({},\"x\",{}),t=function(t,e,r,n){return Object.defineProperty(t,e,{value:r,writable:!0,configurable:!1!==n})}}catch(e){t=function(t,e,r){return t[e]=r,t}}function o(t,r){n.add(t,r),e||(e=a(n.drain))}function s(t){var e,r=typeof t;return null==t||\"object\"!=r&&\"function\"!=r||(e=t.then),\"function\"==typeof e&&e}function l(){for(var t=0;t<this.chain.length;t++)c(this,1===this.state?this.chain[t].success:this.chain[t].failure,this.chain[t]);this.chain.length=0}function c(t,e,r){var n,i;try{!1===e?r.reject(t.msg):(n=!0===e?t.msg:e.call(void 0,t.msg))===r.promise?r.reject(TypeError(\"Promise-chain cycle\")):(i=s(n))?i.call(n,r.resolve,r.reject):r.resolve(n)}catch(t){r.reject(t)}}function u(t){var e,r=this;if(!r.triggered){r.triggered=!0,r.def&&(r=r.def);try{(e=s(t))?o((function(){var n=new p(r);try{e.call(t,(function(){u.apply(n,arguments)}),(function(){f.apply(n,arguments)}))}catch(t){f.call(n,t)}})):(r.msg=t,r.state=1,r.chain.length>0&&o(l,r))}catch(t){f.call(new p(r),t)}}}function f(t){var e=this;e.triggered||(e.triggered=!0,e.def&&(e=e.def),e.msg=t,e.state=2,e.chain.length>0&&o(l,e))}function h(t,e,r,n){for(var i=0;i<e.length;i++)!function(i){t.resolve(e[i]).then((function(t){r(i,t)}),n)}(i)}function p(t){this.def=t,this.triggered=!1}function d(t){this.promise=t,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function g(t){if(\"function\"!=typeof t)throw TypeError(\"Not a function\");if(0!==this.__NPO__)throw TypeError(\"Not a promise\");this.__NPO__=1;var e=new d(this);this.then=function(t,r){var n={success:\"function\"!=typeof t||t,failure:\"function\"==typeof r&&r};return n.promise=new this.constructor((function(t,e){if(\"function\"!=typeof t||\"function\"!=typeof e)throw TypeError(\"Not a function\");n.resolve=t,n.reject=e})),e.chain.push(n),0!==e.state&&o(l,e),n.promise},this.catch=function(t){return this.then(void 0,t)};try{t.call(void 0,(function(t){u.call(e,t)}),(function(t){f.call(e,t)}))}catch(t){f.call(e,t)}}n=function(){var t,r,n;function i(t,e){this.fn=t,this.self=e,this.next=void 0}return{add:function(e,a){n=new i(e,a),r?r.next=n:t=n,r=n,n=void 0},drain:function(){var n=t;for(t=r=e=void 0;n;)n.fn.call(n.self),n=n.next}}}();var m=t({},\"constructor\",g,!1);return g.prototype=m,t(m,\"__NPO__\",0,!1),t(g,\"resolve\",(function(t){return t&&\"object\"==typeof t&&1===t.__NPO__?t:new this((function(e,r){if(\"function\"!=typeof e||\"function\"!=typeof r)throw TypeError(\"Not a function\");e(t)}))})),t(g,\"reject\",(function(t){return new this((function(e,r){if(\"function\"!=typeof e||\"function\"!=typeof r)throw TypeError(\"Not a function\");r(t)}))})),t(g,\"all\",(function(t){var e=this;return\"[object Array]\"!=i.call(t)?e.reject(TypeError(\"Not an array\")):0===t.length?e.resolve([]):new e((function(r,n){if(\"function\"!=typeof r||\"function\"!=typeof n)throw TypeError(\"Not a function\");var i=t.length,a=Array(i),o=0;h(e,t,(function(t,e){a[t]=e,++o===i&&r(a)}),n)}))})),t(g,\"race\",(function(t){var e=this;return\"[object Array]\"!=i.call(t)?e.reject(TypeError(\"Not an array\")):new e((function(r,n){if(\"function\"!=typeof r||\"function\"!=typeof n)throw TypeError(\"Not a function\");h(e,t,(function(t,e){r(e)}),n)}))})),g}))}).call(this)}).call(this,\"undefined\"!=typeof global?global:\"undefined\"!=typeof self?self:\"undefined\"!=typeof window?window:{},t(\"timers\").setImmediate)},{timers:597}],475:[function(t,e,r){\"use strict\";var n=t(\"typedarray-pool\");function i(t){return\"a\"+t}function a(t){return\"d\"+t}function o(t,e){return\"c\"+t+\"_\"+e}function s(t){return\"s\"+t}function l(t,e){return\"t\"+t+\"_\"+e}function c(t){return\"o\"+t}function u(t){return\"x\"+t}function f(t){return\"p\"+t}function h(t,e){return\"d\"+t+\"_\"+e}function p(t){return\"i\"+t}function d(t,e){return\"u\"+t+\"_\"+e}function g(t){return\"b\"+t}function m(t){return\
"/*\n",
"object-assign\n",
"(c) Sindre Sorhus\n",
"@license MIT\n",
"*/\n",
"\"use strict\";var n=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;function o(t){if(null==t)throw new TypeError(\"Object.assign cannot be called with null or undefined\");return Object(t)}e.exports=function(){try{if(!Object.assign)return!1;var t=new String(\"abc\");if(t[5]=\"de\",\"5\"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e[\"_\"+String.fromCharCode(r)]=r;if(\"0123456789\"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(\"\"))return!1;var n={};return\"abcdefghijklmnopqrst\".split(\"\").forEach((function(t){n[t]=t})),\"abcdefghijklmnopqrst\"===Object.keys(Object.assign({},n)).join(\"\")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,s,l=o(t),c=1;c<arguments.length;c++){for(var u in r=Object(arguments[c]))i.call(r,u)&&(l[u]=r[u]);if(n){s=n(r);for(var f=0;f<s.length;f++)a.call(r,s[f])&&(l[s[f]]=r[s[f]])}}return l}},{}],488:[function(t,e,r){\"use strict\";e.exports=function(t,e,r,n,i,a,o,s,l,c){var u=e+a+c;if(f>0){var f=Math.sqrt(u+1);t[0]=.5*(o-l)/f,t[1]=.5*(s-n)/f,t[2]=.5*(r-a)/f,t[3]=.5*f}else{var h=Math.max(e,a,c);f=Math.sqrt(2*h-u+1);e>=h?(t[0]=.5*f,t[1]=.5*(i+r)/f,t[2]=.5*(s+n)/f,t[3]=.5*(o-l)/f):a>=h?(t[0]=.5*(r+i)/f,t[1]=.5*f,t[2]=.5*(l+o)/f,t[3]=.5*(s-n)/f):(t[0]=.5*(n+s)/f,t[1]=.5*(o+l)/f,t[2]=.5*f,t[3]=.5*(r-i)/f)}return t}},{}],489:[function(t,e,r){\"use strict\";e.exports=function(t){var e=(t=t||{}).center||[0,0,0],r=t.rotation||[0,0,0,1],n=t.radius||1;e=[].slice.call(e,0,3),u(r=[].slice.call(r,0,4),r);var i=new f(r,e,Math.log(n));i.setDistanceLimits(t.zoomMin,t.zoomMax),(\"eye\"in t||\"up\"in t)&&i.lookAt(0,t.eye,t.center,t.up);return i};var n=t(\"filtered-vector\"),i=t(\"gl-mat4/lookAt\"),a=t(\"gl-mat4/fromQuat\"),o=t(\"gl-mat4/invert\"),s=t(\"./lib/quatFromFrame\");function l(t,e,r){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2))}function c(t,e,r,n){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2)+Math.pow(n,2))}function u(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=c(r,n,i,a);o>1e-6?(t[0]=r/o,t[1]=n/o,t[2]=i/o,t[3]=a/o):(t[0]=t[1]=t[2]=0,t[3]=1)}function f(t,e,r){this.radius=n([r]),this.center=n(e),this.rotation=n(t),this.computedRadius=this.radius.curve(0),this.computedCenter=this.center.curve(0),this.computedRotation=this.rotation.curve(0),this.computedUp=[.1,0,0],this.computedEye=[.1,0,0],this.computedMatrix=[.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.recalcMatrix(0)}var h=f.prototype;h.lastT=function(){return Math.max(this.radius.lastT(),this.center.lastT(),this.rotation.lastT())},h.recalcMatrix=function(t){this.radius.curve(t),this.center.curve(t),this.rotation.curve(t);var e=this.computedRotation;u(e,e);var r=this.computedMatrix;a(r,e);var n=this.computedCenter,i=this.computedEye,o=this.computedUp,s=Math.exp(this.computedRadius[0]);i[0]=n[0]+s*r[2],i[1]=n[1]+s*r[6],i[2]=n[2]+s*r[10],o[0]=r[1],o[1]=r[5],o[2]=r[9];for(var l=0;l<3;++l){for(var c=0,f=0;f<3;++f)c+=r[l+4*f]*i[f];r[12+l]=-c}},h.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;n<16;++n)e[n]=r[n];return e}return r},h.idle=function(t){this.center.idle(t),this.radius.idle(t),this.rotation.idle(t)},h.flush=function(t){this.center.flush(t),this.radius.flush(t),this.rotation.flush(t)},h.pan=function(t,e,r,n){e=e||0,r=r||0,n=n||0,this.recalcMatrix(t);var i=this.computedMatrix,a=i[1],o=i[5],s=i[9],c=l(a,o,s);a/=c,o/=c,s/=c;var u=i[0],f=i[4],h=i[8],p=u*a+f*o+h*s,d=l(u-=a*p,f-=o*p,h-=s*p);u/=d,f/=d,h/=d;var g=i[2],m=i[6],v=i[10],y=g*a+m*o+v*s,x=g*u+m*f+v*h,b=l(g-=y*a+x*u,m-=y*o+x*f,v-=y*s+x*h);g/=b,m/=b,v/=b;var _=u*e+a*r,w=f*e+o*r,T=h*e+s*r;this.center.move(t,_,w,T);var k=Math.exp(this.computedRadius[0]);k=Math.max(1e-4,k+n),this.radius.set(t,Math.log(k))},h.rotate=function(t,e,r,n){this.recalcMatrix(t),e=e||0,r=r||0;var i=this.computedMatrix,a=i[0],o=i[4],s=i[8],u=i[1],f=i[5],h=i[9],p=i[2],d=i[6],g=i[10],m=e*a+r*u,v=e*o+r*f,y=e*s+r*h,x=-(d*y-g*v),b=-(g*m-p*y),_=-(p*v-d*m),w=Math.sqrt(Math.max(0,1-Math.pow(x,2)-Math.pow(b,2)-Math.pow(_,2))),T=c(x,b,_,w);T>1e-6?(x/=T,b/=
"/*!\n",
" * pad-left <https://github.com/jonschlinkert/pad-left>\n",
" *\n",
" * Copyright (c) 2014-2015, Jon Schlinkert.\n",
" * Licensed under the MIT license.\n",
" */\n",
"\"use strict\";var n=t(\"repeat-string\");e.exports=function(t,e,r){return n(r=void 0!==r?r+\"\":\" \",e)+t}},{\"repeat-string\":541}],491:[function(t,e,r){\"use strict\";function n(t,e){if(\"string\"!=typeof t)return[t];var r=[t];\"string\"==typeof e||Array.isArray(e)?e={brackets:e}:e||(e={});var n=e.brackets?Array.isArray(e.brackets)?e.brackets:[e.brackets]:[\"{}\",\"[]\",\"()\"],i=e.escape||\"___\",a=!!e.flat;n.forEach((function(t){var e=new RegExp([\"\\\\\",t[0],\"[^\\\\\",t[0],\"\\\\\",t[1],\"]*\\\\\",t[1]].join(\"\")),n=[];function a(e,a,o){var s=r.push(e.slice(t[0].length,-t[1].length))-1;return n.push(s),i+s+i}r.forEach((function(t,n){for(var i,o=0;t!=i;)if(i=t,t=t.replace(e,a),o++>1e4)throw Error(\"References have circular dependency. Please, check them.\");r[n]=t})),n=n.reverse(),r=r.map((function(e){return n.forEach((function(r){e=e.replace(new RegExp(\"(\\\\\"+i+r+\"\\\\\"+i+\")\",\"g\"),t[0]+\"$1\"+t[1])})),e}))}));var o=new RegExp(\"\\\\\"+i+\"([0-9]+)\\\\\"+i);return a?r:function t(e,r,n){for(var i,a=[],s=0;i=o.exec(e);){if(s++>1e4)throw Error(\"Circular references in parenthesis\");a.push(e.slice(0,i.index)),a.push(t(r[i[1]],r)),e=e.slice(i.index+i[0].length)}return a.push(e),a}(r[0],r)}function i(t,e){if(e&&e.flat){var r,n=e&&e.escape||\"___\",i=t[0];if(!i)return\"\";for(var a=new RegExp(\"\\\\\"+n+\"([0-9]+)\\\\\"+n),o=0;i!=r;){if(o++>1e4)throw Error(\"Circular references in \"+t);r=i,i=i.replace(a,s)}return i}return t.reduce((function t(e,r){return Array.isArray(r)&&(r=r.reduce(t,\"\")),e+r}),\"\");function s(e,r){if(null==t[r])throw Error(\"Reference \"+r+\"is undefined\");return t[r]}}function a(t,e){return Array.isArray(t)?i(t,e):n(t,e)}a.parse=n,a.stringify=i,e.exports=a},{}],492:[function(t,e,r){\"use strict\";var n=t(\"pick-by-alias\");e.exports=function(t){var e;arguments.length>1&&(t=arguments);\"string\"==typeof t?t=t.split(/\\s/).map(parseFloat):\"number\"==typeof t&&(t=[t]);t.length&&\"number\"==typeof t[0]?e=1===t.length?{width:t[0],height:t[0],x:0,y:0}:2===t.length?{width:t[0],height:t[1],x:0,y:0}:{x:t[0],y:t[1],width:t[2]-t[0]||0,height:t[3]-t[1]||0}:t&&(t=n(t,{left:\"x l left Left\",top:\"y t top Top\",width:\"w width W Width\",height:\"h height W Width\",bottom:\"b bottom Bottom\",right:\"r right Right\"}),e={x:t.left||0,y:t.top||0},null==t.width?t.right?e.width=t.right-e.x:e.width=0:e.width=t.width,null==t.height?t.bottom?e.height=t.bottom-e.y:e.height=0:e.height=t.height);return e}},{\"pick-by-alias\":498}],493:[function(t,e,r){e.exports=function(t){var e=[];return t.replace(i,(function(t,r,i){var o=r.toLowerCase();for(i=function(t){var e=t.match(a);return e?e.map(Number):[]}(i),\"m\"==o&&i.length>2&&(e.push([r].concat(i.splice(0,2))),o=\"l\",r=\"m\"==r?\"l\":\"L\");;){if(i.length==n[o])return i.unshift(r),e.push(i);if(i.length<n[o])throw new Error(\"malformed path data\");e.push([r].concat(i.splice(0,n[o])))}})),e};var n={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},i=/([astvzqmhlc])([^astvzqmhlc]*)/gi;var a=/-?[0-9]*\\.?[0-9]+(?:e[-+]?\\d+)?/gi},{}],494:[function(t,e,r){e.exports=function(t,e){e||(e=[0,\"\"]),t=String(t);var r=parseFloat(t,10);return e[0]=r,e[1]=t.match(/[\\d.\\-\\+]*\\s*(.*)/)[1]||\"\",e}},{}],495:[function(t,e,r){(function(t){(function(){(function(){var r,n,i,a,o,s;\"undefined\"!=typeof performance&&null!==performance&&performance.now?e.exports=function(){return performance.now()}:null!=t&&t.hrtime?(e.exports=function(){return(r()-o)/1e6},n=t.hrtime,a=(r=function(){var t;return 1e9*(t=n())[0]+t[1]})(),s=1e9*t.uptime(),o=a-s):Date.now?(e.exports=function(){return Date.now()-i},i=Date.now()):(e.exports=function(){return(new Date).getTime()-i},i=(new Date).getTime())}).call(this)}).call(this)}).call(this,t(\"_process\"))},{_process:528}],496:[function(t,e,r){\"use strict\";e.exports=function(t){var e=t.length;if(e<32){for(var r=1,i=0;i<e;++i)for(var a=0;a<i;++a)if(t[i]<t[a])r=-r;else if(t[i]===t[a])return 0;return r}var o=n.mallocUint8(e);for(i=0;i<e;++i)o[i]=0;for(r=1,i=0;i<e;++i)if(!o[i]){var s=1;o[i]=1;for(a=t[i];a!==i;a=t[a]){if(o[a])return n.freeUint8(o),0;
"/*\n",
" * @copyright 2016 Sean Connelly (@voidqk), http://syntheti.cc\n",
" * @license MIT\n",
" * @preserve Project Home: https://github.com/voidqk/polybooljs\n",
" */\n",
"var n,i=t(\"./lib/build-log\"),a=t(\"./lib/epsilon\"),o=t(\"./lib/intersecter\"),s=t(\"./lib/segment-chainer\"),l=t(\"./lib/segment-selector\"),c=t(\"./lib/geojson\"),u=!1,f=a();function h(t,e,r){var i=n.segments(t),a=n.segments(e),o=r(n.combine(i,a));return n.polygon(o)}n={buildLog:function(t){return!0===t?u=i():!1===t&&(u=!1),!1!==u&&u.list},epsilon:function(t){return f.epsilon(t)},segments:function(t){var e=o(!0,f,u);return t.regions.forEach(e.addRegion),{segments:e.calculate(t.inverted),inverted:t.inverted}},combine:function(t,e){return{combined:o(!1,f,u).calculate(t.segments,t.inverted,e.segments,e.inverted),inverted1:t.inverted,inverted2:e.inverted}},selectUnion:function(t){return{segments:l.union(t.combined,u),inverted:t.inverted1||t.inverted2}},selectIntersect:function(t){return{segments:l.intersect(t.combined,u),inverted:t.inverted1&&t.inverted2}},selectDifference:function(t){return{segments:l.difference(t.combined,u),inverted:t.inverted1&&!t.inverted2}},selectDifferenceRev:function(t){return{segments:l.differenceRev(t.combined,u),inverted:!t.inverted1&&t.inverted2}},selectXor:function(t){return{segments:l.xor(t.combined,u),inverted:t.inverted1!==t.inverted2}},polygon:function(t){return{regions:s(t.segments,f,u),inverted:t.inverted}},polygonFromGeoJSON:function(t){return c.toPolygon(n,t)},polygonToGeoJSON:function(t){return c.fromPolygon(n,f,t)},union:function(t,e){return h(t,e,n.selectUnion)},intersect:function(t,e){return h(t,e,n.selectIntersect)},difference:function(t,e){return h(t,e,n.selectDifference)},differenceRev:function(t,e){return h(t,e,n.selectDifferenceRev)},xor:function(t,e){return h(t,e,n.selectXor)}},\"object\"==typeof window&&(window.PolyBool=n),e.exports=n},{\"./lib/build-log\":505,\"./lib/epsilon\":506,\"./lib/geojson\":507,\"./lib/intersecter\":508,\"./lib/segment-chainer\":510,\"./lib/segment-selector\":511}],505:[function(t,e,r){e.exports=function(){var t,e=0,r=!1;function n(e,r){return t.list.push({type:e,data:r?JSON.parse(JSON.stringify(r)):void 0}),t}return t={list:[],segmentId:function(){return e++},checkIntersection:function(t,e){return n(\"check\",{seg1:t,seg2:e})},segmentChop:function(t,e){return n(\"div_seg\",{seg:t,pt:e}),n(\"chop\",{seg:t,pt:e})},statusRemove:function(t){return n(\"pop_seg\",{seg:t})},segmentUpdate:function(t){return n(\"seg_update\",{seg:t})},segmentNew:function(t,e){return n(\"new_seg\",{seg:t,primary:e})},segmentRemove:function(t){return n(\"rem_seg\",{seg:t})},tempStatus:function(t,e,r){return n(\"temp_status\",{seg:t,above:e,below:r})},rewind:function(t){return n(\"rewind\",{seg:t})},status:function(t,e,r){return n(\"status\",{seg:t,above:e,below:r})},vert:function(e){return e===r?t:(r=e,n(\"vert\",{x:e}))},log:function(t){return\"string\"!=typeof t&&(t=JSON.stringify(t,!1,\" \")),n(\"log\",{txt:t})},reset:function(){return n(\"reset\")},selected:function(t){return n(\"selected\",{segs:t})},chainStart:function(t){return n(\"chain_start\",{seg:t})},chainRemoveHead:function(t,e){return n(\"chain_rem_head\",{index:t,pt:e})},chainRemoveTail:function(t,e){return n(\"chain_rem_tail\",{index:t,pt:e})},chainNew:function(t,e){return n(\"chain_new\",{pt1:t,pt2:e})},chainMatch:function(t){return n(\"chain_match\",{index:t})},chainClose:function(t){return n(\"chain_close\",{index:t})},chainAddHead:function(t,e){return n(\"chain_add_head\",{index:t,pt:e})},chainAddTail:function(t,e){return n(\"chain_add_tail\",{index:t,pt:e})},chainConnect:function(t,e){return n(\"chain_con\",{index1:t,index2:e})},chainReverse:function(t){return n(\"chain_rev\",{index:t})},chainJoin:function(t,e){return n(\"chain_join\",{index1:t,index2:e})},done:function(){return n(\"done\")}}}},{}],506:[function(t,e,r){e.exports=function(t){\"number\"!=typeof t&&(t=1e-10);var e={epsilon:function(e){return\"number\"==typeof e&&(t=e),t},pointAboveOrOnLine:function(e,r,n){var i=r[0],a=r[1],o=n[0],s=n[1],l=e[0];return(o-i)*(e[1]-a)-(s-a)*(l-i)>=-t},pointBetween:function(e,r,n){var i=e[1]-r[1],a=n[0]-r[0],o=e[0]-r[0],s=n[1]-r[1],l=o*a+i*s;return!(l<t)&&!(l-(a*a+s*s)>-t)},pointsSameX:function(e,r){r
"/*!\n",
" * repeat-string <https://github.com/jonschlinkert/repeat-string>\n",
" *\n",
" * Copyright (c) 2014-2015, Jon Schlinkert.\n",
" * Licensed under the MIT License.\n",
" */\n",
"\"use strict\";var n,i=\"\";e.exports=function(t,e){if(\"string\"!=typeof t)throw new TypeError(\"expected a string\");if(1===e)return t;if(2===e)return t+t;var r=t.length*e;if(n!==t||void 0===n)n=t,i=\"\";else if(i.length>=r)return i.substr(0,r);for(;r>i.length&&e>1;)1&e&&(i+=t),e>>=1,t+=t;return i=(i+=t).substr(0,r)}},{}],542:[function(t,e,r){(function(t){(function(){e.exports=t.performance&&t.performance.now?function(){return performance.now()}:Date.now||function(){return+new Date}}).call(this)}).call(this,\"undefined\"!=typeof global?global:\"undefined\"!=typeof self?self:\"undefined\"!=typeof window?window:{})},{}],543:[function(t,e,r){\"use strict\";e.exports=function(t){for(var e=t.length,r=t[t.length-1],n=e,i=e-2;i>=0;--i){var a=r,o=t[i];(l=o-((r=a+o)-a))&&(t[--n]=r,r=l)}var s=0;for(i=n;i<e;++i){var l;a=t[i];(l=(o=r)-((r=a+o)-a))&&(t[s++]=l)}return t[s++]=r,t.length=s,t}},{}],544:[function(t,e,r){\"use strict\";var n=t(\"two-product\"),i=t(\"robust-sum\"),a=t(\"robust-scale\"),o=t(\"robust-compress\");function s(t,e){for(var r=new Array(t.length-1),n=1;n<t.length;++n)for(var i=r[n-1]=new Array(t.length-1),a=0,o=0;a<t.length;++a)a!==e&&(i[o++]=t[n][a]);return r}function l(t){for(var e=new Array(t),r=0;r<t;++r){e[r]=new Array(t);for(var n=0;n<t;++n)e[r][n]=[\"m[\",r,\"][\",n,\"]\"].join(\"\")}return e}function c(t){if(2===t.length)return[\"sum(prod(\",t[0][0],\",\",t[1][1],\"),prod(-\",t[0][1],\",\",t[1][0],\"))\"].join(\"\");for(var e=[],r=0;r<t.length;++r)e.push([\"scale(\",c(s(t,r)),\",\",(n=r,1&n?\"-\":\"\"),t[0][r],\")\"].join(\"\"));return function t(e){if(1===e.length)return e[0];if(2===e.length)return[\"sum(\",e[0],\",\",e[1],\")\"].join(\"\");var r=e.length>>1;return[\"sum(\",t(e.slice(0,r)),\",\",t(e.slice(r)),\")\"].join(\"\")}(e);var n}function u(t){return new Function(\"sum\",\"scale\",\"prod\",\"compress\",[\"function robustDeterminant\",t,\"(m){return compress(\",c(l(t)),\")};return robustDeterminant\",t].join(\"\"))(i,a,n,o)}var f=[function(){return[0]},function(t){return[t[0][0]]}];!function(){for(;f.length<6;)f.push(u(f.length));for(var t=[],r=[\"function robustDeterminant(m){switch(m.length){\"],n=0;n<6;++n)t.push(\"det\"+n),r.push(\"case \",n,\":return det\",n,\"(m);\");r.push(\"}var det=CACHE[m.length];if(!det)det=CACHE[m.length]=gen(m.length);return det(m);}return robustDeterminant\"),t.push(\"CACHE\",\"gen\",r.join(\"\"));var i=Function.apply(void 0,t);for(e.exports=i.apply(void 0,f.concat([f,u])),n=0;n<f.length;++n)e.exports[n]=f[n]}()},{\"robust-compress\":543,\"robust-scale\":550,\"robust-sum\":553,\"two-product\":604}],545:[function(t,e,r){\"use strict\";var n=t(\"two-product\"),i=t(\"robust-sum\");e.exports=function(t,e){for(var r=n(t[0],e[0]),a=1;a<t.length;++a)r=i(r,n(t[a],e[a]));return r}},{\"robust-sum\":553,\"two-product\":604}],546:[function(t,e,r){\"use strict\";var n=t(\"two-product\"),i=t(\"robust-sum\"),a=t(\"robust-subtract\"),o=t(\"robust-scale\");function s(t,e){for(var r=new Array(t.length-1),n=1;n<t.length;++n)for(var i=r[n-1]=new Array(t.length-1),a=0,o=0;a<t.length;++a)a!==e&&(i[o++]=t[n][a]);return r}function l(t){if(1===t.length)return t[0];if(2===t.length)return[\"sum(\",t[0],\",\",t[1],\")\"].join(\"\");var e=t.length>>1;return[\"sum(\",l(t.slice(0,e)),\",\",l(t.slice(e)),\")\"].join(\"\")}function c(t,e){if(\"m\"===t.charAt(0)){if(\"w\"===e.charAt(0)){var r=t.split(\"[\");return[\"w\",e.substr(1),\"m\",r[0].substr(1)].join(\"\")}return[\"prod(\",t,\",\",e,\")\"].join(\"\")}return c(e,t)}function u(t){if(2===t.length)return[[\"diff(\",c(t[0][0],t[1][1]),\",\",c(t[1][0],t[0][1]),\")\"].join(\"\")];for(var e=[],r=0;r<t.length;++r)e.push([\"scale(\",l(u(s(t,r))),\",\",(n=r,!0&n?\"-\":\"\"),t[0][r],\")\"].join(\"\"));return e;var n}function f(t,e){for(var r=[],n=0;n<e-2;++n)r.push([\"prod(m\",t,\"[\",n,\"],m\",t,\"[\",n,\"])\"].join(\"\"));return l(r)}function h(t){for(var e=[],r=[],c=function(t){for(var e=new Array(t),r=0;r<t;++r){e[r]=new Array(t);for(var n=0;n<t;++n)e[r][n]=[\"m\",n,\"[\",t-r-2,\"]\"].join(\"\")}return e}(t),h=0;h<t;++h)c[0][h]=\"1\",c[t-1][h
" });\n",
" require(['plotly'], function(Plotly) {\n",
" window._Plotly = Plotly;\n",
" });\n",
" }\n",
" </script>\n",
" "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from IPython.display import Markdown as md\n",
"from IPython.display import display, HTML\n",
"import pandas as pd\n",
"import numpy as np\n",
"import ipywidgets as widgets\n",
"from pathlib import Path\n",
"from datetime import datetime\n",
"from recopytex import flat_df_students, pp_q_scores\n",
"from datetime import datetime\n",
"\n",
"\n",
"import chart_studio.plotly as py\n",
"import plotly.graph_objects as go\n",
"import plotly.figure_factory as ff\n",
"\n",
"from plotly.offline import iplot, init_notebook_mode\n",
"init_notebook_mode()"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "3a865047",
"metadata": {
"execution": {
"iopub.execute_input": "2021-11-26T20:53:47.639073Z",
"iopub.status.busy": "2021-11-26T20:53:47.638715Z",
"iopub.status.idle": "2021-11-26T20:53:47.640278Z",
"shell.execute_reply": "2021-11-26T20:53:47.639963Z"
},
"extensions": {
"jupyter_dashboards": {
"version": 1,
"views": {
"grid_default": {},
"report_default": {
"hidden": true
}
}
}
},
"papermill": {
"duration": 0.07866,
"end_time": "2021-11-26T20:53:47.640357",
"exception": false,
"start_time": "2021-11-26T20:53:47.561697",
"status": "completed"
},
"slideshow": {
"slide_type": "skip"
},
"tags": [
"parameters"
]
},
"outputs": [],
"source": [
"tribe = \"ES\"\n",
"assessment = \"ds2\"\n",
"date = \"14/10/19\"\n",
"csv_file = Path(f\"../{tribe}/191014_{assessment}.csv\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "d9e07464",
"metadata": {
"execution": {
"iopub.execute_input": "2021-11-26T20:53:47.788728Z",
"iopub.status.busy": "2021-11-26T20:53:47.788342Z",
"iopub.status.idle": "2021-11-26T20:53:47.789985Z",
"shell.execute_reply": "2021-11-26T20:53:47.789664Z"
},
"papermill": {
"duration": 0.075297,
"end_time": "2021-11-26T20:53:47.790056",
"exception": false,
"start_time": "2021-11-26T20:53:47.714759",
"status": "completed"
},
"tags": [
"injected-parameters"
]
},
"outputs": [],
"source": [
"# Parameters\n",
"tribe = \"2GT6\"\n",
"assessment = \"Ds3\"\n",
"date = \"22/11/21\"\n",
"csv_file = \"/media/documents/Cours/2021-2022/Notes/2GT6/211122_DS3.csv\"\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "63832c37",
"metadata": {
"execution": {
"iopub.execute_input": "2021-11-26T20:53:47.937696Z",
"iopub.status.busy": "2021-11-26T20:53:47.937321Z",
"iopub.status.idle": "2021-11-26T20:53:47.939041Z",
"shell.execute_reply": "2021-11-26T20:53:47.938682Z"
},
"papermill": {
"duration": 0.07775,
"end_time": "2021-11-26T20:53:47.939111",
"exception": false,
"start_time": "2021-11-26T20:53:47.861361",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/media/documents/Cours/2021-2022/Notes/2GT6/211122_DS3\n"
]
}
],
"source": [
"date = datetime.strptime(date, \"%d/%m/%y\")\n",
"output_path = Path(csv_file[:-4])\n",
"print(output_path)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "2a41f502",
"metadata": {
"execution": {
"iopub.execute_input": "2021-11-26T20:53:48.089060Z",
"iopub.status.busy": "2021-11-26T20:53:48.088682Z",
"iopub.status.idle": "2021-11-26T20:53:48.090748Z",
"shell.execute_reply": "2021-11-26T20:53:48.090390Z"
},
"extensions": {
"jupyter_dashboards": {
"version": 1,
"views": {
"grid_default": {},
"report_default": {
"hidden": false
}
}
}
},
"papermill": {
"duration": 0.080125,
"end_time": "2021-11-26T20:53:48.090819",
"exception": false,
"start_time": "2021-11-26T20:53:48.010694",
"status": "completed"
},
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"outputs": [
{
"data": {
"text/markdown": [
"# Ds3 (21/11/22) pour 2GT6"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"if date is None:\n",
" display(md(f\"# {assessment} pour {tribe}\"))\n",
"else:\n",
" display(md(f\"# {assessment} ({date:%y/%m/%d}) pour {tribe}\"))"
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "3149dc30",
"metadata": {
"execution": {
"iopub.execute_input": "2021-11-26T20:53:48.242342Z",
"iopub.status.busy": "2021-11-26T20:53:48.239786Z",
"iopub.status.idle": "2021-11-26T20:53:48.388408Z",
"shell.execute_reply": "2021-11-26T20:53:48.388704Z"
},
"extensions": {
"jupyter_dashboards": {
"version": 1,
"views": {
"grid_default": {},
"report_default": {
"hidden": true
}
}
}
},
"papermill": {
"duration": 0.226291,
"end_time": "2021-11-26T20:53:48.388810",
"exception": false,
"start_time": "2021-11-26T20:53:48.162519",
"status": "completed"
},
"slideshow": {
"slide_type": "skip"
},
"tags": []
},
"outputs": [],
"source": [
"stack_scores = pd.read_csv(csv_file, encoding=\"UTF8\")\n",
"#comments = stack_scores.iloc[0]\n",
"#stack_scores.drop([0], inplace=True)\n",
"scores = flat_df_students(stack_scores).dropna(subset=[\"Score\"])\n",
"scores = pp_q_scores(scores)\n",
"#scores.head()\n",
"#comments.drop()"
]
},
{
"cell_type": "code",
"execution_count": 45,
"id": "48cb4a36",
"metadata": {
"execution": {
"iopub.execute_input": "2021-11-26T20:53:48.536329Z",
"iopub.status.busy": "2021-11-26T20:53:48.535961Z",
"iopub.status.idle": "2021-11-26T20:53:48.538619Z",
"shell.execute_reply": "2021-11-26T20:53:48.538263Z"
},
"extensions": {
"jupyter_dashboards": {
"version": 1,
"views": {
"grid_default": {},
"report_default": {
"hidden": true
}
}
}
},
"papermill": {
"duration": 0.078109,
"end_time": "2021-11-26T20:53:48.538692",
"exception": false,
"start_time": "2021-11-26T20:53:48.460583",
"status": "completed"
},
"slideshow": {
"slide_type": "skip"
},
"tags": []
},
"outputs": [],
"source": [
"exercises_scores = scores.groupby([\"Exercice\", \"Eleve\"]).agg({\"Note\": \"sum\", \"Bareme\": \"sum\"})"
]
},
{
"cell_type": "code",
"execution_count": 61,
"id": "15025186",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th></th>\n",
" <th>Note</th>\n",
" <th>Bareme</th>\n",
" </tr>\n",
" <tr>\n",
" <th>Exercice</th>\n",
" <th>Eleve</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th rowspan=\"5\" valign=\"top\">Exercice 1</th>\n",
" <th>ABOUHAFS Yasmine</th>\n",
" <td>2.00</td>\n",
" <td>2.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>AKEAZI Hafsa</th>\n",
" <td>2.00</td>\n",
" <td>2.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>AZIZ Nihal</th>\n",
" <td>2.00</td>\n",
" <td>2.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>BARDOUSSE Yanis</th>\n",
" <td>1.33</td>\n",
" <td>2.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>BILLET Simon</th>\n",
" <td>2.00</td>\n",
" <td>2.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Note Bareme\n",
"Exercice Eleve \n",
"Exercice 1 ABOUHAFS Yasmine 2.00 2.0\n",
" AKEAZI Hafsa 2.00 2.0\n",
" AZIZ Nihal 2.00 2.0\n",
" BARDOUSSE Yanis 1.33 2.0\n",
" BILLET Simon 2.00 2.0"
]
},
"execution_count": 61,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"exercises_scores.head()"
]
},
{
"cell_type": "code",
"execution_count": 46,
"id": "71c672c0",
"metadata": {
"execution": {
"iopub.execute_input": "2021-11-26T20:53:48.686783Z",
"iopub.status.busy": "2021-11-26T20:53:48.686418Z",
"iopub.status.idle": "2021-11-26T20:53:48.687627Z",
"shell.execute_reply": "2021-11-26T20:53:48.687922Z"
},
"papermill": {
"duration": 0.077338,
"end_time": "2021-11-26T20:53:48.688009",
"exception": false,
"start_time": "2021-11-26T20:53:48.610671",
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"assessment_scores = scores.groupby([\"Eleve\"]).agg({\"Note\": \"sum\", \"Bareme\": \"sum\"})"
]
},
{
"cell_type": "code",
"execution_count": 47,
"id": "d8a02878",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Index(['Nom', 'Trimestre', 'Date', 'Exercice', 'Question', 'Competence',\n",
" 'Domaine', 'Commentaire', 'Est_nivele', 'Bareme', 'Eleve', 'Score',\n",
" 'Note', 'Niveau', 'Normalise'],\n",
" dtype='object')"
]
},
"execution_count": 47,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"scores.columns"
]
},
{
"cell_type": "code",
"execution_count": 82,
"id": "b6717594",
"metadata": {},
"outputs": [],
"source": [
"domain_scores = scores.groupby([\"Eleve\", \"Domaine\"]).agg({\"Note\": \"sum\", \"Bareme\": \"sum\"})\n",
"domain_scores[\"Normalized\"] = domain_scores[\"Note\"] / domain_scores[\"Bareme\"]"
]
},
{
"cell_type": "code",
"execution_count": 74,
"id": "d87553e1",
"metadata": {},
"outputs": [],
"source": [
"#domain_scores"
]
},
{
"cell_type": "code",
"execution_count": 83,
"id": "61a49219",
"metadata": {},
"outputs": [],
"source": [
"competence_scores = scores.groupby([\"Eleve\", \"Competence\"]).agg({\"Note\": \"sum\", \"Bareme\": \"sum\"})\n",
"competence_scores[\"Normalized\"] = competence_scores[\"Note\"] / competence_scores[\"Bareme\"]"
]
},
{
"cell_type": "code",
"execution_count": 84,
"id": "7c8ad2c9",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th></th>\n",
" <th>Note</th>\n",
" <th>Bareme</th>\n",
" <th>Normalized</th>\n",
" </tr>\n",
" <tr>\n",
" <th>Eleve</th>\n",
" <th>Competence</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th rowspan=\"5\" valign=\"top\">ZERDOUNI Adam</th>\n",
" <th>Chercher</th>\n",
" <td>0.67</td>\n",
" <td>1.0</td>\n",
" <td>0.67</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Communiquer</th>\n",
" <td>0.67</td>\n",
" <td>1.0</td>\n",
" <td>0.67</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Modéliser</th>\n",
" <td>1.00</td>\n",
" <td>1.0</td>\n",
" <td>1.00</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Raisonner</th>\n",
" <td>2.67</td>\n",
" <td>5.0</td>\n",
" <td>0.53</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Représenter</th>\n",
" <td>4.66</td>\n",
" <td>8.0</td>\n",
" <td>0.58</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Note Bareme Normalized\n",
"Eleve Competence \n",
"ZERDOUNI Adam Chercher 0.67 1.0 0.67\n",
" Communiquer 0.67 1.0 0.67\n",
" Modéliser 1.00 1.0 1.00\n",
" Raisonner 2.67 5.0 0.53\n",
" Représenter 4.66 8.0 0.58"
]
},
"execution_count": 84,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"competence_scores.tail()"
]
},
{
"cell_type": "markdown",
"id": "3437315d",
"metadata": {
"papermill": {
"duration": 0.071946,
"end_time": "2021-11-26T20:53:48.831774",
"exception": false,
"start_time": "2021-11-26T20:53:48.759828",
"status": "completed"
},
"tags": []
},
"source": [
"### Bilans personnalisés"
]
},
{
"cell_type": "code",
"execution_count": 85,
"id": "dd4fa512",
"metadata": {
"execution": {
"iopub.execute_input": "2021-11-26T20:53:48.980091Z",
"iopub.status.busy": "2021-11-26T20:53:48.979725Z",
"iopub.status.idle": "2021-11-26T20:53:48.997193Z",
"shell.execute_reply": "2021-11-26T20:53:48.997507Z"
},
"papermill": {
"duration": 0.09319,
"end_time": "2021-11-26T20:53:48.997612",
"exception": false,
"start_time": "2021-11-26T20:53:48.904422",
"status": "completed"
},
"scrolled": true,
"tags": []
},
"outputs": [],
"source": [
"import pytex\n",
"#scores.head()"
]
},
{
"cell_type": "code",
"execution_count": 86,
"id": "6a667215",
"metadata": {
"execution": {
"iopub.execute_input": "2021-11-26T20:53:49.203563Z",
"iopub.status.busy": "2021-11-26T20:53:49.203169Z",
"iopub.status.idle": "2021-11-26T20:53:49.204750Z",
"shell.execute_reply": "2021-11-26T20:53:49.204378Z"
},
"papermill": {
"duration": 0.130274,
"end_time": "2021-11-26T20:53:49.204830",
"exception": false,
"start_time": "2021-11-26T20:53:49.074556",
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"datas = {\n",
" \"assessment\": {\n",
" \"name\": assessment,\n",
" \"date\": date\n",
" },\n",
" #\"exercises\": scores[\"Exercice\"].unique(),\n",
" #\"questions\": scores[[\"Exercice\", 'Question', 'Competence', 'Domaine', 'Commentaire', 'Bareme', 'Est_nivele']],\n",
" \"eleves\": {}\n",
"}\n",
"for e in scores[\"Eleve\"].unique():\n",
" edatas = {\n",
" \"e\": e,\n",
" \"assessment\": assessment_scores.loc[e],\n",
" \"exercices\": exercises_scores.xs(e, level=\"Eleve\"), \"exercices\": exercises_scores.xs(e, level=\"Eleve\"),\n",
" \"domains\": domain_scores.xs(e, level=\"Eleve\"),\n",
" \"competences\": competence_scores.xs(e, level=\"Eleve\"),\n",
" \"exscores\": {}\n",
" }\n",
" for i, ex in edatas[\"exercices\"].iterrows():\n",
" edatas[\"exscores\"][i] = scores.loc[(scores.Exercice==i) & (scores.Eleve==e)]\n",
" datas[\"eleves\"][e] = edatas"
]
},
{
"cell_type": "code",
"execution_count": 125,
"id": "16b39fd6",
"metadata": {
"execution": {
"iopub.execute_input": "2021-11-26T20:53:49.353384Z",
"iopub.status.busy": "2021-11-26T20:53:49.352979Z",
"iopub.status.idle": "2021-11-26T20:53:49.354713Z",
"shell.execute_reply": "2021-11-26T20:53:49.354304Z"
},
"papermill": {
"duration": 0.077658,
"end_time": "2021-11-26T20:53:49.354792",
"exception": false,
"start_time": "2021-11-26T20:53:49.277134",
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"score_template = r\"\"\"\n",
"\\documentclass[a5paper,10pt]{article}\n",
"\\usepackage{fullpage}\n",
"\\usepackage{booktabs}\n",
"\\usepackage{longtable}\n",
"\\usepackage{tikz}\n",
"\\usepackage{multicol}\n",
"\n",
"\\usepackage{geometry}\n",
"\\geometry{left=10mm,right=10mm, top=10mm}\n",
"\n",
"\\renewcommand{\\arraystretch}{1}\n",
"\\setlength{\\columnseprule}{0pt}\n",
"\n",
"\\pagestyle{empty}\n",
"\n",
"\n",
"\\begin{document}\n",
"\n",
"\n",
" \\section*{\\Var{assessment.name} \\hfill \\Var{e} \\hfill \\Var{sc.assessment.Note}/\\Var{sc.assessment.Bareme}}\n",
" %- for i,ex in sc.exercices.iterrows() \n",
" \\subsection*{\\Var{i}: \\hfill \\Var{ex.Note} / \\Var{ex.Bareme}}\n",
" \\begin{center}\n",
" \\Var{sc.exscores[i].to_latex(index=False, columns=[\"Question\", \"Domaine\", \"Commentaire\", \"Note\", \"Bareme\"])}\n",
" \\end{center}\n",
" %- endfor\n",
" \n",
" \\subsection*{Compétences}\n",
" \\begin{multicols}{2}\n",
" %- for i,dom in sc.competences.iterrows()\n",
" \\noindent\n",
" \\Var{i} \\hfill\n",
" \\begin{tikzpicture}[scale=0.7]\n",
" \\draw [](0,0) rectangle (3, 1);\n",
" \\draw [fill=black!20] (0, 0) rectangle (\\Var{dom.Normalized*3}, 1);\n",
" \\end{tikzpicture}\n",
" \\hfill\n",
" %\\Var{dom.Normalized}\n",
" \n",
" %- endfor\n",
" \\end{multicols}\n",
"\n",
"\\end{document}\n",
"\"\"\""
]
},
{
"cell_type": "code",
"execution_count": 126,
"id": "e7d7716e",
"metadata": {
"execution": {
"iopub.execute_input": "2021-11-26T20:53:49.513034Z",
"iopub.status.busy": "2021-11-26T20:53:49.512659Z",
"iopub.status.idle": "2021-11-26T20:53:53.445616Z",
"shell.execute_reply": "2021-11-26T20:53:53.445912Z"
},
"papermill": {
"duration": 4.016494,
"end_time": "2021-11-26T20:53:53.446004",
"exception": false,
"start_time": "2021-11-26T20:53:49.429510",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Wrote 211122_Ds3_ABOUHAFS Yasmine.tex\n",
"Wrote 211122_Ds3_AKEAZI Hafsa.tex\n",
"Wrote 211122_Ds3_AZIZ Nihal.tex\n",
"Wrote 211122_Ds3_BARDOUSSE Yanis.tex\n",
"Wrote 211122_Ds3_BILLET Simon.tex\n",
"Wrote 211122_Ds3_BOUAFIA Lina.tex\n",
"Wrote 211122_Ds3_DESGLENE Anthony.tex\n",
"Wrote 211122_Ds3_DROUOT Marine.tex\n",
"Wrote 211122_Ds3_FLACHERON Maylie.tex\n",
"Wrote 211122_Ds3_GARCIA MORENO Alberto.tex\n",
"Wrote 211122_Ds3_GNUI Kadia.tex\n",
"Wrote 211122_Ds3_GOSSET Jules.tex\n",
"Wrote 211122_Ds3_GOUGEAUD William.tex\n",
"Wrote 211122_Ds3_GRISON Jade.tex\n",
"Wrote 211122_Ds3_HAMIOT Anaïs.tex\n",
"Wrote 211122_Ds3_HAMMOUDI Lyna.tex\n",
"Wrote 211122_Ds3_JOUNEAU Cassandra.tex\n",
"Wrote 211122_Ds3_LAFUMAS Flora.tex\n",
"Wrote 211122_Ds3_MERLE Yannis.tex\n",
"Wrote 211122_Ds3_MONET--BRIFFOD Antonin.tex\n",
"Wrote 211122_Ds3_MONOD Mélissa.tex\n",
"Wrote 211122_Ds3_MULTIN Théo.tex\n",
"Wrote 211122_Ds3_NEIVA Diego.tex\n",
"Wrote 211122_Ds3_PETIT Aidan.tex\n",
"Wrote 211122_Ds3_PRAT Lilou.tex\n",
"Wrote 211122_Ds3_RINALDI Gianni.tex\n",
"Wrote 211122_Ds3_RIVERA--DRENEUC Kerly.tex\n",
"Wrote 211122_Ds3_ROSA DOS SANTOS Andréa.tex\n",
"Wrote 211122_Ds3_TAIBI Shaima.tex\n",
"Wrote 211122_Ds3_TELEGONE Angie.tex\n",
"Wrote 211122_Ds3_ZERDOUNI Adam.tex\n"
]
}
],
"source": [
"tpl = pytex.texenv.from_string(score_template)\n",
"\n",
"for e,sc in datas['eleves'].items():\n",
" reportfilename = f\"{date:%y%m%d}_{assessment}_{e}.tex\"\n",
" with open(output_path / reportfilename, \"w\") as f:\n",
" f.write(tpl.render(sc=sc, e=e,**datas))\n",
" print(f\"Wrote {reportfilename}\")\n",
" pytex.pdflatex(reportfilename)"
]
},
{
"cell_type": "markdown",
"id": "dfaf5d3d",
"metadata": {
"papermill": {
"duration": 0.116257,
"end_time": "2021-11-26T20:53:53.678831",
"exception": false,
"start_time": "2021-11-26T20:53:53.562574",
"status": "completed"
},
"tags": []
},
"source": [
"## Envoie des bilans par mail"
]
},
{
"cell_type": "code",
"execution_count": 127,
"id": "76384db8",
"metadata": {
"execution": {
"iopub.execute_input": "2021-11-26T20:53:53.922093Z",
"iopub.status.busy": "2021-11-26T20:53:53.921720Z",
"iopub.status.idle": "2021-11-26T20:53:53.923382Z",
"shell.execute_reply": "2021-11-26T20:53:53.923063Z"
},
"papermill": {
"duration": 0.127584,
"end_time": "2021-11-26T20:53:53.923456",
"exception": false,
"start_time": "2021-11-26T20:53:53.795872",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Bian du devoir Ds3\n",
"Bonsoir,\n",
"En pièce jointe, vous trouverez un document détaillant la note du devoir.\n",
"B.Bertrand\n",
"\n"
]
}
],
"source": [
"mailfrom = \"benjamin.bertrand@ac-lyon.fr\"\n",
"subject = f\"Bian du devoir {assessment}\"\n",
"message = \"\"\"Bonsoir,\n",
"En pièce jointe, vous trouverez un document détaillant la note du devoir.\n",
"B.Bertrand\n",
"\"\"\"\n",
"print(subject)\n",
"print(message)"
]
},
{
"cell_type": "code",
"execution_count": 128,
"id": "71eb9a2b",
"metadata": {
"execution": {
"iopub.execute_input": "2021-11-26T20:53:54.164176Z",
"iopub.status.busy": "2021-11-26T20:53:54.163810Z",
"iopub.status.idle": "2021-11-26T20:53:54.190175Z",
"shell.execute_reply": "2021-11-26T20:53:54.188791Z"
},
"papermill": {
"duration": 0.149652,
"end_time": "2021-11-26T20:53:54.190456",
"exception": false,
"start_time": "2021-11-26T20:53:54.040804",
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"import smtplib\n",
"import os\n",
"import sys\n",
"from email.message import EmailMessage\n",
"import mimetypes\n",
"import time\n",
"import random"
]
},
{
"cell_type": "code",
"execution_count": 129,
"id": "f2834e6b",
"metadata": {
"execution": {
"iopub.execute_input": "2021-11-26T20:53:54.452725Z",
"iopub.status.busy": "2021-11-26T20:53:54.452362Z",
"iopub.status.idle": "2021-11-26T20:53:54.453602Z",
"shell.execute_reply": "2021-11-26T20:53:54.453904Z"
},
"papermill": {
"duration": 0.126792,
"end_time": "2021-11-26T20:53:54.453991",
"exception": false,
"start_time": "2021-11-26T20:53:54.327199",
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"def build_msg(subj, to_addr, from_addr, body, att):\n",
" msg = EmailMessage()\n",
" msg[\"Subject\"] = subj\n",
" msg[\"To\"] = to_addr\n",
" #msg[\"To\"] = \"lafrite26@gmail.com\"\n",
" msg[\"From\"] = from_addr\n",
" msg.set_content(body)\n",
"\n",
" if att != []:\n",
" ctype, encoding = mimetypes.guess_type(att)\n",
" if ctype is None or encoding is not None:\n",
" ctype = 'application/octet-stream'\n",
" maintype, subtype = ctype.split('/', 1)\n",
" with open(att, \"rb\") as f:\n",
" msg.add_attachment(f.read(),\n",
" maintype=maintype,\n",
" subtype=subtype,\n",
" filename=att.name)\n",
" return msg\n"
]
},
{
"cell_type": "code",
"execution_count": 130,
"id": "30311066",
"metadata": {
"execution": {
"iopub.execute_input": "2021-11-26T20:53:54.696622Z",
"iopub.status.busy": "2021-11-26T20:53:54.696227Z",
"iopub.status.idle": "2021-11-26T20:53:54.697474Z",
"shell.execute_reply": "2021-11-26T20:53:54.697794Z"
},
"papermill": {
"duration": 0.124423,
"end_time": "2021-11-26T20:53:54.697885",
"exception": false,
"start_time": "2021-11-26T20:53:54.573462",
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"send = 0\n",
"fake = 1"
]
},
{
"cell_type": "code",
"execution_count": 131,
"id": "d31598c3",
"metadata": {
"execution": {
"iopub.execute_input": "2021-11-26T20:53:54.965435Z",
"iopub.status.busy": "2021-11-26T20:53:54.965061Z",
"iopub.status.idle": "2021-11-26T20:53:54.966675Z",
"shell.execute_reply": "2021-11-26T20:53:54.966354Z"
},
"papermill": {
"duration": 0.122545,
"end_time": "2021-11-26T20:53:54.966749",
"exception": false,
"start_time": "2021-11-26T20:53:54.844204",
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"if send:\n",
" if fake:\n",
" server = smtplib.SMTP(\"localhost\", 8025)\n",
" server.ehlo()\n",
" else:\n",
" server = smtplib.SMTP(\"smtps.ac-lyon.fr\", 587)\n",
" server.ehlo()\n",
" server.starttls()\n",
" server.ehlo()\n",
" server.login(\"bbertrand\", os.popen(\"pass Prof/Lyon/bbertrand\").read()[:-1]) "
]
},
{
"cell_type": "code",
"execution_count": 132,
"id": "ca5690d7",
"metadata": {
"execution": {
"iopub.execute_input": "2021-11-26T20:53:55.207832Z",
"iopub.status.busy": "2021-11-26T20:53:55.207467Z",
"iopub.status.idle": "2021-11-26T20:53:55.210915Z",
"shell.execute_reply": "2021-11-26T20:53:55.210549Z"
},
"papermill": {
"duration": 0.126236,
"end_time": "2021-11-26T20:53:55.210987",
"exception": false,
"start_time": "2021-11-26T20:53:55.084751",
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"try:\n",
" eleves_data = pd.read_csv(f\"../../{tribe}.csv\")\n",
"except FileNotFoundError:\n",
" try:\n",
" eleves_data = pd.read_csv(f\"../{tribe}.csv\")\n",
" except FileNotFoundError:\n",
" eleves_data = pd.read_csv(f\"{tribe}.csv\")\n",
"eleves_data.fillna(\"\", inplace=True)\n",
"#eleves_data"
]
},
{
"cell_type": "code",
"execution_count": 133,
"id": "b676f878",
"metadata": {
"execution": {
"iopub.execute_input": "2021-11-26T20:53:55.451633Z",
"iopub.status.busy": "2021-11-26T20:53:55.451264Z",
"iopub.status.idle": "2021-11-26T20:53:55.456994Z",
"shell.execute_reply": "2021-11-26T20:53:55.457277Z"
},
"papermill": {
"duration": 0.128366,
"end_time": "2021-11-26T20:53:55.457365",
"exception": false,
"start_time": "2021-11-26T20:53:55.328999",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\tBilan envoyé à ABOUHAFS Yasmine\n",
"Pas de mail pour AKEAZI Hafsa\n",
"Pas de mail pour AZIZ Nihal\n",
"\tBilan envoyé à BARDOUSSE Yanis\n",
"\tBilan envoyé à BILLET Simon\n",
"Pas de mail pour BOUAFIA Lina\n",
"\tBilan envoyé à DESGLENE Anthony\n",
"\tBilan envoyé à DROUOT Marine\n",
"\tBilan envoyé à FLACHERON Maylie\n",
"\tBilan envoyé à GARCIA MORENO Alberto\n",
"\tBilan envoyé à GNUI Kadia\n",
"\tBilan envoyé à GOSSET Jules\n",
"\tBilan envoyé à GOUGEAUD William\n",
"Pas de mail pour GRISON Jade\n",
"\tBilan envoyé à HAMIOT Anaïs\n",
"\tBilan envoyé à HAMMOUDI Lyna\n",
"\tBilan envoyé à JOUNEAU Cassandra\n",
"\tBilan envoyé à LAFUMAS Flora\n",
"Pas de mail pour MERLE Yannis\n",
"\tBilan envoyé à MONET--BRIFFOD Antonin\n",
"\tBilan envoyé à MONOD Mélissa\n",
"\tBilan envoyé à MULTIN Théo\n",
"\tBilan envoyé à NEIVA Diego\n",
"Pas de rapport pour PERROTIN Léonie\n",
"Pas de mail pour PETIT Aidan\n",
"\tBilan envoyé à PRAT Lilou\n",
"\tBilan envoyé à RINALDI Gianni\n",
"Pas de mail pour RIVERA--DRENEUC Kerly\n",
"\tBilan envoyé à ROSA DOS SANTOS Andréa\n",
"\tBilan envoyé à TAIBI Shaima\n",
"\tBilan envoyé à TELEGONE Angie\n",
"Pas de mail pour ZERDOUNI Adam\n"
]
}
],
"source": [
"for e in eleves_data.iterrows():\n",
" reportfilename = Path(f\"{date:%y%m%d}_{assessment}_{e[1]['Nom']}.pdf\")\n",
" try:\n",
" assert reportfilename.exists()\n",
" except:\n",
" print(f\"Pas de rapport pour {e[1]['Nom']}\")\n",
" else:\n",
" if e[1][\"mail\"] != \"\":\n",
" if send:\n",
" msg = build_msg(subject, e[1][\"mail\"], mailfrom, message, reportfilename)\n",
" server.send_message(msg)\n",
" print(f\"\\tBilan envoyé à {e[1]['Nom']}\")\n",
" else:\n",
" print(f\"Pas de mail pour {e[1]['Nom']}\")\n",
" "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "78e914c1",
"metadata": {
"papermill": {
"duration": 0.117162,
"end_time": "2021-11-26T20:53:55.691667",
"exception": false,
"start_time": "2021-11-26T20:53:55.574505",
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "24ff9733",
"metadata": {
"papermill": {
"duration": 0.118807,
"end_time": "2021-11-26T20:53:55.931687",
"exception": false,
"start_time": "2021-11-26T20:53:55.812880",
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": []
}
],
"metadata": {
"celltoolbar": "Diaporama",
"extensions": {
"jupyter_dashboards": {
"activeView": "grid_default",
"version": 1,
"views": {
"grid_default": {
"cellMargin": 10,
"defaultCellHeight": 20,
"maxColumns": 12,
"name": "grid",
"type": "grid"
},
"report_default": {
"name": "report",
"type": "report"
}
}
}
},
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
},
"papermill": {
"duration": 10.304573,
"end_time": "2021-11-26T20:53:56.367583",
"environment_variables": {},
"exception": null,
"input_path": "templates/tpl_evaluation.ipynb",
"output_path": "2GT6/211122_DS3/Ds3.ipynb",
"parameters": {
"assessment": "Ds3",
"csv_file": "/media/documents/Cours/2021-2022/Notes/2GT6/211122_DS3.csv",
"date": "22/11/21",
"tribe": "2GT6"
},
"start_time": "2021-11-26T20:53:46.063010",
"version": "1.2.1"
}
},
"nbformat": 4,
"nbformat_minor": 5
}