From 994de5362034a61feb0ab32629881e5565e3d836 Mon Sep 17 00:00:00 2001 From: Jean Connelly Date: Thu, 14 Mar 2024 10:12:41 -0400 Subject: [PATCH] Add notebook I've been using to make regress scripts (#440) --- validate/make_regress.ipynb | 174 ++++++++++++++++++++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 validate/make_regress.ipynb diff --git a/validate/make_regress.ipynb b/validate/make_regress.ipynb new file mode 100644 index 00000000..1fd3980e --- /dev/null +++ b/validate/make_regress.ipynb @@ -0,0 +1,174 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Print out some text that can be used as a regression-data-generation script for starcheck.\n", + "\n", + "The script assumes that the code to be tested is in ~/git/starcheck and can be run with sandbox_starcheck" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "from kadi import commands\n", + "from cxotime import CxoTime\n", + "import numpy as np" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "cmds = commands.get_cmds(start='2020:001')\n", + "# remove ORBPOINT commands or CMD_EVT cmds\n", + "cmds = cmds[(cmds['type'] != 'ORBPOINT') & (cmds['source'] != 'CMD_EVT')]" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "_, idx = np.unique(cmds['source'], return_index=True)\n", + "weeks = list(cmds['source'][np.sort(idx)][::-1])" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "# For this test, just use the last couple of weeks\n", + "weeks = weeks[0:2]\n", + "#weeks = ['DEC2523B', 'MAY2923A', 'APR0323A', 'MAY2322A']" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['FEB1124A', 'FEB0724A']\n" + ] + } + ], + "source": [ + "print(weeks)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "touch combined_diff.txt\n", + "touch combined_diff_vehicle.txt\n", + "\n", + "~/git/starcheck/sandbox_starcheck -dir /data/mpcrit1/mplogs/2024/FEB1124/oflsa -out FEB1124a_test\n", + "starcheck -dir /data/mpcrit1/mplogs/2024/FEB1124/oflsa -out FEB1124a_master\n", + "/proj/sot/ska/bin/diff2html FEB1124a_master.txt FEB1124a_test.txt > FEB1124a_diff.html\n", + "echo ---------------------------------------- >> combined_diff.txt\n", + "echo \"week = FEB1124a\" >> combined_diff.txt\n", + "diff -u FEB1124a_master.txt FEB1124a_test.txt >> combined_diff.txt\n", + "\n", + "~/git/starcheck/sandbox_starcheck -vehicle -dir /data/mpcrit1/mplogs/2024/FEB1124/oflsa -out FEB1124a_vtest\n", + "starcheck -vehicle -dir /data/mpcrit1/mplogs/2024/FEB1124/oflsa -out FEB1124a_vmaster\n", + "/proj/sot/ska/bin/diff2html FEB1124a_vmaster.txt FEB1124a_vtest.txt > FEB1124a_vdiff.html\n", + "echo ---------------------------------------- >> combined_diff_vehicle.txt\n", + "echo \"week = FEB1124a\" >> combined_diff_vehicle.txt\n", + "diff -u FEB1124a_vmaster.txt FEB1124a_vtest.txt >> combined_diff_vehicle.txt\n", + "\n", + "~/git/starcheck/sandbox_starcheck -dir /data/mpcrit1/mplogs/2024/FEB0724/oflsa -out FEB0724a_test\n", + "starcheck -dir /data/mpcrit1/mplogs/2024/FEB0724/oflsa -out FEB0724a_master\n", + "/proj/sot/ska/bin/diff2html FEB0724a_master.txt FEB0724a_test.txt > FEB0724a_diff.html\n", + "echo ---------------------------------------- >> combined_diff.txt\n", + "echo \"week = FEB0724a\" >> combined_diff.txt\n", + "diff -u FEB0724a_master.txt FEB0724a_test.txt >> combined_diff.txt\n", + "\n", + "~/git/starcheck/sandbox_starcheck -vehicle -dir /data/mpcrit1/mplogs/2024/FEB0724/oflsa -out FEB0724a_vtest\n", + "starcheck -vehicle -dir /data/mpcrit1/mplogs/2024/FEB0724/oflsa -out FEB0724a_vmaster\n", + "/proj/sot/ska/bin/diff2html FEB0724a_vmaster.txt FEB0724a_vtest.txt > FEB0724a_vdiff.html\n", + "echo ---------------------------------------- >> combined_diff_vehicle.txt\n", + "echo \"week = FEB0724a\" >> combined_diff_vehicle.txt\n", + "diff -u FEB0724a_vmaster.txt FEB0724a_vtest.txt >> combined_diff_vehicle.txt\n" + ] + } + ], + "source": [ + "print(\"touch combined_diff.txt\")\n", + "print(\"touch combined_diff_vehicle.txt\")\n", + "for load in weeks:\n", + " if load in ['CMD_EVT', 'MAR1323A', 'DEC2820A', 'JUL0620B']:\n", + " continue\n", + " year_two = load[5:7]\n", + " if int(year_two) > 90:\n", + " year = '19' + year_two\n", + " else:\n", + " year = '20' + year_two\n", + " week = load[0:7]\n", + " rev = load[7:8].lower()\n", + "\n", + " print(\"\")\n", + " print(f\"~/git/starcheck/sandbox_starcheck -dir /data/mpcrit1/mplogs/{year}/{week}/ofls{rev} -out {week}{rev}_test\")\n", + " print(f\"starcheck -dir /data/mpcrit1/mplogs/{year}/{week}/ofls{rev} -out {week}{rev}_master\")\n", + " print(f\"/proj/sot/ska/bin/diff2html {week}{rev}_master.txt {week}{rev}_test.txt > {week}{rev}_diff.html\")\n", + " print(\"echo ---------------------------------------- >> combined_diff.txt\")\n", + " print(f\"echo \\\"week = {week}{rev}\\\" >> combined_diff.txt\")\n", + " print(f\"diff -u {week}{rev}_master.txt {week}{rev}_test.txt >> combined_diff.txt\")\n", + "\n", + " print(\"\")\n", + " print(f\"~/git/starcheck/sandbox_starcheck -vehicle -dir /data/mpcrit1/mplogs/{year}/{week}/ofls{rev} -out {week}{rev}_vtest\")\n", + " print(f\"starcheck -vehicle -dir /data/mpcrit1/mplogs/{year}/{week}/ofls{rev} -out {week}{rev}_vmaster\")\n", + " print(f\"/proj/sot/ska/bin/diff2html {week}{rev}_vmaster.txt {week}{rev}_vtest.txt > {week}{rev}_vdiff.html\")\n", + " print(\"echo ---------------------------------------- >> combined_diff_vehicle.txt\")\n", + " print(f\"echo \\\"week = {week}{rev}\\\" >> combined_diff_vehicle.txt\")\n", + " print(f\"diff -u {week}{rev}_vmaster.txt {week}{rev}_vtest.txt >> combined_diff_vehicle.txt\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "ska3", + "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.10.8" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}