Total Complexity | 5 |
Total Lines | 60 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | """ Flare analysis """ |
||
2 | |||
3 | import logging |
||
4 | |||
5 | import numpy as np |
||
6 | import scipy as sp |
||
7 | import pandas as pd |
||
8 | |||
9 | import matplotlib as mplt |
||
10 | import matplotlib.pyplot as plt |
||
11 | |||
12 | import sys |
||
13 | import os |
||
14 | import glob |
||
15 | |||
16 | import re |
||
17 | from datetime import datetime |
||
18 | |||
19 | from astropy.stats import bayesian_blocks |
||
20 | |||
21 | import warnings |
||
22 | |||
23 | from mutis import Signal |
||
24 | #from mutis.flares.bayblocks import BayesianBlocks |
||
25 | import mutis.flares.bayblocks as bayblocks |
||
26 | |||
27 | log = logging.getLogger(__name__) |
||
28 | |||
29 | |||
30 | |||
31 | class Flare: |
||
32 | """Container class for a Flare object |
||
33 | |||
34 | Attributes |
||
35 | ---------- |
||
36 | tstart: float |
||
37 | time at which the flare starts |
||
38 | tstop: float |
||
39 | time at which the flare ends |
||
40 | """ |
||
41 | |||
42 | def __init__(self, tstart, tstop): |
||
43 | self.tstart = tstart |
||
44 | self.tstop = tstop |
||
45 | |||
46 | def __repr__(self): |
||
47 | return f"Flare({self.tstart},{self.tstop})" |
||
48 | |||
49 | def __str__(self): |
||
50 | return self.__repr__() |
||
51 | |||
52 | |||
53 | def plot(self, ax=None, **kwargs): |
||
54 | """Plots the flare as a colored area """ |
||
55 | ax = plt.gca() if ax is None else ax |
||
56 | |||
57 | ax.axvspan(self.tstart, self.tstop, facecolor='r', edgecolor=None, alpha=0.2, **kwargs) |
||
58 | |||
59 | pass |
||
60 |