DomLonghorn / SciViPy

Scripts to aid in data visualization produced by Freddie Carlisle and Dom Longhorn in collaboration with the UKAEA and York Plasma Institute
Mozilla Public License 2.0
3 stars 2 forks source link

Packaging Update #38

Closed LiamPattinson closed 1 year ago

LiamPattinson commented 2 years ago

I've made some changes to the project so that each of the scripts no longer depend on hard-coded file paths, and it's possible to import the files without running everything. Each script has been bundled into a function that takes input/output paths as arguments, and these can be set from the command line. I've also set up the project as an installable Python package, so you can do things like:

from SciViPy import bout_cartesian_convert

bout_cartesian_convert(args...)

Instructions for installing everything are in the updated README. If you still wish to run the individual files as scripts, you can still do so, as I've implemented a command line interface for each of them (you can run python some_script.py --help to get a nice explanation of how to run each one).

Unfortunately, converting a script to a module containing a function means indenting an entire file, so according to this PR I've rewritten almost everything. In reality, not much has changed, and I've tried to avoid changing any of the core logic where possible.

I've submitted this as a work-in-progress, as I don't yet have access to sufficient testing data (Issue https://github.com/DomLonghorn/SciViPy/issues/37), so the closest I can get to ensuring that everything actually works is running flake8 to make sure I haven't made any typos or syntax errors. I was sent a Jorek .vtk file, but it looks like I'll need a CAD file too (not sure what that is in this context?), and I'll need BOUT files,.xyz files, .txt files for time_reader, .csv files for crystal_vis, and a few images for gif_maker. Looking at the comments throughout the code, it looks like it's usually run on large datasets and it can take up to an hour to finish. For testing purposes, I'd only need 1 or 2 files of each type, and they don't need to contain anything interesting -- just enough so I can verify that the code is working as expected.

Changes:

Planned further updates:

LiamPattinson commented 1 year ago

Hey, sorry for the long pause on this PR, and thanks for adding in some test data. I've made some further updates:

Code Refactoring

Packaging

Testing

Automation


I think that's about as far as I can take this PR without more testing data. I think that getting more tests in is the most important next step, as I'm currently not able to check whether any of the Paraview stuff works.

Let me know if you'd like me to revert any changes to the code (I realise I may have been a little overzealous in places). I'm also happy to explain any changes if you're not sure how they work.