emout.data package
Submodules
emout.data.data module
- class emout.data.data.Data(input_array, filename=None, name=None, xslice=None, yslice=None, zslice=None, tslice=None, slice_axes=None, axisunits=None, valunit=None)[source]
Bases:
ndarray
3次元データを管理する.
- datafile
データファイル情報
- Type:
- name
データ名
- Type:
str
- slices
管理するデータのxyz方向それぞれの範囲
- Type:
list(slice)
- slice_axes
データ軸がxyzのどの方向に対応しているか表すリスト(0: t, 1: z, 2: y, 3: x)
- Type:
list(int)
- axisunits
軸の単位変換器
- Type:
list(UnitTranslator) or None
- valunit
値の単位変換器
- Type:
UnitTranslator or None
- property directory: Path
ディレクトリ名を返す
- Returns:
ディレクトリ名
- Return type:
Path
- property filename: Path
ファイル名を返す.
- Returns:
ファイル名.
- Return type:
Path
- gifplot(fig: Figure | None = None, axis: int = 0, show: bool = False, savefilename: PathLike | None = None, interval: int = 200, repeat: bool = True, title: str | None = None, notitle: bool = False, offsets: Tuple[float | str, float | str, float | str] | None = None, use_si: bool = True, vmin: float | None = None, vmax: float | None = None, to_html: bool = False, **kwargs)[source]
gifアニメーションを作成する
- Parameters:
fig (Figure) – アニメーションを描画するFigure(Noneの場合新しく作成する), by default None
axis (int, optional) – アニメーションする軸, by default 0
show (bool, optional) – プロットを表示する場合True(ファイルに保存する場合は非表示), by default True
savefilename (str, optional) – 保存するファイル名(Noneの場合保存しない), by default None
interval (int, optional) – フレーム間のインターバル(ミリ秒), by default 400
repeat (bool) – アニメーションをループするならTrue, by default True
title (str, optional) – タイトル(Noneの場合データ名(phisp等)), by default None
notitle (bool, optional) – タイトルを付けない場合True, by default False
offsets ((float or str, float or str, float or str)) – プロットのx,y,z軸のオフセット(‘left’: 最初を0, ‘center’: 中心を0, ‘right’: 最後尾を0, float: 値だけずらす), by default None
use_si (bool) – SI単位系を用いる場合True(そうでない場合EMSES単位系を用いる), by default False
to_html (bool) – アニメーションをHTMLとして返す. (使用例: Jupyter Notebook等でアニメーションを描画する際等)
- masked(mask: ndarray | Callable[[ndarray], ndarray]) Data [source]
マスクされたデータを返す.
- Parameters:
mask (numpy.ndarray or predicate) – マスク行列またはマスクを返す関数
- Returns:
マスクされたデータ
- Return type:
SlicedData
- property t: ndarray
t軸.
- Returns:
t軸
- Return type:
np.ndarray
- property t_si: ndarray
SI単位系でのt軸.
- Returns:
SI単位系でのt軸
- Return type:
np.ndarray
- property tslice: slice
管理するt方向の範囲を返す.
- Returns:
管理するt方向の範囲
- Return type:
slice
- property use_axes: List[str]
データ軸がxyzのどの方向に対応しているか表すリストを返す.
- Returns:
データ軸がxyzのどの方向に対応しているか表すリスト([‘x’], [‘x’, ‘z’], etc)
- Return type:
list(str)
- property x: ndarray
x軸.
- Returns:
x軸
- Return type:
np.ndarray
- property x_si: ndarray
SI単位系でのx軸.
- Returns:
SI単位系でのx軸
- Return type:
np.ndarray
- property xslice: slice
管理するx方向の範囲を返す.
- Returns:
管理するx方向の範囲
- Return type:
slice
- property y: ndarray
y軸.
- Returns:
y軸
- Return type:
np.ndarray
- property y_si: ndarray
SI単位系でのy軸.
- Returns:
SI単位系でのy軸
- Return type:
np.ndarray
- property yslice: slice
管理するy方向の範囲を返す.
- Returns:
管理するy方向の範囲
- Return type:
slice
- property z: ndarray
z軸.
- Returns:
z軸
- Return type:
np.ndarray
- property z_si: ndarray
SI単位系でのz軸.
- Returns:
SI単位系でのz軸
- Return type:
np.ndarray
- property zslice: slice
管理するz方向の範囲を返す.
- Returns:
管理するz方向の範囲
- Return type:
slice
- class emout.data.data.Data1d(input_array, **kwargs)[source]
Bases:
Data
3次元データの1次元直線を管理する.
- plot(show: bool = False, use_si: bool = True, offsets: Tuple[float | str, float | str] | None = None, **kwargs)[source]
1次元データをプロットする.
- Parameters:
show (bool) – プロットを表示する場合True(ファイルに保存する場合は非表示), by default False
use_si (bool) – SI単位系を用いる場合True(そうでない場合EMSES単位系を用いる), by default True
offsets ((float or str, float or str)) – プロットのx,y軸のオフセット(‘left’: 最初を0, ‘center’: 中心を0, ‘right’: 最後尾を0, float: 値だけずらす), by default None
savefilename (str, optional) – 保存するファイル名, by default None
vmin (float, optional) – 最小値, by default None
vmax (float, optional) – 最大値, by default None
figsize ((float, float), optional) – 図のサイズ, by default None
xlabel (str, optional) – 横軸のラベル, by default None
ylabel (str, optional) – 縦軸のラベル, by default None
label (str, optional) – ラベル, by default None
title (str, optional) – タイトル, by default None
- Returns:
プロットデータを表す線オブジェクト(保存または show した場合None)
- Return type:
Line2D or None
- Raises:
Exception – データの次元が1でない場合の例外
- class emout.data.data.Data2d(input_array, **kwargs)[source]
Bases:
Data
3次元データの2次元面を管理する.
- plot(axes: Literal['auto', 'xy', 'yz', 'zx', 'yx', 'zy'] = 'auto', show: bool = False, use_si: bool = True, offsets: Tuple[float | str, float | str, float | str] | None = None, mode: Literal['cm', 'cm+cont', 'cont'] = 'cm', **kwargs)[source]
2次元データをプロットする.
- Parameters:
axes (str, optional) – プロットする軸(‘xy’, ‘zx’, etc), by default ‘auto’
show (bool) – プロットを表示する場合True(ファイルに保存する場合は非表示), by default False
use_si (bool) – SI単位系を用いる場合True(そうでない場合EMSES単位系を用いる), by default True
offsets ((float or str, float or str, float or str)) – プロットのx,y,z軸のオフセット(‘left’: 最初を0, ‘center’: 中心を0, ‘right’: 最後尾を0, float: 値だけずらす), by default None
mode (str) – プロットの種類(‘cm’: カラーマップ, ‘cont’: 等高線プロット, ‘surf’: サーフェースプロット)
mesh ((numpy.ndarray, numpy.ndarray), optional) – メッシュ, by default None
savefilename (str, optional) – 保存するファイル名(Noneの場合保存しない), by default None
cmap (matplotlib.Colormap or str or None, optional) – カラーマップ, by default cm.coolwarm
vmin (float, optional) – 最小値, by default None
vmax (float, optional) – 最大値, by default None
figsize ((float, float), optional) – 図のサイズ, by default None
xlabel (str, optional) – x軸のラベル, by default None
ylabel (str, optional) – y軸のラベル, by default None
title (str, optional) – タイトル, by default None
interpolation (str, optional) – 用いる補間方法, by default ‘bilinear’
dpi (int, optional) – 解像度(figsizeが指定された場合は無視される), by default 10
- Returns:
プロットしたimageデータ(保存またはshowした場合None)
- Return type:
AxesImage or None
- Raises:
Exception – プロットする軸のパラメータが間違っている場合の例外
Exception – プロットする軸がデータにない場合の例外
Exception – データの次元が2でない場合の例外
emout.data.data_loader module
emout.data.emout module
- class emout.data.emout.Emout(directory='./', append_directories=[], inpfilename='plasma.inp')[source]
Bases:
object
EMSES出力・inpファイルを管理する.
- directory
管理するディレクトリ
- Type:
Path
- dataname
3次元データ(datanameは”phisp”などのhdf5ファイルの先頭の名前)
- Type:
GridData
- property icur: DataFrame
- property inp: InpFile | None
パラメータの辞書(Namelist)を返す.
- Returns:
パラメータの辞書(Namelist)
- Return type:
InpFile or None
- name2unit = {'axis': <function Emout.<lambda>>, 'b[xyz]': <function Emout.<lambda>>, 'e[xyz]': <function Emout.<lambda>>, 'j.*': <function Emout.<lambda>>, 'nd1p': <function ndp_unit.<locals>.ndp_unit>, 'nd2p': <function ndp_unit.<locals>.ndp_unit>, 'nd3p': <function ndp_unit.<locals>.ndp_unit>, 'nd4p': <function ndp_unit.<locals>.ndp_unit>, 'nd5p': <function ndp_unit.<locals>.ndp_unit>, 'nd6p': <function ndp_unit.<locals>.ndp_unit>, 'nd7p': <function ndp_unit.<locals>.ndp_unit>, 'nd8p': <function ndp_unit.<locals>.ndp_unit>, 'nd9p': <function ndp_unit.<locals>.ndp_unit>, 'phisp': <function Emout.<lambda>>, 'rho': <function Emout.<lambda>>, 'rhobk': <function Emout.<lambda>>, 'rhobksp[1-9]': <function Emout.<lambda>>, 't': <function t_unit>}
- property pbody: DataFrame
- emout.data.emout.nd3p_unit(out: Emout) UnitTranslator [source]
- emout.data.emout.ndp_unit(ispec: int) Callable[[Emout], UnitTranslator] [source]
- emout.data.emout.none_unit(out: Emout) UnitTranslator [source]
- emout.data.emout.t_unit(out: Emout) UnitTranslator [source]
tの単位変換器を生成する.
- Parameters:
out (Emout) – Emoutオブジェクト
- Returns:
tの単位変換器
- Return type:
- emout.data.emout.wpet_unit(out: Emout) UnitTranslator [source]
wpe * tの単位変換器を生成する.
以下のコードを実行することで、データのt軸をwpe*tで規格化できる.
>>> Emout.name2unit['t'] = wpet_unit
- Parameters:
out (Emout) – Emoutオブジェクト
- Returns:
wpe * tの単位変換器
- Return type:
- emout.data.emout.wpit_unit(out: Emout) UnitTranslator [source]
wpi * tの単位変換器を生成する.
以下のコードを実行することで、データのt軸をwpe*tで規格化できる.
>>> Emout.name2unit['t'] = wpit_unit
- Parameters:
out (Emout) – Emoutオブジェクト
- Returns:
wpi * tの単位変換器
- Return type:
emout.data.griddata_series module
- class emout.data.griddata_series.GridDataSeries(filename: PathLike, name: str, tunit: UnitTranslator | None = None, axisunit: UnitTranslator | None = None, valunit: UnitTranslator | None = None)[source]
Bases:
object
3次元時系列データを管理する.
- datafile
データファイル情報
- Type:
- h5
hdf5ファイルオブジェクト
- Type:
h5py.File
- group
データセット
- Type:
h5py.Datasets
- name
データセット名
- Type:
str
- chain(other_series: GridDataSeries) MultiGridDataSeries [source]
GridDataSeriesを結合する.
- Parameters:
other_series (GridDataSeries) – 結合するGridDataSeries
- Returns:
結合したGridDataSeries
- Return type:
- property directory: Path
ディレクトリ名を返す.
- Returns:
ディレクトリ名
- Return type:
Path
- property filename: Path
ファイル名を返す.
- Returns:
ファイル名
- Return type:
Path
- class emout.data.griddata_series.MultiGridDataSeries(*series)[source]
Bases:
GridDataSeries
連続する複数の3次元時系列データを管理する.
- datafile
データファイル情報
- Type:
- name
データセット名
- Type:
str
- tunit
時間の単位変換器
- Type:
- axisunit
空間軸の単位変換器
- Type:
- valunit
値の単位変換器
- Type:
- property directories: List[Path]
ディレクトリ名のリストを返す.
- Returns:
ディレクトリ名のリスト
- Return type:
list(Path)
- property directory: Path
先頭データのディレクトリ名を返す.
- Returns:
ディレクトリ名
- Return type:
Path
- property filename: Path
先頭データのファイル名を返す.
- Returns:
ファイル名
- Return type:
Path
- property filenames: List[Path]
ファイル名のリストを返す.
- Returns:
ファイル名のリスト
- Return type:
list(Path)
emout.data.vector_data module
- class emout.data.vector_data.VectorData(objs: List[Any], name=None, attrs=None)[source]
Bases:
Group
- gifplot(fig: Figure | None = None, axis: int = 0, show: bool = False, savefilename: str | None = None, interval: int = 200, repeat: bool = True, title: str | None = None, notitle: bool = False, offsets: Tuple[float | str, float | str, float | str] | None = None, use_si: bool = True, to_html: bool = False, **kwargs)[source]
gifアニメーションを作成する
- Parameters:
fig (Figure) – アニメーションを描画するFigure(Noneの場合新しく作成する), by default None
axis (int, optional) – アニメーションする軸, by default 0
show (bool, optional) – プロットを表示する場合True(ファイルに保存する場合は非表示), by default True
savefilename (str, optional) – 保存するファイル名(Noneの場合保存しない), by default None
interval (int, optional) – フレーム間のインターバル(ミリ秒), by default 400
repeat (bool) – アニメーションをループするならTrue, by default True
title (str, optional) – タイトル(Noneの場合データ名(phisp等)), by default None
notitle (bool, optional) – タイトルを付けない場合True, by default False
offsets ((float or str, float or str, float or str)) – プロットのx,y,z軸のオフセット(‘left’: 最初を0, ‘center’: 中心を0, ‘right’: 最後尾を0, float: 値だけずらす), by default None
use_si (bool) – SI単位系を用いる場合True(そうでない場合EMSES単位系を用いる), by default False
to_html (bool) – アニメーションをHTMLとして返す. (使用例: Jupyter Notebook等でアニメーションを描画する際等)
- property name: str
- plot2d(mode: Literal['stream', 'vec'] = 'stream', axes: Literal['auto', 'xy', 'yz', 'zx', 'yx', 'zy'] = 'auto', show: bool = False, use_si: bool = True, offsets: Tuple[float | str, float | str, float | str] | None = None, **kwargs)[source]
2次元データをプロットする.
- Parameters:
mode (str) – プロットの種類(‘vec’: quiver plot, ‘stream’: streamline plot), by default ‘stream’
axes (str, optional) – プロットする軸(‘xy’, ‘zx’, etc), by default ‘auto’
show (bool) – プロットを表示する場合True(ファイルに保存する場合は非表示), by default False
use_si (bool) – SI単位系を用いる場合True(そうでない場合EMSES単位系を用いる), by default False
offsets ((float or str, float or str, float or str)) – プロットのx,y,z軸のオフセット(‘left’: 最初を0, ‘center’: 中心を0, ‘right’: 最後尾を0, float: 値だけずらす), by default None
mesh ((numpy.ndarray, numpy.ndarray), optional) – メッシュ, by default None
savefilename (str, optional) – 保存するファイル名(Noneの場合保存しない), by default None
cmap (matplotlib.Colormap or str or None, optional) – カラーマップ, by default cm.coolwarm
vmin (float, optional) – 最小値, by default None
vmax (float, optional) – 最大値, by default None
figsize ((float, float), optional) – 図のサイズ, by default None
xlabel (str, optional) – x軸のラベル, by default None
ylabel (str, optional) – y軸のラベル, by default None
title (str, optional) – タイトル, by default None
interpolation (str, optional) – 用いる補間方法, by default ‘bilinear’
dpi (int, optional) – 解像度(figsizeが指定された場合は無視される), by default 10
- Returns:
プロットしたimageデータ(保存またはshowした場合None)
- Return type:
AxesImage or None
- Raises:
Exception – プロットする軸のパラメータが間違っている場合の例外
Exception – プロットする軸がデータにない場合の例外
Exception – データの次元が2でない場合の例外
- emout.data.vector_data.VectorData2d
alias of
VectorData