• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Ruberhauptmann / quant-met / 16547376931

27 Jul 2025 04:47AM UTC coverage: 41.536% (+4.9%) from 36.605%
16547376931

Pull #125

github

web-flow
Merge 605365bbf into b5a0f599e
Pull Request #125: Start q loop

10 of 72 branches covered (13.89%)

Branch coverage included in aggregate %.

98 of 255 new or added lines in 13 files covered. (38.43%)

255 of 566 relevant lines covered (45.05%)

1.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

31.25
/src/quant_met/cli/q_analysis.py
1
"""Functions to run self-consistent calculation for the order parameter."""
2

3
import logging
3✔
4
from pathlib import Path
3✔
5

6
import h5py
3✔
7
import pandas as pd
3✔
8
import sisl
3✔
9

10
from quant_met import routines
3✔
11
from quant_met.parameters import Parameters
3✔
12
from quant_met.parameters.control import QAnalysis
3✔
13

14
logger = logging.getLogger(__name__)
3✔
15

16

17
def q_analysis(parameters: Parameters) -> None:
3✔
18
    """Self-consistent calculation for the order parameter.
19

20
    Parameters
21
    ----------
22
    parameters: Parameters
23
        An instance of Parameters containing control settings, the model,
24
        and k-point specifications for the T_C calculation.
25
    """
NEW
26
    if not isinstance(parameters.control, QAnalysis):
×
NEW
27
        err_msg = "Wrong parameters for q-loop."
×
NEW
28
        raise TypeError(err_msg)
×
29

NEW
30
    q_data: dict[str, pd.DataFrame] = {}
×
NEW
31
    with h5py.File(f"{parameters.control.q_data}") as f:
×
NEW
32
        for key in f:
×
NEW
33
            q_data.update({key: pd.DataFrame()})
×
34

NEW
35
    for key in q_data:
×
NEW
36
        data: pd.DataFrame = pd.read_hdf(f"{parameters.control.q_data}", key=key)
×
NEW
37
        q_data[key] = data
×
38

NEW
39
    hamiltonian = sisl.get_sile(parameters.control.hamiltonian_file).read_hamiltonian()
×
40

NEW
41
    (
×
42
        lengths_vs_temp,
43
        gap_and_current_fig,
44
    ) = routines.get_lengths_vs_temp(q_data=q_data, hamiltonian=hamiltonian)
45

NEW
46
    result_file = Path(f"{parameters.control.outdir}/{parameters.control.prefix}_sc_lengths.hdf5")
×
NEW
47
    result_file.unlink()
×
NEW
48
    lengths_vs_temp.to_hdf(result_file, key="lengths_vs_temp")
×
NEW
49
    gap_and_current_fig.savefig(
×
50
        f"{parameters.control.outdir}/{parameters.control.prefix}_gap_and_current_vs_q.pdf",
51
    )
52

NEW
53
    zero_temp_lengths, length_vs_temp_fig = routines.get_zero_temperature_values(
×
54
        hamiltonian=hamiltonian,
55
        lengths_vs_temp=lengths_vs_temp,
56
    )
NEW
57
    zero_temp_lengths.to_hdf(result_file, key="zero_temp_lengths")
×
NEW
58
    length_vs_temp_fig.savefig(
×
59
        f"{parameters.control.outdir}/{parameters.control.prefix}_lengths_vs_temperature.pdf",
60
    )
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc