Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename tau to kinetic energy #173

Merged
merged 35 commits into from
Nov 14, 2024
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7497775
Convert a Series to a frame through the to_frame method in Series
sudarshanv01 Aug 1, 2023
02d54b6
Implement to_frame for sequence of series
sudarshanv01 Aug 1, 2023
c557f72
Alter to_frame to allow it to take in multiple y-inputs
sudarshanv01 Aug 1, 2023
efca677
Refactor to_frame
sudarshanv01 Aug 1, 2023
9d180c7
Add width to series
sudarshanv01 Aug 1, 2023
18b268d
assert in to_frame that the dimension of weight and y is the same
sudarshanv01 Aug 2, 2023
0bd3f51
Allow different length series to to_frame
sudarshanv01 Aug 2, 2023
cda4814
Create the to_csv method
sudarshanv01 Aug 2, 2023
be04713
Implement to_csv method in the Mixin class
sudarshanv01 Aug 2, 2023
0b35fe1
Add to_csv and to_frame to the Mixin class
sudarshanv01 Aug 3, 2023
30b0b13
Apply black and isort
sudarshanv01 Aug 3, 2023
f5a4881
Added not_core to tests needing pandas
sudarshanv01 Aug 3, 2023
bafcb11
black and isort code formatting
sudarshanv01 Aug 3, 2023
b6db94c
Added more not_core to graph tests
sudarshanv01 Aug 3, 2023
ad66601
Change resolve to absolute when getting absolute path for mixin tests
sudarshanv01 Aug 3, 2023
92b51a4
Added documentation for the and methods
sudarshanv01 Aug 3, 2023
623124a
Update developer depedencies with ipykernel
sudarshanv01 Aug 3, 2023
bcb6f89
Merge branch 'vasp-dev:master' into master
sudarshanv01 Aug 3, 2023
a907827
Allow install github actions to run on pull requests
sudarshanv01 Aug 3, 2023
0d5838f
Merge branch 'master' of github.com:sudarshanv01/py4vasp
sudarshanv01 Aug 3, 2023
7f8739f
Added pip installation of ipykernel into install.yaml
sudarshanv01 Aug 3, 2023
f4f1515
Merge branch 'vasp-dev:master' into master
sudarshanv01 Aug 3, 2023
5c1240d
add pre-commit-config.yaml and pre-commit as a dependency
sudarshanv01 Aug 3, 2023
9a32998
Merge branch 'master' of github.com:sudarshanv01/py4vasp
sudarshanv01 Aug 3, 2023
0671d9e
Merge branch 'master' of github.com:vasp-dev/py4vasp
sudarshanv01 Sep 10, 2023
e5e244e
Merge branch 'master' of github.com:vasp-dev/py4vasp
sudarshanv01 Sep 25, 2023
f578627
Merge branch 'master' of github.com:vasp-dev/py4vasp
sudarshanv01 Oct 4, 2023
9f8a0ae
Merge branch 'master' of github.com:vasp-dev/py4vasp
sudarshanv01 Feb 2, 2024
455275b
Merge branch 'master' of github.com:vasp-dev/py4vasp
sudarshanv01 Feb 4, 2024
26f3480
Merge branch 'master' of github.com:vasp-dev/py4vasp
sudarshanv01 Feb 23, 2024
969b3c1
Merge branch 'master' of github.com:vasp-dev/py4vasp
sudarshanv01 Mar 25, 2024
617f7f9
Merge branch 'master' of github.com:vasp-dev/py4vasp
sudarshanv01 May 28, 2024
cf67225
Merge branch 'master' of github.com:vasp-dev/py4vasp
sudarshanv01 Jun 9, 2024
e7a1052
Merge branch 'master' of github.com:vasp-dev/py4vasp
sudarshanv01 Nov 12, 2024
5d799ec
rename tau -> kinetic_energy
sudarshanv01 Nov 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Allow different length series to to_frame
sudarshanv01 committed Aug 2, 2023
commit 0bd3f51e2c4759b242f8434f4bf5482a25e7478d
20 changes: 13 additions & 7 deletions src/py4vasp/_third_party/graph/graph.py
Original file line number Diff line number Diff line change
@@ -159,13 +159,19 @@ def _set_yaxis_options(self, figure):
def to_frame(self):
df = pd.DataFrame()
for series in np.atleast_1d(self.series):
df[self._name_column(series, "x", None)] = series.x
for idx, series_y in enumerate(np.atleast_2d(series.y)):
df[self._name_column(series, "y", idx)] = series_y
if series.width is not None:
assert series.width.ndim == series.y.ndim
for idx, series_width in enumerate(np.atleast_2d(series.width)):
df[self._name_column(series, "width", idx)] = series_width
_df = self._create_and_populate_df(series)
df = df.join(_df, how="outer")
return df

def _create_and_populate_df(self, series):
df = pd.DataFrame()
df[self._name_column(series, "x", None)] = series.x
for idx, series_y in enumerate(np.atleast_2d(series.y)):
df[self._name_column(series, "y", idx)] = series_y
if series.width is not None:
assert series.width.ndim == series.y.ndim
for idx, series_width in enumerate(np.atleast_2d(series.width)):
df[self._name_column(series, "width", idx)] = series_width
return df

def _name_column(self, series, suffix, idx=None):
19 changes: 18 additions & 1 deletion tests/third_party/graph/test_graph.py
Original file line number Diff line number Diff line change
@@ -311,8 +311,8 @@ def test_convert_multiple_lines(two_lines, Assert):
Assert.allclose(df["two_lines.y0"], two_lines.y[0])
Assert.allclose(df["two_lines.y1"], two_lines.y[1])


def test_convert_two_fatbands_to_frame(two_fatbands, Assert):

graph = Graph(two_fatbands)
df = graph.to_frame()
Assert.allclose(df["two_fatbands.x"], two_fatbands.x)
@@ -321,6 +321,23 @@ def test_convert_two_fatbands_to_frame(two_fatbands, Assert):
Assert.allclose(df["two_fatbands.width0"], two_fatbands.width[0])
Assert.allclose(df["two_fatbands.width1"], two_fatbands.width[1])


def test_convert_different_length_series_to_frame(parabola, two_lines, Assert):
sequence = [two_lines, parabola]
graph = Graph(sequence)
df = graph.to_frame()
assert len(df) == max(len(parabola.x), len(two_lines.x))
Assert.allclose(df["parabola.x"], parabola.x)
Assert.allclose(df["parabola.y"], parabola.y)
pad_width = len(parabola.x) - len(two_lines.x)
pad_nan = np.repeat(np.nan, pad_width)
padded_two_lines_x = np.hstack((two_lines.x, pad_nan))
padded_two_lines_y = np.hstack((two_lines.y, np.vstack((pad_nan, pad_nan))))
Assert.allclose(df["two_lines.x"], padded_two_lines_x)
Assert.allclose(df["two_lines.y0"], padded_two_lines_y[0])
Assert.allclose(df["two_lines.y1"], padded_two_lines_y[1])


@patch("plotly.graph_objs.Figure._ipython_display_")
def test_ipython_display(mock_display, parabola, not_core):
graph = Graph(parabola)