diff --git a/evaluation_run.sh b/EVAL_RUN.sh similarity index 55% rename from evaluation_run.sh rename to EVAL_RUN.sh index f4ec227a623e0793cdd99d7c6e6c25a7c7b1ba1b..e6fa808eb2a61ff598583c8090ebe5462dff410e 100644 --- a/evaluation_run.sh +++ b/EVAL_RUN.sh @@ -4,21 +4,26 @@ BIN_LENGTH=0.1 # ANALYSE WHOLE DATA SET AND BIN ACCORDING TO VARIABLE ABOVE -echo "EXECUTING MAIN.PY" -python3 main_data.py $BIN_LENGTH +echo "EXECUTING DATA EVALUATION" +python3 data_eval.py $BIN_LENGTH echo # REWRITE EACH BINNED FILE INTO BINNED STATISTICS FILE -echo "EXECUTING BINNED_STATS.PY" +echo "EXECUTING STATISTICS ON BINNED DATA" python3 binned_stats.py $BIN_LENGTH echo # REITERATE PROCESS, BUT SPLIT BETWEEN APPROACH AND RECESSION (INGRESS AND EGRESS) -echo "EXECUTING APPROACH_RECESSION.PY" +echo "EXECUTING INGRESS / EGRESS ANALYSIS" python3 ingress_egress.py $BIN_LENGTH echo # GENERATE FINAL PLOTS -echo "EXECUTING FINAL_PLOTS.PY" -python3 obs_data_plots.py +echo "GENERATING PLOTS OF OBSERVATION DATA" +python3 observation_plots.py +echo + +# GENERATE FINAL PLOTS +echo "GENERATING COMPARISON PLOTS FOR PAPER" +python3 comparison_plots.py echo diff --git a/MODULES/Statistics/turn_around.py b/MODULES/PSPops/data_turnaround.py similarity index 98% rename from MODULES/Statistics/turn_around.py rename to MODULES/PSPops/data_turnaround.py index 9290f39041f04ef3b73c3fc7c4b9e49ca5eab968..b9c275dde8d55b9436f6a2c22111047544078f56 100644 --- a/MODULES/Statistics/turn_around.py +++ b/MODULES/PSPops/data_turnaround.py @@ -33,6 +33,7 @@ def approach_recession_slicing(encounter_num, data: tp.Dict): # Initialize empty temporary dictionaries data_1 = {} data_2 = {} + designation = "unclear" # Determine the index of the turn-around point tap = find_turn_around(data["r"]) diff --git a/MODULES/Plotting/__pycache__/comp_plotset.cpython-38.pyc b/MODULES/Plotting/__pycache__/comp_plotset.cpython-38.pyc deleted file mode 100644 index 10c4fb56251b40a2655827254d55c3c55e22b4a1..0000000000000000000000000000000000000000 Binary files a/MODULES/Plotting/__pycache__/comp_plotset.cpython-38.pyc and /dev/null differ diff --git a/MODULES/Plotting/__pycache__/general_plotset.cpython-38.pyc b/MODULES/Plotting/__pycache__/general_plotset.cpython-38.pyc deleted file mode 100644 index c94825d8bfca2c19e434ca8ad1b786000866c798..0000000000000000000000000000000000000000 Binary files a/MODULES/Plotting/__pycache__/general_plotset.cpython-38.pyc and /dev/null differ diff --git a/MODULES/Plotting/__pycache__/obs_plotset.cpython-38.pyc b/MODULES/Plotting/__pycache__/obs_plotset.cpython-38.pyc deleted file mode 100644 index 8c776f2f7b15a524b72cd8713dda0eddf29e36fb..0000000000000000000000000000000000000000 Binary files a/MODULES/Plotting/__pycache__/obs_plotset.cpython-38.pyc and /dev/null differ diff --git a/MODULES/Plotting/comp_plotset.py b/MODULES/Plotting/plotset_comparison.py similarity index 100% rename from MODULES/Plotting/comp_plotset.py rename to MODULES/Plotting/plotset_comparison.py diff --git a/MODULES/Plotting/general_plotset.py b/MODULES/Plotting/plotset_general.py similarity index 100% rename from MODULES/Plotting/general_plotset.py rename to MODULES/Plotting/plotset_general.py diff --git a/MODULES/Plotting/obs_plotset.py b/MODULES/Plotting/plotset_observations.py similarity index 100% rename from MODULES/Plotting/obs_plotset.py rename to MODULES/Plotting/plotset_observations.py diff --git a/MODULES/Statistics/__pycache__/data_binning.cpython-38.pyc b/MODULES/Statistics/__pycache__/data_binning.cpython-38.pyc deleted file mode 100644 index e2725fd92e870435926f15c15696ed51ad325f27..0000000000000000000000000000000000000000 Binary files a/MODULES/Statistics/__pycache__/data_binning.cpython-38.pyc and /dev/null differ diff --git a/MODULES/Statistics/__pycache__/data_read.cpython-38.pyc b/MODULES/Statistics/__pycache__/data_read.cpython-38.pyc deleted file mode 100644 index b7034d21bf64cacee0c1e9ace0915efd9cf921fe..0000000000000000000000000000000000000000 Binary files a/MODULES/Statistics/__pycache__/data_read.cpython-38.pyc and /dev/null differ diff --git a/MODULES/Statistics/__pycache__/stats.cpython-38.pyc b/MODULES/Statistics/__pycache__/stats.cpython-38.pyc deleted file mode 100644 index 6af4c6e2875b6fa5904cf23862edb348a23b4580..0000000000000000000000000000000000000000 Binary files a/MODULES/Statistics/__pycache__/stats.cpython-38.pyc and /dev/null differ diff --git a/MODULES/Statistics/__pycache__/turn_around.cpython-38.pyc b/MODULES/Statistics/__pycache__/turn_around.cpython-38.pyc deleted file mode 100644 index 53f96f5baec0ecf66683e0a323a3b36ba8294f67..0000000000000000000000000000000000000000 Binary files a/MODULES/Statistics/__pycache__/turn_around.cpython-38.pyc and /dev/null differ diff --git a/MODULES/Statistics/data_binning.py b/MODULES/Statistics/stats_databin.py similarity index 100% rename from MODULES/Statistics/data_binning.py rename to MODULES/Statistics/stats_databin.py diff --git a/MODULES/Statistics/data_read.py b/MODULES/Statistics/stats_dataread.py similarity index 100% rename from MODULES/Statistics/data_read.py rename to MODULES/Statistics/stats_dataread.py diff --git a/MODULES/Statistics/stats.py b/MODULES/Statistics/stats_general.py similarity index 100% rename from MODULES/Statistics/stats.py rename to MODULES/Statistics/stats_general.py diff --git a/MODULES/__init__.py b/MODULES/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/README.md b/README.md index b86e3a81bd90da1b72174b343d319cc82e9c03d7..c43906ef42c7811456c22072d6783308a71d51ad 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,11 @@ The data is reduced according to the conservative boundaries of the [SWEAP User ## Structure The code execution routine can be read in the bash-script `evaluation_run.sh`. It sets the size of the radial bins as a global variable and then: -1. `main_data.py`: Reads in the observational data files, sortes ALL data into distance bins and writes data file for each distance bin into `STATISTICS/BINNED_DATA` +1. `data_eval.py`: Reads in the observational data files, sortes ALL data into distance bins and writes data file for each distance bin into `STATISTICS/BINNED_DATA` 2. `binnded_stats.py`: Takes all files in previously mentioned folder and creates a new file, `PSP_statistics.dat`, with mean+stddev and median+q1/q3 for each major parameter and distance bin. Also creates bar charts for each major parameter and distance bin 3. `ingress_egress.py`: Similar as above, but the data is split between ingress and egress phase for each encounter -4. `obs_data_plots.py`: Creates median+stddev and mean+q1/q3 plots for all three major parameters +4. `observation_plots.py`: Creates median+stddev and mean+q1/q3 plots for all three major parameters +5. `comparison_plots.py`: Collects the evaluated measurement data and creates plots together with a radial profile of the simulation results. -Finally, `comp_data_plots.py`collects the evaluated measurement data and creates plots together with a radial profile of the simulation results. \ No newline at end of file + +## Selected Results \ No newline at end of file diff --git a/TESTING/Test.png b/TESTING/Test.png deleted file mode 100644 index 17e9bc85c2ecf524c74e282408c8cf3fe764817e..0000000000000000000000000000000000000000 Binary files a/TESTING/Test.png and /dev/null differ diff --git a/TESTING/plot_logT.png b/TESTING/plot_logT.png deleted file mode 100644 index a33aca3b4dcee0013851f48a9a29c71eedb6d0f9..0000000000000000000000000000000000000000 Binary files a/TESTING/plot_logT.png and /dev/null differ diff --git a/TESTING/plot_vr.png b/TESTING/plot_vr.png deleted file mode 100644 index 004d704acaa00458951b0ab61d35407892117aa0..0000000000000000000000000000000000000000 Binary files a/TESTING/plot_vr.png and /dev/null differ diff --git a/TESTING/psp_swp_spc_l3i_20211117_v02.cdf b/TESTING/psp_swp_spc_l3i_20211117_v02.cdf deleted file mode 100644 index adb641f3f4584932c96daa492fb563b0579deacc..0000000000000000000000000000000000000000 Binary files a/TESTING/psp_swp_spc_l3i_20211117_v02.cdf and /dev/null differ diff --git a/TESTING/testing.py b/TESTING/testing.py deleted file mode 100644 index 21f269ec7a2e909d7dc328258b573a0083a68e3a..0000000000000000000000000000000000000000 --- a/TESTING/testing.py +++ /dev/null @@ -1,59 +0,0 @@ -import os -import sys -from unipath import Path -import numpy as np -import matplotlib.pyplot as plt -from spacepy import pycdf -from astropy.constants import R_sun - -# Append custom Python modules from parent directory -sys.path.append(Path(sys.path[0]).parent) -from MODULES.PSPops import data_quality as dq -from MODULES.PSPops import data_transformation as dt -from MODULES.Plotting import obs_plotset as ps -from MODULES.PSPops import data_handling as dh -from MODULES.Statistics import data_binning as db -from MODULES.Statistics import stats as st - - -# Plot set up -ps.rc_setup() - -# CDF library (is needed to interface with the measurement data files) -# see https://cdf.gsfc.nasa.gov/ -os.environ["CDF_LIB"] = "/usr/local/cdf/lib" - -# open CDF file and generate faulty index array -cdf_data = pycdf.CDF("psp_swp_spc_l3i_20211117_v02.cdf") -data = dh.data_generation(cdf_data) - -# Indices of non-usable data from general flag + reduction -bad_ind = dq.general_flag(data["dqf"]) -data = dh.full_reduction(data, bad_ind) - -# Additional reduction from failed measurement indices -mf_ind = dq.full_meas_eval(data) -data = dh.full_reduction(data, mf_ind) - -# Add to data dictionary (spherical coordinates) -data["r"], data["theta"], data["phi"] = dt.pos_cart_to_sph(data["pos"]) - -# Add to data dictionary (temperature) -data["T"] = dt.wp_to_temp(data["wp"]) -data["dThi"] = dt.wp_to_temp(data["dwphi"]) -data["dTlo"] = dt.wp_to_temp(data["dwplo"]) - -# Testing binning into radial bins -distance_bins = db.create_bins(0, 100, .5) -bin_indices = db.sort_bins(distance_bins, data["r"] * 1e3 / R_sun.value) - -test_r = st.slice_index_list(data["r"], bin_indices["(46.5, 47.0)"]) * 1e3 / R_sun.value -test_v = st.slice_index_list(data["vr"], bin_indices["(46.5, 47.0)"]) - -plt.plot(test_r, test_v, zorder=2) -plt.hlines(np.mean(test_v), np.min(test_r), np.max(test_r), color="black", - zorder=3, lw=2, ls="--") -plt.fill_between(test_r, np.mean(test_v) + np.std(test_v), - np.mean(test_v) - np.std(test_v), - color="grey", alpha=0.35, zorder=1) -plt.show() diff --git a/TESTING/testing_plots.py b/TESTING/testing_plots.py deleted file mode 100644 index f5ef6f4988bbe05118b1a27af70e45ba908ac8d4..0000000000000000000000000000000000000000 --- a/TESTING/testing_plots.py +++ /dev/null @@ -1,33 +0,0 @@ -import matplotlib.pyplot as plt -import matplotlib as mpl -import numpy as np - -"""Generalized plot attributes""" -mpl.rcParams["xtick.direction"] = "in" -mpl.rcParams["xtick.labelsize"] = "large" -mpl.rcParams["xtick.major.width"] = 1.5 -mpl.rcParams["xtick.minor.width"] = 1.5 -mpl.rcParams["xtick.minor.visible"] = "True" -mpl.rcParams["xtick.top"] = "True" - -mpl.rcParams["ytick.direction"] = "in" -mpl.rcParams["ytick.labelsize"] = "large" -mpl.rcParams["ytick.major.width"] = 1.5 -mpl.rcParams["ytick.minor.width"] = 1.5 -mpl.rcParams["ytick.minor.visible"] = "True" -mpl.rcParams["ytick.right"] = "True" - -mpl.rcParams["axes.grid"] = "True" -mpl.rcParams["axes.linewidth"] = 1.5 -mpl.rcParams["axes.labelsize"] = "large" - -x = np.arange(1, 10, 0.01) -y1 = np.sin(x) -y2 = np.sin(x+0.5) - -fig, ax = plt.subplots(1, 1, figsize=(15, 4.5)) -ax.plot(x, y1, lw=2.5, c="darkviolet") -ax.plot(x, y2, lw=2.5, ls="--", c="fuchsia") - -plt.tight_layout() -plt.show() diff --git a/binned_stats.py b/binned_stats.py index 13577d1395a8248cf252cc226a342528ddd4a3ab..57464d7a5bc9019da8eec5a060526e9bae434b22 100644 --- a/binned_stats.py +++ b/binned_stats.py @@ -1,10 +1,10 @@ import sys import os import numpy as np -from MODULES.Plotting import general_plotset as gp -from MODULES.Plotting import obs_plotset as op -from MODULES.Statistics import stats as st -from MODULES.Statistics import data_binning as db +from MODULES.Plotting import plotset_general as gp +from MODULES.Plotting import plotset_observations as op +from MODULES.Statistics import stats_general as st +from MODULES.Statistics import stats_databin as db # DESIGNATE BINNED DATA LOCATION BIN_DATA_LOCATION = f"{sys.path[0]}/STATISTICS/BINNED_DATA" diff --git a/comp_data_plots.py b/comparison_plots.py similarity index 88% rename from comp_data_plots.py rename to comparison_plots.py index 0a70d4898896f5f9dcbc11ab118325cdfa82b003..7abc7b13099e87ebaa0ae235943b5e7647bf1042 100644 --- a/comp_data_plots.py +++ b/comparison_plots.py @@ -1,7 +1,7 @@ import sys -from MODULES.Statistics import data_read -from MODULES.Plotting import general_plotset as gp -from MODULES.Plotting import comp_plotset as cp +from MODULES.Statistics import stats_dataread +from MODULES.Plotting import plotset_general as gp +from MODULES.Plotting import plotset_comparison as cp # Necessary global variables diff --git a/main_data.py b/data_eval.py similarity index 96% rename from main_data.py rename to data_eval.py index 1aea3ab3ef95a908953e7c84f3775e58ead8173f..3b45b2c7a56b50458b70f76a57724da305443ff7 100644 --- a/main_data.py +++ b/data_eval.py @@ -2,14 +2,13 @@ import os import sys import numpy as np from spacepy import pycdf -from MODULES.PSPops import data_quality as dq +from MODULES.PSPops import data_quality as dq, data_turnaround as ta from MODULES.PSPops import data_transformation as dt from MODULES.PSPops import data_handling as dh from MODULES.PSPops import miscellaneous as misc -from MODULES.Plotting import general_plotset as gp -from MODULES.Statistics import data_binning as db -from MODULES.Statistics import stats as st -from MODULES.Statistics import turn_around as ta +from MODULES.Plotting import plotset_general as gp +from MODULES.Statistics import stats_databin as db +from MODULES.Statistics import stats_general as st from MODULES.Miscellaneous import write_log from astropy.constants import R_sun diff --git a/ingress_egress.py b/ingress_egress.py index ea4bf7289ce84338e6271dc934d40c60608461e4..aa436fb2147e5257b5253071dcf9164dbbfb8f77 100644 --- a/ingress_egress.py +++ b/ingress_egress.py @@ -7,10 +7,10 @@ import numpy as np from astropy.constants import R_sun from astropy import units as u from MODULES.PSPops import data_handling as dh -from MODULES.Plotting import general_plotset as gp -from MODULES.Plotting import obs_plotset as op -from MODULES.Statistics import data_binning as db -from MODULES.Statistics import stats as st +from MODULES.Plotting import plotset_general as gp +from MODULES.Plotting import plotset_observations as op +from MODULES.Statistics import stats_databin as db +from MODULES.Statistics import stats_general as st # DISTANCE BIN SIZE IN RSOL DISTANCE_BIN_SIZE = float(sys.argv[1]) diff --git a/obs_data_plots.py b/observation_plots.py similarity index 82% rename from obs_data_plots.py rename to observation_plots.py index ee8e38b9326b2fa685f3f3ff60c744f9f4d818ea..1ef6953f5d528e0b3f49d9159c6cc0e333e5e128 100644 --- a/obs_data_plots.py +++ b/observation_plots.py @@ -1,7 +1,7 @@ import sys from MODULES.PSPops import data_handling as dh -from MODULES.Plotting import general_plotset as gp -from MODULES.Plotting import obs_plotset as op +from MODULES.Plotting import plotset_general as gp +from MODULES.Plotting import plotset_observations as op # GLOBAL: STAT FILE NAME