{ "cells": [ { "cell_type": "markdown", "id": "7754385e", "metadata": {}, "source": [ "https://n.ethz.ch/~atuzlak/data-analysis | atuzlak@ethz.ch" ] }, { "cell_type": "markdown", "id": "efffa75b", "metadata": {}, "source": [ "

Setup ⬇️⬇️⬇️ (don't touch after initialization)

" ] }, { "cell_type": "code", "execution_count": null, "id": "3882145f", "metadata": {}, "outputs": [], "source": [ "import os\n", "print(os.getcwd())\n", "#os.chdir(r'cwd')\n", "files = os.listdir()\n", "print(files)" ] }, { "cell_type": "code", "execution_count": null, "id": "de5453b0", "metadata": {}, "outputs": [], "source": [ "%run -i \"Library.py\"" ] }, { "cell_type": "code", "execution_count": null, "id": "9b304419", "metadata": {}, "outputs": [], "source": [ "test()" ] }, { "cell_type": "markdown", "id": "7b748ada", "metadata": {}, "source": [ "

ErrCalc (Unkorr.)

" ] }, { "cell_type": "code", "execution_count": null, "id": "a1a74a57", "metadata": {}, "outputs": [], "source": [ "def fkt(x, y, z):\n", " return 0\n", "\n", "def sigmaFkt(mx, sx, my, sy, mz, sz):\n", " return 0\n", "\n", "np.sqrt(\n", " () * (sx**2) +\n", " () * (sy**2) +\n", " () * (sz**2)\n", ")" ] }, { "cell_type": "markdown", "id": "8bb0e32e", "metadata": {}, "source": [ "

ErrCalc (Korr.)

" ] }, { "cell_type": "code", "execution_count": null, "id": "ad2b94fd", "metadata": {}, "outputs": [], "source": [ "def sigmaFktKorr(mx, sx, my, sy, mz, sz, korr):\n", " return 0\n", "\n", "np.sqrt(\n", " () * (sx**2) +\n", " () * (sy**2) +\n", " () * (sz**2) +\n", " 2 * (()*()) * korr\n", ")" ] }, { "cell_type": "markdown", "id": "75a1a993", "metadata": {}, "source": [ "

Mom

" ] }, { "cell_type": "code", "execution_count": null, "id": "dea12f3f", "metadata": {}, "outputs": [], "source": [ "m0 = 1\n", "m1_1 = moment(data, 1) #= 0\n", "_1stZentrMom = moment(data-m1_1, 1)\n", "_2ndZentrMom = moment(data-m1_1, 2)\n", "_3rdZentrMom = moment(data-m1_1, 3)\n", "\n", "print(\"M_0: {}\\nM_1: {}\\n M_1.Zentr.: {}\\n M_2.Zentr.: {}\\n M_3.Zentr.: {}\".format(1, m1_1, _1stZentrMom, _2ndZentrMom, _3rdZentrMom))" ] }, { "cell_type": "markdown", "id": "c7564216", "metadata": {}, "source": [ "

ML

" ] }, { "cell_type": "code", "execution_count": null, "id": "016edd59", "metadata": {}, "outputs": [], "source": [ "y = df['diagnosis']\n", "X = df.drop(['diagnosis'], axis=1)" ] }, { "cell_type": "markdown", "id": "2b2020e4", "metadata": {}, "source": [ "

Documentation

\n", "

%run -i \"Library.py\"

\n", "
\n", "
\n", "

\n", "

\n", "

\n", "
\n", "
\n", "

\n", "

\n", "

\n", "
\n", "
\n", "

\n", "

\n", " \n", "

\n", "
\n", "
" ] }, { "cell_type": "code", "execution_count": null, "id": "bacffd3b", "metadata": {}, "outputs": [], "source": [ "os.getcwd()\n", "print(os.getcwd())\n", "#os.chdir(r'C:\\Users\\')\n", "#np.savetxt('filename', array, delimiter=' ')\n", "files = os.listdir()\n", "print(files)" ] }, { "cell_type": "code", "execution_count": null, "id": "ec9272a2", "metadata": {}, "outputs": [], "source": [ "data = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "print(data.shape)\n", "print(data.transpose().shape)\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \").transpose()" ] }, { "cell_type": "code", "execution_count": null, "id": "5eac71f5", "metadata": {}, "outputs": [], "source": [ "%matplotlib notebook\n", "%matplotlib inline" ] }, { "cell_type": "markdown", "id": "e22c3d06", "metadata": {}, "source": [ "

\"Workspace\"

" ] }, { "cell_type": "markdown", "id": "b6e755b9", "metadata": {}, "source": [ "\n", "

Frage 1:

" ] }, { "cell_type": "code", "execution_count": null, "id": "7eb78c89", "metadata": {}, "outputs": [], "source": [ "print(files)\n", "print(files[i])" ] }, { "cell_type": "code", "execution_count": null, "id": "dfb17ea1", "metadata": {}, "outputs": [], "source": [ "data = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "print(data.shape)\n", "print(data.transpose().shape)\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \").transpose()" ] }, { "cell_type": "code", "execution_count": null, "id": "4b1580e0", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "8030a810", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "152f7c6a", "metadata": {}, "source": [ "

Frage 2:

" ] }, { "cell_type": "code", "execution_count": null, "id": "08942010", "metadata": {}, "outputs": [], "source": [ "print(files[i])" ] }, { "cell_type": "code", "execution_count": null, "id": "70eff0f8", "metadata": {}, "outputs": [], "source": [ "data = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "print(data.shape)\n", "print(data.transpose().shape)\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \").transpose()" ] }, { "cell_type": "code", "execution_count": null, "id": "da72e53f", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "cb5f89d5", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "38f634ac", "metadata": {}, "source": [ "

Frage 3:

" ] }, { "cell_type": "code", "execution_count": null, "id": "64a5228f", "metadata": {}, "outputs": [], "source": [ "print(files[i])" ] }, { "cell_type": "code", "execution_count": null, "id": "3e6a047f", "metadata": {}, "outputs": [], "source": [ "data = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "print(data.shape)\n", "print(data.transpose().shape)\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \").transpose()" ] }, { "cell_type": "code", "execution_count": null, "id": "48748f75", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "1c2c44e6", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "2fba7dc6", "metadata": {}, "source": [ "

Frage 4:

" ] }, { "cell_type": "code", "execution_count": null, "id": "fb8eee56", "metadata": {}, "outputs": [], "source": [ "print(files[i])" ] }, { "cell_type": "code", "execution_count": null, "id": "12df5155", "metadata": {}, "outputs": [], "source": [ "data = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "print(data.shape)\n", "print(data.transpose().shape)\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \").transpose()" ] }, { "cell_type": "code", "execution_count": null, "id": "26a5ec8e", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "740f9e13", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "066dad14", "metadata": {}, "source": [ "

Frage 5:

" ] }, { "cell_type": "code", "execution_count": null, "id": "e3e3119c", "metadata": {}, "outputs": [], "source": [ "print(files[i])" ] }, { "cell_type": "code", "execution_count": null, "id": "06a52401", "metadata": {}, "outputs": [], "source": [ "data = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "print(data.shape)\n", "print(data.transpose().shape)\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \").transpose()" ] }, { "cell_type": "code", "execution_count": null, "id": "95f1b4f3", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "e45bc2bc", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "f12265ba", "metadata": {}, "source": [ "

Frage 6:

" ] }, { "cell_type": "code", "execution_count": null, "id": "8cd12abf", "metadata": {}, "outputs": [], "source": [ "print(files[i])" ] }, { "cell_type": "code", "execution_count": null, "id": "3061ff08", "metadata": {}, "outputs": [], "source": [ "data = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "print(data.shape)\n", "print(data.transpose().shape)\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \").transpose()" ] }, { "cell_type": "code", "execution_count": null, "id": "9628a4f7", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "3bc26378", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "8e3d4ff5", "metadata": {}, "source": [ "

Frage 7:

" ] }, { "cell_type": "code", "execution_count": null, "id": "2d681bff", "metadata": {}, "outputs": [], "source": [ "print(files[i])" ] }, { "cell_type": "code", "execution_count": null, "id": "78421cd6", "metadata": {}, "outputs": [], "source": [ "data = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "print(data.shape)\n", "print(data.transpose().shape)\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \").transpose()" ] }, { "cell_type": "code", "execution_count": null, "id": "3954fc83", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "f6befdb8", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "d934f508", "metadata": {}, "source": [ "

Frage 8:

" ] }, { "cell_type": "code", "execution_count": null, "id": "98799e06", "metadata": {}, "outputs": [], "source": [ "print(files[i])" ] }, { "cell_type": "code", "execution_count": null, "id": "5c6c8c57", "metadata": {}, "outputs": [], "source": [ "data = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "print(data.shape)\n", "print(data.transpose().shape)\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \").transpose()" ] }, { "cell_type": "code", "execution_count": null, "id": "0a737d45", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "5f5f0ed9", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "2ffdf6a7", "metadata": {}, "source": [ "

Frage 9:

" ] }, { "cell_type": "code", "execution_count": null, "id": "8671f45c", "metadata": {}, "outputs": [], "source": [ "print(files[i])" ] }, { "cell_type": "code", "execution_count": null, "id": "be5e8942", "metadata": {}, "outputs": [], "source": [ "data = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "print(data.shape)\n", "print(data.transpose().shape)\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \").transpose()" ] }, { "cell_type": "code", "execution_count": null, "id": "a6c846e3", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "b417a3ea", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "82ad8335", "metadata": {}, "source": [ "

Frage 10:

" ] }, { "cell_type": "code", "execution_count": null, "id": "56fc6fa2", "metadata": {}, "outputs": [], "source": [ "print(files[i])" ] }, { "cell_type": "code", "execution_count": null, "id": "8144e09f", "metadata": {}, "outputs": [], "source": [ "data = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "print(data.shape)\n", "print(data.transpose().shape)\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \").transpose()" ] }, { "cell_type": "code", "execution_count": null, "id": "eb7a8c7f", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "d9f122b9", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "0fc38f3d", "metadata": {}, "source": [ "

Frage 11:

" ] }, { "cell_type": "code", "execution_count": null, "id": "1d8d90f8", "metadata": {}, "outputs": [], "source": [ "print(files[i])" ] }, { "cell_type": "code", "execution_count": null, "id": "561b4a31", "metadata": {}, "outputs": [], "source": [ "data = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "print(data.shape)\n", "print(data.transpose().shape)\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \").transpose()" ] }, { "cell_type": "code", "execution_count": null, "id": "73406223", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "cb1742c2", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "73cc711a", "metadata": {}, "source": [ "

Frage 12:

" ] }, { "cell_type": "code", "execution_count": null, "id": "45c49a73", "metadata": {}, "outputs": [], "source": [ "print(files[i])" ] }, { "cell_type": "code", "execution_count": null, "id": "f4c9eb2e", "metadata": {}, "outputs": [], "source": [ "data = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "print(data.shape)\n", "print(data.transpose().shape)\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \").transpose()" ] }, { "cell_type": "code", "execution_count": null, "id": "4f5fa19c", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "c719e8b8", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "dfc2b7c4", "metadata": {}, "source": [ "

Frage 13:

" ] }, { "cell_type": "code", "execution_count": null, "id": "e90a7027", "metadata": {}, "outputs": [], "source": [ "print(files[i])" ] }, { "cell_type": "code", "execution_count": null, "id": "fe438301", "metadata": {}, "outputs": [], "source": [ "data = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "print(data.shape)\n", "print(data.transpose().shape)\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \").transpose()" ] }, { "cell_type": "code", "execution_count": null, "id": "297fcce4", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "ec1b0192", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "b423468a", "metadata": {}, "source": [ "

Frage 14:

" ] }, { "cell_type": "code", "execution_count": null, "id": "55f3e772", "metadata": {}, "outputs": [], "source": [ "print(files[i])" ] }, { "cell_type": "code", "execution_count": null, "id": "d04e4f75", "metadata": {}, "outputs": [], "source": [ "data = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "print(data.shape)\n", "print(data.transpose().shape)\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \").transpose()" ] }, { "cell_type": "code", "execution_count": null, "id": "3b13ae1e", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "a7ccbfd0", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "9a1063f4", "metadata": {}, "source": [ "

Frage 15:

" ] }, { "cell_type": "code", "execution_count": null, "id": "58e05a94", "metadata": {}, "outputs": [], "source": [ "print(files[i])" ] }, { "cell_type": "code", "execution_count": null, "id": "0021d371", "metadata": {}, "outputs": [], "source": [ "data = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "print(data.shape)\n", "print(data.transpose().shape)\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \").transpose()" ] }, { "cell_type": "code", "execution_count": null, "id": "398ce456", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "f9cd2e41", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "c5d30eb3", "metadata": {}, "source": [ "

Frage 16:

" ] }, { "cell_type": "code", "execution_count": null, "id": "1ba34c39", "metadata": {}, "outputs": [], "source": [ "print(files[i])" ] }, { "cell_type": "code", "execution_count": null, "id": "4aa052b8", "metadata": {}, "outputs": [], "source": [ "data = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "print(data.shape)\n", "print(data.transpose().shape)\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \").transpose()" ] }, { "cell_type": "code", "execution_count": null, "id": "59d22334", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "5819546f", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "48dd9fa7", "metadata": {}, "source": [ "

Frage 17:

" ] }, { "cell_type": "code", "execution_count": null, "id": "1f59f2ee", "metadata": {}, "outputs": [], "source": [ "print(files[i])" ] }, { "cell_type": "code", "execution_count": null, "id": "4bc04a98", "metadata": {}, "outputs": [], "source": [ "data = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "print(data.shape)\n", "print(data.transpose().shape)\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \").transpose()" ] }, { "cell_type": "code", "execution_count": null, "id": "6f2b14f7", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "cca97cdf", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "9eb6b188", "metadata": {}, "source": [ "

Frage 18:

" ] }, { "cell_type": "code", "execution_count": null, "id": "6c88c480", "metadata": {}, "outputs": [], "source": [ "print(files[i])" ] }, { "cell_type": "code", "execution_count": null, "id": "8dc00e11", "metadata": {}, "outputs": [], "source": [ "data = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "print(data.shape)\n", "print(data.transpose().shape)\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \")\n", "#x, y = np.loadtxt(files[i], comments=\"#\", delimiter=\" \").transpose()" ] }, { "cell_type": "code", "execution_count": null, "id": "b0392ce9", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "83c45e11", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "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.13" } }, "nbformat": 4, "nbformat_minor": 5 }