flekspy 0.2.1__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flekspy
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Python utilities for processing FLEKS data
5
5
  Author: Yuxi Chen
6
6
  Author-email: yuxichen@umich.edu>, Hongyang Zhou <hyzhou@umich.edu
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "flekspy"
3
- version = "0.2.1"
3
+ version = "0.2.2"
4
4
  description = "Python utilities for processing FLEKS data"
5
5
  authors = ["Yuxi Chen <yuxichen@umich.edu>, Hongyang Zhou <hyzhou@umich.edu>"]
6
6
  readme = "README.md"
@@ -5,7 +5,12 @@ import struct
5
5
  import yt
6
6
 
7
7
  from flekspy.util import get_unit
8
- from flekspy.util import DataContainer1D, DataContainer2D, DataContainer3D
8
+ from flekspy.util import (
9
+ DataContainer,
10
+ DataContainer1D,
11
+ DataContainer2D,
12
+ DataContainer3D,
13
+ )
9
14
 
10
15
  x_ = 0
11
16
  y_ = 1
@@ -63,7 +68,6 @@ class IDLData(object):
63
68
  Example:
64
69
  >>> ds = IDLData("3d.out")
65
70
  >>> dc2d = ds.get_slice("y", 1)
66
- >>> dc3d = ds.get_domain()
67
71
  """
68
72
 
69
73
  def __init__(self, filename="none"):
@@ -123,10 +127,8 @@ class IDLData(object):
123
127
  )
124
128
  return str
125
129
 
126
- def get_domain(self) -> DataContainer3D:
127
- r"""
128
- Returns all the 3D data.
129
- """
130
+ def get_domain(self) -> DataContainer:
131
+ """Return data as data container."""
130
132
  dataSets = {}
131
133
  for varname in self.data.name:
132
134
  idx = self.data.name.index(varname)
@@ -148,7 +150,7 @@ class IDLData(object):
148
150
  self.data.array[idx, :, :, :], unit, registry=self.registry
149
151
  )
150
152
 
151
- if self.gencoord:
153
+ if self.gencoord and self.ndim == 2:
152
154
  dc = DataContainer2D(
153
155
  dataSets,
154
156
  np.squeeze(axes[0]),
@@ -193,6 +195,23 @@ class IDLData(object):
193
195
 
194
196
  return dc
195
197
 
198
+ def get_slice(self, norm, cut_loc) -> DataContainer2D:
199
+ """Get a 2D slice from the 3D IDL data.
200
+
201
+ Args:
202
+ norm: str
203
+ The normal direction of the slice from "x", "y" or "z"
204
+
205
+ cur_loc: float
206
+ The position of slicing.
207
+
208
+ Return: DataContainer2D
209
+ """
210
+ domain = self.get_domain()
211
+ ds = domain.get_slice(norm, cut_loc)
212
+
213
+ return ds
214
+
196
215
  def save_data(self, saveName, saveFormat="ascii"):
197
216
  # Currently only support ascii output.
198
217
  self.save_ascii_instance(saveName)
@@ -227,8 +227,7 @@ class DataContainer3D(DataContainer):
227
227
  )
228
228
 
229
229
  def get_slice(self, norm, cut_loc) -> "DataContainer2D":
230
- r"""
231
- Get a 2D slice from the 3D box data.
230
+ """Get a 2D slice from the 3D box data.
232
231
 
233
232
  Args:
234
233
  norm: str
@@ -476,7 +475,7 @@ class DataContainer2D(DataContainer):
476
475
  var: string
477
476
 
478
477
  Examples:
479
- >>> f, axes = dc.contour("Bx<(50)>(-50) By (np.log(2*{rhos0}))>(-5)", xlim=[-40,-5])
478
+ >>> f, axes = dc.plot("Bx<(50)>(-50) By (np.log(2*{rhos0}))>(-5)", xlim=[-40,-5])
480
479
  >>> dc.add_contour(axes[0,0], "rhos1>1")
481
480
  """
482
481
 
@@ -532,7 +531,7 @@ class DataContainer2D(DataContainer):
532
531
  It controls the number of streamlines.
533
532
 
534
533
  Examples:
535
- >>> f, axes = dc.contour("Bx<(50)>(-50) By (np.log(2*{rhos0}))>(-5)", xlim=[-40,-5])
534
+ >>> f, axes = dc.plot("Bx<(50)>(-50) By (np.log(2*{rhos0}))>(-5)", xlim=[-40,-5])
536
535
  >>> dc.add_stream(axes[1,0], "Bx", "Bz", density=2)
537
536
  """
538
537
 
File without changes
File without changes
File without changes
File without changes
File without changes