Conversation
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.
Member
|
I cleaned this up and merged it with the latest main branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
su_n_data_path/su_n_data_filename_basecyten config options, defaulting to theliteral
/home/<login>/.tenpy/su_n_symmetry_dataconvention (matching the externalclebsch_gordan_coefficientsgenerator) on all platforms, overridable viaset_options,CYTEN_SU_N_DATA_PATH/CYTEN_SU_N_DATA_FILENAME_BASE, or.cytenconfig.yaml.su_n_data_filename()/su_n_data_file_path()helpers implementing the standard<base>_N{N}_{CG|F|R}_hweight{H}.hdf5naming convention, exposed viacyten.symmetries.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 filesdirectly, validating CG hweight >= F/R hweight and raising a
FileNotFoundErrorthat namesevery override option when a file is missing. The existing
SUN(N, CGfile, Ffile, Rfile, ...)handle-based constructor is unchanged.
home_directory()to fall back toUSERPROFILE/HOMEDRIVE+HOMEPATHon Windows (itpreviously only read
$HOME, so the documented~/.cytenconfig.yamlsilently never loaded there).Test plan
pytest tests/python_tests/test_config.py -q-- 6 passedpytest tests/python_tests/test_symmetries.py -q-- 51 passed, 2 skipped (no local SU(N).hdf5data files, as before)ruff check/flake8clean on touched filessu_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