-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaims_effmass
More file actions
executable file
·73 lines (53 loc) · 1.74 KB
/
aims_effmass
File metadata and controls
executable file
·73 lines (53 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#! /usr/bin/env python3
from pathlib import Path
import typer
from effmass import extrema, inputs, outputs
from matplotlib import pyplot as plt
from rich import print as echo
import pandas as pd
def make_dataframe(segments):
rows = []
for segment in segments:
data = {
"particle": segment.band_type,
"bandindex": segment.band,
"direction": segment.direction,
"eff_mass_lstsq": segment.five_point_leastsq_effmass(),
"eff_mass_fd": segment.finite_difference_effmass(),
}
rows.append(data)
return pd.DataFrame(rows)
app = typer.Typer()
@app.command()
def main(
file: Path,
extrema_search_depth: float = 0.075,
energy_range: float = 0.25,
plot: bool = False,
save: bool = False,
):
"""effmass summary for folder"""
folder = file.parent
output_name = file.name
echo(f"Read {output_name} from {folder}")
data = inputs.DataAims(folder, output_name=output_name)
echo(f".. extrema_search_depth: {extrema_search_depth}")
echo(f".. energy_range: {energy_range}")
settings = inputs.Settings(
extrema_search_depth=extrema_search_depth, energy_range=energy_range
)
segments = extrema.generate_segments(settings, data)
table = outputs.make_table(segments)
echo(table)
if save:
outfile = folder / "effmass_summary.csv"
echo(f".. save segements as dataframe to {outfile}")
df = make_dataframe(segments=segments)
df.to_csv(outfile)
if plot:
outfile = folder / "effmass_summary.pdf"
outputs.plot_segments(data, settings, segments)
echo(f".. save plot to {outfile}")
plt.savefig(outfile)
if __name__ == "__main__":
app()