sora.extra
ChiSquare Class
- class sora.extra.ChiSquare(chi2, npts, **kwargs)[source]
Stores the arrays for all inputs and given chi-square.
- Parameters
chi2 (array) – Array with all the chi-square values.
npts (int) – Number of points used in the fit.
**kwargs – Any other given input must be an array with the same size as chi2. The keyword name will be associated as the variable name of the given data.
Example
>>> chisquare = ChiSquare(chi2, immersion=t1, emersion=t2)
t1
andt2
must be an array with the same size as chi2.The data can be accessed as
>>> chisquare.data['immersion']
- get_nsigma(sigma=1, key=None)[source]
Determines the interval of the chi-square within the nth sigma.
- Parameters
sigma (float, int) – Value of sigma to calculate.
key (str, default=None) – keyword the user desire to obtain results.
- Returns
Dictionary with the average n-sigma value and bondaries.
- Return type
Note
If a key value is given the mean value within the n-sigma and the error bar within the n-sigma are returned.
If no key is given, a dictionary with: the minimum chi-square, the sigma required, the number of points where \(chi2 < (chi2_min + sigma^2)\), and the mean values and errors for all keys is returned.
- get_values(sigma=0.0, key=None)[source]
Returns all values where the chi-square is within the nth sigma.
- Parameters
sigma (float, int) – Value of sigma to cut values.
key (str) – Keyword (parameter) that the user desires to obtain results of.
- Returns
list or dict – List or dictionary with chi-square values within the nth sigma, the average n-sigma value, and bondaries.
- Return type
list, dict
Note
If a key is given, it returns a list with all the values that are within the chosen n-sigma.
If no key is given, it returns a dictionary with the list with all the values that are within the n-sigma for all keys.
If
sigma=0
, it returns the parameters for the minimum chi-square instead of a list.
- plot_chi2(key=None, ax=None)[source]
Plots an ellipse using the input parameters.
- Parameters
key (str) – Key (parameter) for which to plot the chi squares. If no key is given, it will plot for all parameters.
ax (maplotlib.pyplot.Axes) – Matplotlib plot axes. If none is given, it uses the matplotlib pool to identify.
Plot ellipse
- sora.extra.plots.draw_ellipse(equatorial_radius, oblateness=0.0, center_f=0.0, center_g=0.0, position_angle=0.0, center_dot=False, ax=None, **kwargs)[source]
Plots an ellipse with the given input parameters.
- Parameters
equatorial_radius (float, int, default=0) – Semi-major axis of the ellipse.
oblateness (float, int, default=0) – Oblateness of the ellipse.
center_f (float, int, default=0) – Coordinate of the ellipse (abscissa).
center_g (float, int, default=0) – Coordinate of the ellipse (ordinate).
center_dot (bool, default=False) – If True, plots a dot at the center of the ellipse.
position_angle (float, int, default= 0) – Pole position angle (Default=0.0).
ax (maptlotlib.pyplot.Axes) – Axis where to plot ellipse.
**kwargs – All other parameters. They will be parsed directly by matplotlib.
Complementary functions
- sora.extra.utils.get_ellipse_points(theta, equatorial_radius, oblateness=0.0, center_f=0.0, center_g=0.0, position_angle=0.0)[source]
Get points for the ellipse with the given input parameters.
- Parameters
theta (float array) – Angular coordinate, in degrees, to return the ellipse points.
equatorial_radius (float, int) – Semi-major axis of the ellipse.
oblateness (float, int, default=0) – Oblateness of the ellipse.
center_f (float, int, default=0) – Coordinate of the ellipse (abscissa).
center_g (float, int, default=0) – Coordinate of the ellipse (ordinate).
position_angle (float, int, default=0) – The pole position angle of the ellipse in degrees. Zero is in the North direction (‘g-positive’). Positive clockwise.
- Returns
x_model (float, array) – Cartesian x-component, in km
y_model (float, array) – Cartesian y-component, in km
r_model (float, array) – Radial distance, in km
theta (float array) – Angular coordinate, in degrees, to return the ellipse points.