Skip to content

Commit

Permalink
more basic instructions added
Browse files Browse the repository at this point in the history
  • Loading branch information
GuenterQuast committed Sep 5, 2023
1 parent 0936786 commit 11b84d3
Showing 1 changed file with 65 additions and 25 deletions.
90 changes: 65 additions & 25 deletions ipynb_examples/tutorial_StandAloneTools.ipynb
Expand Up @@ -112,7 +112,36 @@
"metadata": {},
"source": [
"--- \n",
"## Plot data fom CSV file"
"## Plot data fom CSV file\n",
"\n",
"CSV or \"comma separated values\" is a common data format in Data Science to store tabular data in human-radable format.\n",
"\n",
"As an example, we condiser the file `Wellenform.csv\"; the first few kines look as follows:\n",
"\n",
"```\n",
"Time,Channel A\n",
"(ms),(V)\n",
"\n",
"-0.34927999,-0.00045778\n",
"-0.34799999,-0.00045778\n",
"-0.34671999,-0.00045778\n",
"-0.34543999,-0.00045778\n",
" ...\n",
"\n",
"```\n",
"These first three lines constiute the so-called \"header\" with meta-information describing the nature of\n",
"the data in each of the columns with numerical values constituting the actueal data. \n",
"The first line contains the so-calles \"keys\", i. e. the names of the data entries in the respecive columns, \n",
"and the second line contains the physical units of these values. The third line is an empty one. \n",
"The so-called \"field separator\" is `','` in this case.\n",
"\n",
"With this information and the help of the script introduced in the prevous cell we can now plot the data, \n",
"i. e. generate a graphical representation thereof. As `,` is the default field separator, the only additional\n",
"information needed is the total number of header lines, which is 3, so the command to execute is\n",
"\n",
"```%run plotCSV -H 3 Wellenform.csv```.\n",
"\n",
"Try it out on the following code cell:"
]
},
{
Expand All @@ -122,7 +151,15 @@
"metadata": {},
"outputs": [],
"source": [
"%run plotCSV -H 2 Wellenform.csv"
"%run plotCSV -H 3 Wellenform.csv"
]
},
{
"cell_type": "markdown",
"id": "ab25d1fd-54d6-437e-a219-770ba6a7c9c9",
"metadata": {},
"source": [
"As a result, a properly labelled graph is shown. "
]
},
{
Expand All @@ -134,10 +171,10 @@
"\n",
"## Statistical analysis of measured data\n",
"\n",
"The first step in data analyis usually consists of inspecting a frequency distribution of measured data.\n",
"A typicalfirst step in data analyis consists of inspecting a frequency distribution of measured data.\n",
"The program *plotData* contains the necessary code; it shows the distribution and calculates the mean\n",
"and standard deviation of the data. The file *simple_data.yaml*, as shown below, contains all the necessary\n",
"input an can easily be worked on using with the Editor provided by Jupyter. Just double-click on the file name\n",
"input an can easily be worked on using the Editor provided by Jupyter. Just double-click on the file name\n",
"in the file list on the left-hand side in your Jupyter window to open it. To generate a new file, right-click\n",
"in the list, provide a name of a new, empty file, and open it by double-clicking. \n",
"\n",
Expand Down Expand Up @@ -165,7 +202,11 @@
" return np.exp(-0.5 *((x-mu)/sigma)**2)/np.sqrt(2.*np.pi*sigma**2)\n",
"```\n",
"\n",
"The simple command to run the example looks like this: "
"The simple command to run the example looks like this: \n",
"\n",
"```\n",
"%run plotData simple_data.ydat\n",
"```"
]
},
{
Expand Down Expand Up @@ -193,8 +234,8 @@
"id": "862128be-15b2-4599-bb1b-4fb49463f6c9",
"metadata": {},
"source": [
"Fiting models to experimental data, or parametrizing measuements with a functional dependence,\n",
"is one of the routine tasks in data analysis. Two stand-alone fitting programs relying on\n",
"Fitting models to experimental data, or parametrizing measuements with a functional dependence,\n",
"is another one of the routine tasks in data analysis. Two stand-alone fitting programs relying on\n",
"the *phyFit* or *kafe2* packages are provided: \n",
"\n",
" - kafe2go\n",
Expand Down Expand Up @@ -271,9 +312,7 @@
"cell_type": "code",
"execution_count": null,
"id": "ad79f5d2-04cc-432b-a239-8b65dd3cd7b2",
"metadata": {
"scrolled": true
},
"metadata": {},
"outputs": [],
"source": [
"%run run_phyFit.py test_xy.yfit"
Expand Down Expand Up @@ -315,9 +354,7 @@
"cell_type": "code",
"execution_count": null,
"id": "90bb50ab-0c1b-47e1-9727-53e4daedd01f",
"metadata": {
"scrolled": true
},
"metadata": {},
"outputs": [],
"source": [
"%run run_phyFit.py hFit.yfit"
Expand Down Expand Up @@ -376,9 +413,7 @@
"cell_type": "code",
"execution_count": null,
"id": "85571254-e2a0-4675-aabe-ab4ce36f1a20",
"metadata": {
"scrolled": true
},
"metadata": {},
"outputs": [],
"source": [
"%run csv2yml.py AudioData.csv"
Expand All @@ -390,9 +425,9 @@
"metadata": {},
"source": [
"The CSV tools of PhyPraKit also can handle the output of typical Windows-Programs using decimal commas \n",
"instead of the internationally used dot. To be unambiguous, the field delimiter is then \";\" and not the\n",
"usual commal. We just need to tell the tools *csv2yml*, *plotCSV* or *smoothCSV* to obtain \n",
"valid *yaml* format from such an input:"
"instead of the internationally used dot. To be unambiguous, the field delimiter is then `';'` and not the\n",
"usual commal. We just need to tell the tools *csv2yml*, *plotCSV* or *smoothCSV* to take this into account.\n",
"To generate a valid *yaml* block from such an input, execute: "
]
},
{
Expand All @@ -410,9 +445,14 @@
"id": "f70cff39-3ff7-458c-b3d7-018ae9e1614a",
"metadata": {},
"source": [
"Using a text editor, e.g. by creating a new, empty file by right-clicking in the director list on the left-hand side and double-clicking on it,\n",
"the *yaml*-block from the above output can be copied to a new *yaml*-file. This file should also contain additional information, most importantly the \"meta-data\" giving informatin \n",
"on the origin of the data. Possibly the key fields need adjustments to be compatible with *run_phyFit* or *kafe2go*, and a fit model should be added.\n",
"Using a text editor, e.g. by creating a new, empty file by right-clicking in the director list on the left-hand side\n",
"and double-clicking on it, the *yaml*-block from the above output can be copied to a new *yaml*-file. Mark by moving\n",
"the mouse over the respecive lines with left button pressed, then press `<ctrl>-c` to copy; activate the destination \n",
"window and area by pointing with the mouse and left-clicking, then type `<ctrl>-v`. \n",
"\n",
"This file should also contain additional information, most importantly the \"meta-data\" giving information \n",
"on the origin of the data. Possibly the key fields need adjustments to be compatible with *run_phyFit* or \n",
"*kafe2go*, and a fit model should be added.\n",
"\n",
"A valid fit-input file for a straight-line-fit based on the data contained in the file *Excel_output.csv* looks like this:\n",
"\n",
Expand Down Expand Up @@ -447,8 +487,8 @@
"source": [
"### Fixing oversampling issues\n",
"\n",
"Sometimes exported CSV data suffer from oversampling, i.e. far to many values are recorded for\n",
"as meaningful analysis of the data. Fortunately, this can be fixed retrospectively usin the\n",
"Sometimes exported CSV data suffer from oversampling, i.e. far too many values are recorded for\n",
"as meaningful analysis of the data. Fortunately, this can be fixed retrospectively using the\n",
"stand-alone tool *smoothCSV*. Execute the following line to see what it is meant to do:"
]
},
Expand Down Expand Up @@ -506,7 +546,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
"version": "3.11.4"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 11b84d3

Please sign in to comment.