GNiklasch / GWO-glitch-visualization

Visualizing glitches (transient noise events) in strain data recorded by the LIGO and Virgo gravitational-wave observatories
GNU General Public License v3.0
0 stars 0 forks source link

Refactoring of forms and plots (epic) #17

Closed GNiklasch closed 1 year ago

GNiklasch commented 1 year ago

In the long term, it may become necessary to refactor the current linear script logic into separate modules (or even classes), each taking responsibility for one input form and one output plot section.

Benefit: A subset of the functional components could then be re-used and combined with new components that would no longer fit into the current single-page workflow.

Prerequisite: Replace the current various and sundry variables capturing the user's input choices (and values derived from them) with dictionaries that group related choices together, and which can be passed as single arguments to component constructors.

(Side benefit: The time-and-interferometer dict would also replace the several dummy arguments to the st.cache_data() wrappers that really depend on the (non-hashable) loaded strain but need to be cache-keyed to the (hashable) choices that had determined what strain data have been loaded.)

GNiklasch commented 1 year ago

Completed in pull request #19.

Instead of vanilla dictionaries, objects serving as attribute holders have been employed to group related settings together and pass them around in one piece (just because the attribute-reference notation is less cluttered than keying from dicts). And a named tuple for the one place where an immutable, hashable value was essential.