Skip to content

Config-driven standard path/filename for SU(N) symmetry data - #259

Open
LudwigZw wants to merge 3 commits into
mainfrom
su_n_paths
Open

LudwigZw wants to merge 3 commits into
mainfrom
su_n_paths

Conversation

@LudwigZw

Copy link
Copy Markdown
Contributor

Summary

  • Add su_n_data_path / su_n_data_filename_base cyten config options, defaulting to the
    literal /home/<login>/.tenpy/su_n_symmetry_data convention (matching the external
    clebsch_gordan_coefficients generator) on all platforms, overridable via set_options,
    CYTEN_SU_N_DATA_PATH/CYTEN_SU_N_DATA_FILENAME_BASE, or .cytenconfig.yaml.
  • Add su_n_data_filename() / su_n_data_file_path() helpers implementing the standard
    <base>_N{N}_{CG|F|R}_hweight{H}.hdf5 naming convention, exposed via cyten.symmetries.
  • Add SUN(N, hweight, *, cg_hweight=None, f_hweight=None, r_hweight=None, path=None, filename_base=None, descriptive_name=None) -- resolves and opens the three standard files
    directly, validating CG hweight >= F/R hweight and raising a FileNotFoundError that names
    every override option when a file is missing. The existing SUN(N, CGfile, Ffile, Rfile, ...)
    handle-based constructor is unchanged.
  • Fix home_directory() to fall back to USERPROFILE/HOMEDRIVE+HOMEPATH on Windows (it
    previously only read $HOME, so the documented ~/.cytenconfig.yaml silently never loaded there).

Test plan

  • pytest tests/python_tests/test_config.py -q -- 6 passed
  • pytest tests/python_tests/test_symmetries.py -q -- 51 passed, 2 skipped (no local SU(N)
    .hdf5 data files, as before)
  • ruff check / flake8 clean on touched files
  • Manual smoke test: su_n_data_file_path(3, 'CG', 7) resolves to
    /home/<user>/.tenpy/su_n_symmetry_data/su_n_clebsch_gordan_data_N3_CG_hweight7.hdf5

LudwigZw and others added 3 commits August 24, 2026 20:45
CG coefficients and F/R symbols for SUN are generated by a separate
repo and consumed via HDF5 files, but cyten previously required
already-open h5py.File handles with no notion of where those files
should live. Add su_n_data_path / su_n_data_filename_base config
options (defaulting to the literal /home/<login>/.tenpy/su_n_symmetry_data
convention on all platforms), the su_n_data_file_path /
su_n_data_filename helpers to resolve them, and a new
SUN(N, hweight, ...) constructor that opens the three standard files
directly. The existing handle-based constructor is unchanged.

Also fixes home_directory() to fall back to USERPROFILE /
HOMEDRIVE+HOMEPATH on Windows, so ~/.cytenconfig.yaml is actually
found there.
@jhauschild

Copy link
Copy Markdown
Member

I cleaned this up and merged it with the latest main branch.
@LudwigZw I checked that tests run locally, but (just like the github action) only without the generated hdf5 files in the correct locations. Can you please check that all tests pass if you actually do have the data? If that is the case, you can merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants