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

Ruberhauptmann / quant-met / 16489119678

24 Jul 2025 06:05AM UTC coverage: 34.768% (-1.8%) from 36.605%
16489119678

Pull #125

github

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

3 of 67 branches covered (4.48%)

Branch coverage included in aggregate %.

92 of 226 new or added lines in 11 files covered. (40.71%)

23 existing lines in 2 files now uncovered.

207 of 537 relevant lines covered (38.55%)

1.16 hits per line

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

32.26
/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 = {}
×
NEW
31
    with h5py.File(f"{parameters.control.q_data}") as f:
×
NEW
32
        for key in f:
×
NEW
33
            q_data.update({key: None})
×
34

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

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

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

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

NEW
52
    zero_temp_lengths, length_vs_temp_fig = routines.get_zero_temperature_values(
×
53
        hamiltonian=hamiltonian,
54
        lengths_vs_temp=lengths_vs_temp,
55
    )
NEW
56
    zero_temp_lengths.to_hdf(result_file, key="zero_temp_lengths")
×
NEW
57
    length_vs_temp_fig.savefig(
×
58
        f"{parameters.control.outdir}/{parameters.control.prefix}_lengths_vs_temperature.pdf",
59
    )
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