Здесь показаны различия между двумя версиями данной страницы.
Предыдущая версия справа и слева Предыдущая версия Следующая версия | Предыдущая версия | ||
lesson9 [2018/12/19 14:16] golikov |
lesson9 [2020/03/25 16:28] (текущий) |
||
---|---|---|---|
Строка 1: | Строка 1: | ||
- | ====== 09 Урок. Анализ данных ====== | + | ====== Data Analysis ====== |
- | ===== Анализ данных в Excel ===== | + | ===== Data Analysis with Excel ===== |
- | Откройте полученный файл с данными с Excel. Нажмите Ctrl-O и выберите папку с файлом. По умолчанию Excel не открывает файлы типа txt, однако если в поле ввода имени ввести * и нажать на Enter, то будут показаны все файлы. Выберите файл с данными и нажмите Открыть. | + | Open the resulting data file with Excel. Press Ctrl-O and chose the folder containing the file. By default the Excel will not open txt form files, but when you enter * at the enter form and press Enter there will be displayed all files. Choose the data file and press Open. |
{{::09image001.png?nolink&400|}} | {{::09image001.png?nolink&400|}} | ||
- | Запустится мастер импорта. Нажмите Далее. | + | This will start the import wizard. Press Next. |
- | На первой странице укажите формат данных – «с разделителями». | + | On the first page specify the data form “with dividers”. |
{{::09image002.png?nolink&400|}} | {{::09image002.png?nolink&400|}} | ||
- | На второй странице укажите что символом-разделителем столбцов является пробел. | + | On the second page specify that column divider is the space character. |
{{::09image003.png?nolink&200|}} | {{::09image003.png?nolink&200|}} | ||
Строка 16: | Строка 16: | ||
{{::09image004.png?nolink&200|}} | {{::09image004.png?nolink&200|}} | ||
- | Убедитесь, что в окне с образцом разбора данных все столбцы с данными разделены вертикальными линиями и нажмите Далее. | + | Make sure that in the window with example of the data presentation all columns are divided by vertical lines, than press Next. |
{{::09image005.png?nolink&200|}} | {{::09image005.png?nolink&200|}} | ||
- | Формат данных столбцов оставьте общим. Нажмите Готово и данные будут загружены в лист Excel. | + | Column’s data form must be leaved as “general”. Press “Finished”, the data will be written into Excel sheet. |
{{::09image006.png?nolink&200|}} | {{::09image006.png?nolink&200|}} | ||
- | Как видите, данные разделены пустыми строками. Для удаления пустых строк выделите первый столбец. | + | Evidently, the data is divided by empty lines. To delete the empty lines select the first column. |
{{::09image007.png?nolink&200|}} | {{::09image007.png?nolink&200|}} | ||
- | Нажмите F5, и затем в открывшемся окне «Выделить». | + | Press F5, then press “Select” at the displayed window. |
{{::09image008.png?nolink&400|}} | {{::09image008.png?nolink&400|}} | ||
- | Установите переключатель в «пустые ячейки» и нажмите ОК. | + | Check the box of “empty cells” and press ОК. |
{{::09image009.png?nolink&400|}} | {{::09image009.png?nolink&400|}} | ||
- | Будут выбраны все пустые ячейки в первом столбце. | + | There will be selected all empty cells from the first column. |
{{::09image010.png?nolink&200|}} | {{::09image010.png?nolink&200|}} | ||
- | Теперь удалите строки, в которых выбраны эти ячейки. Нажмите кнопку **Удалить строки с листа**. | + | Now delete the lines where the empty cells are selected. Press. |
{{::09image011.png?nolink&200|}} | {{::09image011.png?nolink&200|}} | ||
- | Теперь данные готовы к анализу и построению графиков. | + | Now the data are ready for analysis and diagrams’ plotting. |
{{::09image012.png?nolink&600|}} | {{::09image012.png?nolink&600|}} | ||
- | Обратите внимание! Данные в первых строчках одинаковые, так как Орбикрафт начал вращаться не сразу, а с задержкой в 5 секунд. | + | Please note! The first lines contain identical data because the OrbiCraft began rotation with delay of 5 seconds. |
- | Вставьте в документ точечную диаграмму с гладкими кривыми и нажмите на кнопку выбора данных. | + | Insert into document the point diagram with smooth curves and press the button for choosing data. |
{{::09image014.png?nolink&200|}} | {{::09image014.png?nolink&200|}} | ||
Строка 55: | Строка 55: | ||
{{::09image015.png?nolink&100|}} | {{::09image015.png?nolink&100|}} | ||
- | Нажмите на кнопку добавления данных. | + | Press the button for adding data. |
{{::09image016.png?nolink&400|}} | {{::09image016.png?nolink&400|}} | ||
- | Имя ряда не вводите. Кликните в окошко «Значения Х» и выберите все ячейки из первого столбца, кликнув сверху по его названию. | + | Do not enter the name of the row. Click “Х values” window and choose all cells from the first column by clicking at column’s header. |
{{::09image018.png?nolink&200|}} | {{::09image018.png?nolink&200|}} | ||
Строка 65: | Строка 65: | ||
{{::09image020.png?nolink&200|}} | {{::09image020.png?nolink&200|}} | ||
- | Затем кликните в окошко «Значения Y», удалите символы «{1}», чтобы остался только знак равенства, а затем выберите полностью второй столбец с данными, кликнув сверху по его названию. | + | Then click “Y values”, delete “{1}” characters to leave equal mark only, and then choose the whole second column with data by clicking on the column header. |
{{::09image021.png?nolink&200|}} | {{::09image021.png?nolink&200|}} | ||
Строка 71: | Строка 71: | ||
{{::09image023.png?nolink&200|}} | {{::09image023.png?nolink&200|}} | ||
- | В окне выбора источника данных появится первый ряд с данными. | + | At the data source choose window there will be displayed the first data row. |
{{::09image024.png?nolink&200|}} | {{::09image024.png?nolink&200|}} | ||
- | Нажмите ОК чтобы закрыть окно выбора данных. | + | Press ОК to close data choose window. |
- | Наведите курсор на правый верхний угол второго столбца с данными и протяните его направо чтобы охватить все данные. | + | Put the cursor to the top right corner of the second data column and drag it right to seize all data. |
{{::09image025.png?nolink&600|}} | {{::09image025.png?nolink&600|}} | ||
- | Охватите столбцы от В до I. | + | Select the columns from В to I. |
{{::09image027.png?nolink&600|}} | {{::09image027.png?nolink&600|}} | ||
- | Теперь на графике будут отображены все данные, полученные с солнечных датчиков. | + | Now the diagram will include all data collected from solar sensors. |
- | Обратите внимание на «выбросы», которые встречаются на графике – это ошибки измерений, и на графике их отлично видно. | + | Please note the “outbreaks” at the diagram; it is measuring errors that are perfectly visible at the diagram. |
{{::09image029.png?nolink&400|}} | {{::09image029.png?nolink&400|}} | ||
- | Наведите курсор на выброс и найдите в таблице строку с неверными значениями. | + | Put the cursor at the “outbreak” and find the line with erroneous data in the table. |
{{::09image030.png?nolink&200|}} | {{::09image030.png?nolink&200|}} | ||
- | Обратите внимание как сильно отличаются ошибочные значения от стоящих рядом. | + | Please note that erroneous values are greatly different from adjacent values. |
{{::09image031.png?nolink&200|}} | {{::09image031.png?nolink&200|}} | ||
- | Измените вручную неверные значения, получив их усреднением соседних. | + | Manually change the incorrect values, changing them to the averages of the adjusting values. |
{{::09image032.png?nolink&200|}} | {{::09image032.png?nolink&200|}} | ||
- | График, построенный по очищенным данным, должен быть примерно вот таким. | + | The diagram plotted by the cleared data must be approximately like the one below: |
{{::09image033.png?nolink&400|}} | {{::09image033.png?nolink&400|}} | ||
- | Обратите внимание! Данные в первых строчках одинаковые и это хорошо видно на графике. | + | Please note! The first lines contain identical data; it is evident from the diagram. |
- | ===== Подготовка данных ===== | + | ===== Data preparation ===== |
+ | All decimal values in our table are pinned down to the left borders of the cells; it means that Excel interprets them as text data. For sure - the Excel uses for decimal numbers not a dot but comma character that divides the integer from its decimal part. | ||
+ | We must replace all dots to commas in our file. To do so press Ctrl-H and enter in the upper window the dot mark, and in the lower window enter the comma mark. | ||
+ | {{::09image034.png?nolink&400|}} | ||
+ | |||
+ | Scroll down the table and memorize the last value of the measured angle. | ||
+ | |||
+ | {{::09image035.png?nolink&600|}} | ||
+ | |||
+ | Delete all data at the start of the table up to this angle. | ||
+ | |||
+ | {{::09image037.png?nolink&600|}} | ||
+ | |||
+ | Now the data will start and end from approximately the same angle; hence the OrbiCraft performed one revolution around its radial axis. | ||
+ | Taking into account that magnetometer measures angles with some error, its readings is inadvisable base for positioning by solar sensors. | ||
+ | Since OrbiCraft during data collection rotated equably we can calculate the precision angles. | ||
+ | Count the overall number of the data lines (I personally counted 441 lines). | ||
+ | |||
+ | {{::09image039.png?nolink&200|}} | ||
+ | |||
+ | This number may be some less or some more depending on OrbiCraft rotation speed. | ||
+ | Since the circle usually divided to 360 degrees, the angle value at every line of our table must differ from previous value for 360/441= 0,816327 degree. | ||
+ | At the upper cell of the К column (К1 cell) copy the angle value from J1 cell. | ||
+ | At К2 cell enter this formula: | ||
+ | |||
+ | {{::09image040.png?nolink&100|}} | ||
+ | |||
+ | Double-click lower-right corner of the К2 cell, the formula will be copied to all К column cells. | ||
+ | |||
+ | {{::09image041.png?nolink&100|}} | ||
+ | |||
+ | Now all angle values must be normalized to the range from -180 to 180 degrees. | ||
+ | Find the line where angle value is more than 180 degree; change the formula in this line. | ||
+ | |||
+ | {{::09image042.png?nolink&200|}} | ||
+ | |||
+ | Formulas in the other cells must not be changed. Now all angle values in the table are in range from от -180 to 180. | ||
+ | |||
+ | {{::09image043.png?nolink&100|}} | ||
+ | |||
+ | For visual estimation of magnetometer error plot the diagram by outer right columns with angle values. | ||
+ | |||
+ | {{::09image044.png?nolink&400|}} | ||
+ | |||
+ | The diagram clearly shows that even the calibrated magnetometer is in error during angle measurement. | ||
+ | Now we must delete all redundant data from the table. | ||
+ | Copy К column and insert the data as values to L column. | ||
+ | Now delete the J and K columns, also the first А column, with values of measurement time. | ||
+ | Although in Excel the integer part divided from decimal by comma, the Python uses for this a dot. Using replace function (Ctrl-H) replaces all commas to dots in the file. | ||
+ | |||
+ | {{::09image045.png?nolink&400|}} | ||
+ | |||
+ | Now transfer all processed data back to Notepad++. | ||
+ | Select all data in Excel and press Ctrl-C. | ||
+ | Open Notepad++, create new project and insert the data using Ctrl-V. | ||
+ | |||
+ | {{::09image046.png?nolink&400|}} | ||
+ | |||
+ | Data inserted are divided by tabulation marks and line hyphen characters, but we need the division by Python language rules – division by comma and space characters. Press Ctrl-H, enter \t to the upper window, enter comma with space character to the lower window. Press “Replace all” or “Replace in all open documents”. | ||
+ | |||
+ | {{::09image047.png?nolink&400|}} | ||
+ | |||
+ | Now we will replace the line hyphen characters in similar manner. Press Ctrl-H, enter \r\n to the upper window, enter comma with space character to the lower window. Press “Replace all” or “Replace in all open documents”. | ||
+ | |||
+ | {{::09image048.png?nolink&400|}} | ||
+ | |||
+ | Now all data are listed as one line. We will create the array based on this line. Save the data file in .txt form. | ||