示例#1
0
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from matplotlib import cm
import matplotlib as mpl
import seaborn as sns
import scipy
from mpl_toolkits.axes_grid1 import make_axes_locatable

years = [2, 11]  # The range of years to get
months = [7, 13]  # Months within year to get
dateRange = []
for y in range(*years):
    for m in [5, 6, 7, 8, 9, 10, 11, 12]:
        dateRange.append([y, m])  # Make list of months & years

with mp.Timer('Timing code'):
    moments = pd.read_csv('moments2.csv',
                          index_col=0, parse_dates=True)
    # moments = mp.moments(dateRange)  # Regen moments data. Takes > 90s
    # moments.to_csv('moments2.csv')
    # omni = mp.omni(dateRange)
    # omni.to_csv('omniGSE_Extended.csv')
    omni = pd.read_csv('omniGSE_Extended.csv',
                       index_col=0, parse_dates=True)
    # pgp = mp.pgp(dateRange)  # Get predicted geometric position
    # pgp.to_csv('pgpGSE_Extended.csv')
    pgp = pd.read_csv('pgpGSE_Extended.csv',
                      index_col=0, parse_dates=True)

    # data = pd.merge_asof(moments, omni, left_index=True, right_index=True)
    data = pd.merge_asof(moments, pgp, left_index=True, right_index=True)
示例#2
0
from scipy.optimize import curve_fit

years = [2, 11]  # The range of years to get
months = [7, 11]  # Months within year to get
dateRange = []
for y in range(*years):
    for m in range(*months):
        # years = [2, 11]  # The range of years to get
        dateRange.append([y, m])


def linear(x, m, c):
    return m * x + c


with mp.Timer('Timing code'):
    # moments = mp.moments(dateRange)  # Regen moments data. Takes > 90s
    # moments.to_csv('moments.csv')
    moments = pd.read_csv('moments.csv', index_col=0, parse_dates=True)

    # omni = mp.omni(dateRange, gsm=True)
    # omni.to_csv('omni.csv')
    omni = pd.read_csv('omniGSE.csv', index_col=0, parse_dates=True)

    # pgp = mp.pgp(dateRange, gsm=True)  # Get predicted geometric position
    # pgp.to_csv('pgp.csv')
    pgp = pd.read_csv('pgpGSE.csv', index_col=0, parse_dates=True)

    # data = pd.merge_asof(moments, omni, left_index=True, right_index=True)
    data = pd.merge_asof(moments, pgp, left_index=True, right_index=True)
    data = pd.merge_asof(data, omni, left_index=True, right_index=True)