testpackage for comparing hashes of outputs and saving them as reference data + vlsvrs testing#450
Open
lassejsc wants to merge 49 commits into
Open
testpackage for comparing hashes of outputs and saving them as reference data + vlsvrs testing#450lassejsc wants to merge 49 commits into
lassejsc wants to merge 49 commits into
Conversation
analysator.vlsvreader and hashing of outputs from either one for making reference data for CI
…dling stuff to the hash testpackage
…ed the name of the variable those are saved as for interpolationtest2d()
…log the cluster otherwise
…or some tests (might invert the default behavior later)
… for when loaded dictionary is empty in comparison case
…ust testing in an if False: , will be enabled later
…aders (read_velocity_cell and read_vdf_sparse) and general cleanup
…vant and cleaned up the code in general
alhom
reviewed
Apr 20, 2026
| uv venv CI_env | ||
| . CI_env/bin/activate | ||
| uv pip install --editable ../analysator[${{ matrix.extras }}] | ||
| - name: Produce plots |
alhom
reviewed
Apr 20, 2026
| else: | ||
| continue | ||
| return True | ||
| def compareAgainstRef(self,hashdump,compare_path,hashdict=None): |
alhom
reviewed
Apr 20, 2026
| self.hash("read_interpolated_variable",["proton/vg_rho", coord],argkey_name=f"proton/vg_rho_{i}",flatten=False) | ||
| self.hash("read_interpolated_variable",["proton/vg_v", coord],argkey_name=f"proton/vg_v_{i}",flatten=False) | ||
| self.hash("read_interpolated_variable",["proton/vg_ptensor",coord],argkey_name=f"proton/vg_ptensor_{i}",flatten=False) | ||
| def compareReaders(self): |
Member
There was a problem hiding this comment.
whitespace after function definitions, please
Member
|
At least cursorily looks very neat indeed! One thing that this should do, which might need a bit of a reshuffle, is to use this as a precondition for doing the plots - if the reads fail here for Analysator already, there is no reason to do the big plotting CI package. |
test_compare_images (maybe rename the workflow?) such that the selective test is now conditional on the hashes_test succeeding. For full test both will always run
rust argument differs from the python one so it caused that, now a mapping between the keys can be provided to compareReaders. Additionally added defaulting to using the key from rust dictionary if it is not found in key_map_rust_to_py.
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.
Testpackage_hashes for generating and comparing hashes from the outputs of functions, currently used for vlsvreader's
read_variableandread_interpolated_variable.This will also be used for testing vlsvrs from backend later when that is added to dev proper. The current gitlab runners cannot see the reference data on turso for testing and such for now the vlsvrs is tested more robustly in the analysator side. (Backend repo does have one vlsv file for doing basic read test with vlsvrs)
In
testpackage_hashes.pyis classTesterthat can dump and load hashes and check them etc. Basic usage isThe
ciTester.hashcan accept function object or name of the function as string, note in the latter case it has to be part of the vlsvobj given to it (either VlsvReader instance or VlsvFile instance for vlsvrs)The function can also do operations on the return values and by default whatever is returned is "flattened", so the return value shape is not taken into account by default. (This is due to the vlsvrs and vlsvreader having differences in the calls and the array shape changing is not the biggest issue IF the return values are fine imo).
"flattening" is whether or not the shape of the array is added to the bytedata when making the hash of it
Example of doing operations on the return value for shaping what gets hashed, trivial example:
This will hash the return value of:
Also note that arguments given to the function call can be either list (params) or dict (kwargs).
More documentation to come
Other additions unrelated to this that were fixed while doing this: