diff --git a/grasp2alm/beam_cut.py b/grasp2alm/beam_cut.py index 5e024fb..cfaad29 100644 --- a/grasp2alm/beam_cut.py +++ b/grasp2alm/beam_cut.py @@ -3,6 +3,7 @@ from dataclasses import dataclass, field import numpy as np import matplotlib.pyplot as plt +from typing import Union from .beam_polar import BeamPolar @dataclass @@ -34,12 +35,13 @@ class BeamCut: vini: float = 0.0 vinc: float = 0.0 vnum: int = 0 - c: np.ndarray = np.array([]) # TODO check is it needed variable + c: np.ndarray = None # TODO check is it needed variable + icomp: int = 0 icut: int = 0 ncomp: int = 0 ncut: int = 0 - amp: np.ndarray = field(default_factory=lambda: np.array([])) + amp: np.ndarray = None def __init__(self, filepath): super().__init__() @@ -76,7 +78,7 @@ def __post_init__(self): break data = line.split() if len(data) == 7: - self.vini, self.vinc, self.vnum, c, self.icomp, self.icut, self.ncomp = map(float, data) + self.vini, self.vinc, self.vnum, self.c, self.icomp, self.icut, self.ncomp = map(float, data) self.vnum, self.icomp, self.icut, self.ncomp = map(int, (self.vnum, self.icomp, self.icut, self.ncomp)) for i in range(self.vnum): line = fi.readline() diff --git a/grasp2alm/beam_grid.py b/grasp2alm/beam_grid.py index 17615bf..54846ec 100644 --- a/grasp2alm/beam_grid.py +++ b/grasp2alm/beam_grid.py @@ -56,7 +56,7 @@ class BeamGrid: ny: int = 0 freq: float = 0.0 frequnit: str = "" - amp: np.ndarray = field(default_factory=lambda: np.array([])) + amp: np.ndarray = None def __init__(self, filepath): diff --git a/notebooks/tutorial.ipynb b/notebooks/tutorial.ipynb index 0f3c526..ada3cc6 100644 --- a/notebooks/tutorial.ipynb +++ b/notebooks/tutorial.ipynb @@ -30,12 +30,12 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ - "gridfile = \"../grasp2alm/test/beam_files/test.grd\"\n", - "cutfile = \"../grasp2alm/test/beam_files/test.cut\"\n", + "gridfile = \"../test/beam_files/test.grd\"\n", + "cutfile = \"../test/beam_files/test.cut\"\n", "grid = g2a.BeamGrid(gridfile)\n", "cut = g2a.BeamCut(cutfile)" ] @@ -56,7 +56,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -100,7 +100,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -204,7 +204,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -248,7 +248,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -322,7 +322,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ @@ -330,11 +330,6 @@ "calm = cmap.to_alm()" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [] - }, { "cell_type": "markdown", "metadata": {}, @@ -344,7 +339,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ @@ -354,7 +349,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 11, "metadata": {}, "outputs": [], "source": [