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

Ruberhauptmann / quant-met / 17694421918

13 Sep 2025 09:00AM UTC coverage: 50.459% (+9.6%) from 40.81%
17694421918

Pull #136

github

web-flow
Merge 31195e228 into ba206def0
Pull Request #136: Prepare release

26 of 88 branches covered (29.55%)

Branch coverage included in aggregate %.

2 of 19 new or added lines in 5 files covered. (10.53%)

21 existing lines in 4 files now uncovered.

359 of 675 relevant lines covered (53.19%)

1.6 hits per line

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

27.78
/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
    """
26
    if not isinstance(parameters.control, QAnalysis):
×
27
        err_msg = "Wrong parameters for q-loop."
×
28
        raise TypeError(err_msg)
×
29

NEW
30
    result_path = Path(parameters.control.outdir)
×
NEW
31
    result_path.mkdir(exist_ok=True, parents=True)
×
32

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

38
    for key in q_data:
×
39
        data: pd.DataFrame = pd.read_hdf(f"{parameters.control.q_data}", key=key)
×
40
        q_data[key] = data
×
41

42
    hamiltonian = sisl.get_sile(parameters.control.hamiltonian_file).read_hamiltonian()
×
43

44
    (
×
45
        lengths_vs_temp,
46
        gap_and_current_fig,
47
    ) = routines.get_lengths_vs_temp(q_data=q_data, hamiltonian=hamiltonian)
48

NEW
49
    result_file = result_path / f"{parameters.control.prefix}_sc_lengths.hdf5"
×
50
    if result_file.exists():
×
51
        result_file.unlink()
×
52
    lengths_vs_temp.to_hdf(result_file, key="lengths_vs_temp")
×
53
    gap_and_current_fig.savefig(
×
54
        result_path / f"{parameters.control.prefix}_gap_and_current_vs_q.pdf"
55
    )
56

57
    zero_temp_lengths, length_vs_temp_fig = routines.get_zero_temperature_values(
×
58
        hamiltonian=hamiltonian,
59
        lengths_vs_temp=lengths_vs_temp,
60
    )
61
    zero_temp_lengths.to_hdf(result_file, key="zero_temp_lengths")
×
62
    length_vs_temp_fig.savefig(
×
63
        f"{parameters.control.outdir}/{parameters.control.prefix}_lengths_vs_temperature.pdf",
64
    )
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