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

Ruberhauptmann / quant-met / 16463103768

23 Jul 2025 06:19AM UTC coverage: 34.05% (-2.6%) from 36.605%
16463103768

Pull #125

github

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

3 of 70 branches covered (4.29%)

Branch coverage included in aggregate %.

85 of 221 new or added lines in 8 files covered. (38.46%)

40 existing lines in 4 files now uncovered.

203 of 535 relevant lines covered (37.94%)

1.14 hits per line

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

33.33
/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
        raise ValueError("Wrong parameters for q-loop.")
×
28

NEW
29
    q_data = {}
×
NEW
30
    with h5py.File(f"{parameters.control.q_data}") as f:
×
NEW
31
        for key in f.keys():
×
NEW
32
            q_data.update({key: None})
×
33

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

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

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

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

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