Skip to content
Snippets Groups Projects
Commit a7d83951 authored by simon-ast's avatar simon-ast
Browse files

Documentation

parent a4e3fdbb
No related branches found
No related tags found
No related merge requests found
......@@ -45,7 +45,10 @@ def wp_to_temp(thermal_speed: np.ndarray) -> np.ndarray:
def abs_to_rel_time(epoch_array: np.ndarray) -> np.ndarray:
"""DOC"""
"""
Transforms absolute time (datetime.datetime) into relative time
between 0 = start and 1 = finish
"""
start = epoch_array[0]
end = epoch_array[-1]
......
......@@ -9,7 +9,10 @@ PLOT_SAVE_DIR = f"{sys.path[0]}/PLOTS"
def theta_time_analysis(theta_list: list,
rel_time: list,
label: list) -> None:
"""DOC"""
"""
Plots heliolatitude vs. time for specified arrays, to be used to
analyse behaviour during one encounter phase
"""
# Necessary parameters
theta_full = np.concatenate(np.array(theta_list, dtype="object"))
......
import matplotlib.pyplot as plt
import numpy as np
def plot_setup(indicator: str):
"""DOC"""
"""General plot setup (x-label and size)"""
valid_ind = ["vr", "np", "T"]
assert indicator in valid_ind, f"{indicator} NOT RECOGNIZED!"
......@@ -31,7 +30,10 @@ def plot_setup(indicator: str):
def comparison_plot(indicator: str, obs_data, sim_data, save_dir):
"""DOC"""
"""
Combine simulation radial profile and observational data into
one plot
"""
# Set-up plots
fig, ax = plot_setup(indicator)
......
......@@ -4,7 +4,7 @@ import numpy as np
def plot_setup(indicator: str):
"""DOC"""
"""General plot setup (x-label and size)"""
# Make sure that oly valid indicators are used
valid_ind = ["Radial velocity", "Density", "Temperature"]
assert indicator in valid_ind, f"{indicator} NOT RECOGNIZED!"
......
......@@ -20,7 +20,7 @@ class PSPStatData:
class StatDataSplit:
"""DOC"""
"""Sub-class to access relevant statistical data"""
def __init__(self, raw_data_array, first_index):
self.mean = raw_data_array[:, first_index]
self.stddev = raw_data_array[:, first_index + 1]
......@@ -50,7 +50,11 @@ class SimMeshData:
def skip_nan_simdata(filename):
"""DOC"""
"""
Skip entries in data file with NaN-values. This is a result of
the radial profile generated by paraview starting at R = 0, whereas
the domain starts at R = 1 R_s
"""
# First always skipped because of header
raw_data = np.loadtxt(filename, skiprows=1, delimiter=",")
......@@ -64,7 +68,7 @@ def skip_nan_simdata(filename):
def cart_to_rad_vel(raw_data):
"""DOCSTRING"""
"""Cartesian velocity components transformed to radial velocity"""
vx = raw_data[:, 12]
vy = raw_data[:, 13]
vz = raw_data[:, 14]
......@@ -79,7 +83,7 @@ def cart_to_rad_vel(raw_data):
def simrho_to_rho(raw_data):
"""DOCSTRING"""
"""Transforms logarithmic SI values into linear CGS values"""
lrho = raw_data[:, 6]
rho = 10 ** lrho / c.m_p.value * 1e-6
......
# PSP SWEAP (and FIELDS?) data analysis
# SWEAP/SPC data evaluation
## Data Usage
The github repository of this code does not provide the measurement data that is evaluated
here. For the purposes of the connected paper (HYPERLINK), several encounter phases of PSP
The github repository of this code does not provide the [measurement data](http://sweap.cfa.harvard.edu/Data.html "SWEAP data"). that is evaluated. For the purposes of the connected paper ([Kasper et al., 2016](https://link.springer.com/article/10.1007/s11214-015-0206-3 "Kasper et al., 2016")), several encounter phases of PSP
are evaluated:
- **ENCOUNTER 07:** 01-12-2021 to 01-23-2021, Perihelion ~ 0.090 Rs
- **ENCOUNTER 08:** 04-24-2021 to 05-04-2021, Perihelion ~ 0.076 Rs
- **ENCOUNTER 09:** 08-04-2021 to 08-15-2021, Perihelion ~ 0.076 Rs
- **ENCOUNTER 10:** 11-16-2021 to 11-26-2021, Perihelion ~ 0.062 Rs
PSEUDOCODE
BACKGROUND
- Collect data for one Encounter in folder
- Variable name of folder to handle different encounters
In total, evaluate the last few encounters
- Perihelia of ~0.064 au (ENCOUNTER 10)
- Perihelia of ~0.074 au (ENCOUNTER 8 and 9)
- Perihelia of ~0.090 au (ENCOUNTER 6 and 7)
- SWEAP provides (all with uncertainties)
- Date and time of observation
- Cartesian position (x, y, z)
- RTN frame velocity
- Thermal velocity w
- Density of protons (majority of wind)
- Collect all measurements (after reduction) into singular arrays?
- Could then be split by minimum distance for perihelion
OPERATIONS
- Sort through "general flag" (only use where set to 0)
- Also sort through each array to find entries with -1e30, which
marks failed measurements
- Calculate spherical heliocentric coordinates (HIC)
- Transform to usable data parameters (vr, log_T, log_rho)
- Generate log-file with important information
- Total number of data points
- Reduced number of data points
- Epoch from start to finish
- If mean/median + std is desired, I need to bin the data appropriately
- Loop over multiple files, collect data in bins, do evaluation at
end.
- Generate a plot (Bar Chart) displaying each bin at the end, to
have quick reference.
- Radial data binning: Find appropriate bin size (maybe 0.5 R_sol)
- After radial sorting is done:
- Take all indices for each bin and treat the data bin by bin
SINGLE ENCOUNTER SEQUENCE
-For File in encounter
- Fill encounter dictionary with reduced values
- Find index of minimum distance-value
- Split total data into approach and recession
## Files
- test.py: Testing data operations on data files.
## NIROperations
Python modules necessary in the processing of measurement data.
\ No newline at end of file
The data is reduced according to the conservative boundaries of the [SWEAP User Guide](http://sweap.cfa.harvard.edu/sweap_data_user_guide.pdf "SWEAP User Guide") (`general_flag=0`), sorted into radial distance bins congruent with the radial cell size of the connected NIRVANA simulations (`dr = 0.1 R_s`), treated with a mean/stddev and median/quartiles evaluation and compared to a radial outline of the simulation results.
\ No newline at end of file
......@@ -2,6 +2,7 @@ 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
......@@ -75,9 +76,9 @@ def main():
stat_temp = st.stat_ana(temp)
# Create bin plots and save them correctly
ps.plot_histogram(HIST_SAVE_DIR, vr, bin_lo, bin_hi, "vr")
ps.plot_histogram(HIST_SAVE_DIR, rho, bin_lo, bin_hi, "rho")
ps.plot_histogram(HIST_SAVE_DIR, temp, bin_lo, bin_hi, "temp")
op.plot_histogram(HIST_SAVE_DIR, vr, bin_lo, bin_hi, "vr")
op.plot_histogram(HIST_SAVE_DIR, rho, bin_lo, bin_hi, "rho")
op.plot_histogram(HIST_SAVE_DIR, temp, bin_lo, bin_hi, "temp")
# Fill in data file values
with open(f"{STAT_SAVE_DIR}/{stat_file_name}", "a") as f:
......
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment