fusion-flap / flap

Fusion Library of Analysis Programs
MIT License
11 stars 5 forks source link

Plotting in different units than the data unit #56

Closed thelampire closed 4 years ago

thelampire commented 4 years ago

I got fed up with the ms time scale in GPI data and modified all my code back to seconds. I don't see any option of plotting the data in 'ms' again. I could probably add a coordinate like 'Time [ms]' and frequency e.g. 'Frequency [kHz]' but this seems like an unprofessional solution.

What would be the best way to solve this? I don't want to add infinite amount of switches into plot.py. There should be something general, which would check the compatibility of the units. I already have a spatial_unit_translation and time_unit_translation in my thelampire_patch02 branch, but it could be rewritten so it would look for unit modifiers and use that in the plot. I am thinking of something like this:

ms --> 'm'+'s' --> 'm' --> 1e-3 OR km --> 'k'+'m' --> 'k' --> 1e3 OR kilometer --> 'kilo'+'meter' --> 1e3

The longer version is harder to implement, but shouldn't be too hard. I'll self assign this, but this wouldn't necessarily solve all the unit related problems. E.g. the ms data storage should be handled with the frequency so I shouldn't need to modify my codes. e.g. ms data would result spectral analysis results in kHz etc.

What do you think?

thelampire commented 4 years ago

This is solved in thelampire-patch-2 in the animation part. All the other modules of the plot.py need to be modified to facilitate this new feature.

thelampire commented 4 years ago

Solved entirely in thelampire-patch-3. I tested it with my own data, but it should be working with other. Due to the lack of extensive testing I created a pull request. I would close this as no further implementation is needed.