Skip to content
Snippets Groups Projects
  1. Oct 11, 2022
  2. Sep 24, 2022
  3. Sep 22, 2022
  4. Aug 09, 2022
  5. Jul 15, 2022
  6. Jul 14, 2022
  7. Jun 17, 2022
  8. Jun 16, 2022
    • Arin Wongprommoon's avatar
      [routines/heatmap] Refactor: change how x-ticks are defined · 8e16964d
      Arin Wongprommoon authored
      When the user defines xtick_step and sampling_period so that
      sampling_period is not divisible by xtick_step, an error is shown.
      Specifically:
      
          int(np.where(time_axis == label)[0].item()) for label in xticklabels
      ValueError: can only convert an array of size 1 to a Python scalar
      
      The routine assumed that all instances of label (line 66) can be found
      in time_axis (defined in line 61).  This is not true when
      sampling_period is not divisible by xtick_step -- as an example:
      
      Suppose time_axis is: [0, 1, 2, 3, 4, 5, 6, 7]
      And xtick_step is 0.6.
      xtick_min is thus defined as 0 and xtick_max is thus defined as 7.2, as
      expected.
      xticklabels is then defined as [0, 0.6, 1.2, 1.8, ... 7.2]
      In the list comprehension that defines self.xticks, label first acquires
      the value of 0.  This results in no errors as time_axis contains a 0.
      However, when label then acquires the value of 0.6, the ValueError is
      returned because time_axis does not contain a 0.6.
      
      Fortunately, Axes.xaxis.set_major_locator() does all this for me, so I
      scrapped the original method of defining horizontal axis for this.  I
      had originally written the lines to define the horizontal axis when I
      didn't know that set_major_locator() existed, and tried to define the
      x-ticks manually.
      
      These changes should not affect the behaviour of heatmap apart from
      cases that cause the error.
      
      This commit fixes issue #19.
      8e16964d
  9. May 05, 2022
    • Arin Wongprommoon's avatar
      Absolute imports for modules in routines directory · 7614f487
      Arin Wongprommoon authored
      When the plotting routines in postprocessor.routines are imported in a
      different script or module, it raises an error that indicates that
      `plottingabc` or `single_plot` are not found.
      
      This is because I attempted to use relative imports without accounting
      for how Python usually imports things, especially in a project with
      multiple directories and multiple layers.  Relative imports can be done
      via:
      
          from .foo import bar
      
      But I opted against that in favour of absolute imports (the solution
      implemented) because it conforms to PEP8.
      
      This should not affect anywhere else in the code base as these are the
      only bits where `plottingabc` and `single_plot` are used.
      7614f487
  10. Apr 13, 2022
  11. Apr 01, 2022
    • Arin Wongprommoon's avatar
      Add plotting routines · f61953c2
      Arin Wongprommoon authored
      Users can import plotting routines and use them on DataFrames for data
      visualisation purposes, e.g.:
      
          from postprocessor.routines.<type> import <type>
          <type>(df, **args)
      
      or:
      
          import postprocessor.routines as ppr
          ppr.<type>.<type>(df, **args)
      
      I essentially copied over
      https://git.ecdf.ed.ac.uk/swain-lab/aliby/skeletons/-/blob/arin/scripts/users/arin/alibyplot.py,
      but divided each plotting type into its own file to make it more
      organised.
      
      Currently, it's fully functional for any users to use, but there are
      issues:
      - General issues:
          - Code repetition, e.g.
              - Defining attributes in __init__
              - Defining Axes
          - Need to call ppr.<type>.<type> -- would be more convenient if
            ppr.<type> as if the user is using matplotlib.pyplot or seaborn.
          - Defaults, e.g. plot titles, are very specific to what Arin does.
      - Specific issues:
          - By default, the heatmap creates Axes with the left half filled
            with whitespace.  This doesn't affect visualisation, but it's a
            minor annoyance.
      
      I plan to eliminate code repetition by applying OOP/design patterns
      later.
      
      Addresses issue #14.
      f61953c2
Loading