emout.emout.data package
Submodules
emout.emout.data.data module
- class emout.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:
ndarray3次元データを管理する.
- 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
- build_frame_updater(axis=0, title=None, notitle=False, offsets=None, use_si=True, vmin=None, vmax=None, **kwargs)[source]
アニメーション描画処理を構築する.
- Parameters:
axis (int, optional) – アニメーションする軸, by default 0
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
vmin (float, optional) – 最小値, by default None
vmax (float, optional) – 最大値, by default None
- Return type:
- property directory: Path
ディレクトリ名を返す
- Returns:
ディレクトリ名
- Return type:
Path
- property filename: Path
ファイル名を返す.
- Returns:
ファイル名.
- Return type:
Path
- gifplot(fig=None, axis=0, mode=None, action='to_html', filename=None, show=False, savefilename=None, interval=200, repeat=True, title=None, notitle=False, offsets=None, use_si=True, vmin=None, vmax=None, to_html=False, return_updater=False, **kwargs)[source]
gifアニメーションを作成する.
- Parameters:
fig (Figure) – アニメーションを描画するFigure(Noneの場合新しく作成する), by default None
axis (int, optional) – アニメーションする軸, by default 0
action ({'return', 'show', 'to_html', 'save', 'frames'}, optional, by default 'to_html') –
Determines the behavior of the function:
’return’: The plot object is returned without rendering it.
’show’: The plot is displayed immediately.
’to_html’: The plot is converted to an Ipython.display.HTML object and returned.
’save’: The plot is saved to a file specified by ‘filename’ argument.
’frames’: FrameUpdater object is returned without rendering it.
filename (str, optional) – 保存するファイル名(actionが’save’以外の場合や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
vmin (float, optional) – 最小値, by default None
vmax (float, optional) – 最大値, by default None
use_si (bool) – SI単位系を用いる場合True(そうでない場合EMSES単位系を用いる), by default False
show (bool, optional) –
プロットを表示する場合True(ファイルに保存する場合は非表示), by default
Deprecated since version 1.2.1: This parameter is deprecated and will be removed in version 2.0.0. Use the ‘action’=’show’ instead for equivalent functionality.
savefilename (str, optional) –
保存するファイル名(Noneの場合保存しない), by default None
Deprecated since version 1.2.1: This parameter is deprecated and will be removed in version 2.0.0. Use the plot(‘action’=’save’, filename=’example.gif’) instead for equivalent functionality.
to_html (bool) –
アニメーションをHTMLとして返す. (使用例: Jupyter Notebook等でアニメーションを描画する際等)
Deprecated since version 1.2.1: This parameter is deprecated and will be removed in version 2.0.0. Use the ‘action’=’to_html’ instead for equivalent functionality.
return_updater (bool) –
FrameUpdaterを返す場合True, by default False
Deprecated since version 1.2.1: This parameter is deprecated and will be removed in version 2.0.0. Use the ‘action’=’frames’ instead for equivalent functionality.
- Returns:
Depending on the selected action
- If ‘return’ (Returns the tuple of the plot object (fig, animation).)
- If ‘show’ (Does not return anything, displays the plot.)
- If ‘to_html’ (Returns an Ipython.display.HTML object of the plot (for Jupyter).)
- If ‘save’ (Does not return anything, saves the plot to a file.)
- If ‘frames’ (Returns FrameUpdater object.)
Examples
>>> fig, ani = gifplot(action="return") Returns the tuple of the plot object.
>>> gifplot(action="show") Displays the plot.
>>> html = gifplot(action="to_html") Returns the HTML representation of the plot.
>>> gifplot(action="save", filename = "example.gif") Saves the plot to a file.
>>> updater = gifplot(action="frames") Returns FrameUpdater object.
- masked(mask)[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.emout.data.data.Data1d(input_array, **kwargs)[source]
Bases:
Data3次元データの1次元直線を管理する.
- plot(show=False, use_si=True, offsets=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.emout.data.data.Data2d(input_array, **kwargs)[source]
Bases:
Data2次元データの2次元面を管理する.
- plot(axes='auto', show=False, use_si=True, offsets=None, mode='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.emout.data.griddata_series module
- class emout.emout.data.griddata_series.GridDataSeries(filename, name, tunit=None, axisunit=None, valunit=None)[source]
Bases:
object3次元時系列データを管理する.
- datafile
データファイル情報
- Type:
- h5
hdf5ファイルオブジェクト
- Type:
h5py.File
- group
データセット
- Type:
h5py.Datasets
- name
データセット名
- Type:
str
- chain(other_series)[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.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.emout.data.vector_data module
- class emout.emout.data.vector_data.VectorData(objs, name=None, attrs=None)[source]
Bases:
Group- property axisunits: UnitTranslator
- build_frame_updater(axis=0, title=None, notitle=False, offsets=None, use_si=True, **kwargs)[source]
アニメーション描画処理を構築する.
- Parameters:
axis (int, optional) – アニメーションする軸, by default 0
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
- gifplot(fig=None, axis=0, action='to_html', filename=None, interval=200, repeat=True, title=None, notitle=False, offsets=None, use_si=True, show=False, savefilename=None, to_html=False, return_updater=False, **kwargs)[source]
gifアニメーションを作成する
- Parameters:
fig (Figure) – アニメーションを描画するFigure(Noneの場合新しく作成する), by default None
axis (int, optional) – アニメーションする軸, by default 0
action ({'return', 'show', 'to_html', 'save', 'frames'}, optional, by default 'to_html') –
Determines the behavior of the function:
’return’: The plot object is returned without rendering it.
’show’: The plot is displayed immediately.
’to_html’: The plot is converted to an Ipython.display.HTML object and returned.
’save’: The plot is saved to a file specified by ‘filename’ argument.
’frames’: FrameUpdater object is returned without rendering it.
filename (str, optional) – 保存するファイル名(actionが’save’以外の場合や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
show (bool, optional) –
プロットを表示する場合True(ファイルに保存する場合は非表示), by default
Deprecated since version 1.2.1: This parameter is deprecated and will be removed in version 2.0.0. Use the ‘action’=’show’ instead for equivalent functionality.
savefilename (str, optional) –
保存するファイル名(Noneの場合保存しない), by default None
Deprecated since version 1.2.1: This parameter is deprecated and will be removed in version 2.0.0. Use the plot(‘action’=’save’, filename=’example.gif’) instead for equivalent functionality.
to_html (bool) –
アニメーションをHTMLとして返す. (使用例: Jupyter Notebook等でアニメーションを描画する際等)
Deprecated since version 1.2.1: This parameter is deprecated and will be removed in version 2.0.0. Use the ‘action’=’to_html’ instead for equivalent functionality.
return_updater (bool) –
FrameUpdaterを返す場合True, by default False
Deprecated since version 1.2.1: This parameter is deprecated and will be removed in version 2.0.0. Use the ‘action’=’frames’ instead for equivalent functionality.
- Returns:
Depending on the selected action
- If ‘return’ (Returns the tuple of the plot object (fig, animation).)
- If ‘show’ (Does not return anything, displays the plot.)
- If ‘to_html’ (Returns an Ipython.display.HTML object of the plot (for Jupyter).)
- If ‘save’ (Does not return anything, saves the plot to a file.)
- If ‘frames’ (Returns FrameUpdater object.)
Examples
>>> fig, ani = gifplot(action="return") Returns the tuple of the plot object.
>>> gifplot(action="show") Displays the plot.
>>> html = gifplot(action="to_html") Returns the HTML representation of the plot.
>>> gifplot(action="save", filename = "example.gif") Saves the plot to a file.
>>> updater = gifplot(action="frames") Returns FrameUpdater object.
- property name: str
- plot2d(mode='stream', axes='auto', show=False, use_si=True, offsets=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でない場合の例外
- property shape: ndarray
- property slice_axes: ndarray
- property slices: ndarray
- property valunit: UnitTranslator
- emout.emout.data.vector_data.VectorData2d
alias of
VectorData