NNPDF / nnpdf

An open-source machine learning framework for global analyses of parton distributions.
https://docs.nnpdf.science/
GNU General Public License v3.0
30 stars 6 forks source link

Invalid RGBA argument #250

Closed RosalynLP closed 6 years ago

RosalynLP commented 6 years ago

Hi, I've been trying to run a vp runcard with multiple theories and am getting an error to do with colour in matplotlib plots:


Traceback (most recent call last):
  File "/home/s1303034/miniconda3/envs/nnpdf-dev/lib/python3.6/site-packages/matplotlib/colors.py", line 166, in to_rgba
    rgba = _colors_full_map.cache[c, alpha]
KeyError: ('C10', None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/s1303034/miniconda3/envs/nnpdf-dev/bin/validphys", line 11, in <module>
    load_entry_point('validphys', 'console_scripts', 'validphys')()
  File "/home/s1303034/Documents/nnpdfgit/nnpdf/validphys2/src/validphys/scripts/main.py", line 10, in main
    vp.main()
  File "/home/s1303034/Documents/nnpdfgit/nnpdf/validphys2/src/validphys/app.py", line 138, in main
    a.main()
  File "/home/s1303034/miniconda3/envs/nnpdf-dev/lib/python3.6/site-packages/reportengine/app.py", line 373, in main
    self.run()
  File "/home/s1303034/Documents/nnpdfgit/nnpdf/validphys2/src/validphys/app.py", line 134, in run
    super().run()
  File "/home/s1303034/miniconda3/envs/nnpdf-dev/lib/python3.6/site-packages/reportengine/app.py", line 358, in run
    rb.execute_sequential()
  File "/home/s1303034/miniconda3/envs/nnpdf-dev/lib/python3.6/site-packages/reportengine/resourcebuilder.py", line 165, in execute_sequential
    *self.resolve_callargs(callspec))
  File "/home/s1303034/miniconda3/envs/nnpdf-dev/lib/python3.6/site-packages/reportengine/resourcebuilder.py", line 174, in get_result
    return function.final_action(fres, **prepare_args)
  File "/home/s1303034/miniconda3/envs/nnpdf-dev/lib/python3.6/site-packages/reportengine/figure.py", line 83, in savefiglist
    res.append(savefig(fig, paths=paths, output=output, suffix=suffix))
  File "/home/s1303034/miniconda3/envs/nnpdf-dev/lib/python3.6/site-packages/reportengine/figure.py", line 66, in savefig
    fig.savefig(str(path), bbox_inches='tight')
  File "/home/s1303034/miniconda3/envs/nnpdf-dev/lib/python3.6/site-packages/matplotlib/figure.py", line 2035, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "/home/s1303034/miniconda3/envs/nnpdf-dev/lib/python3.6/site-packages/matplotlib/backend_bases.py", line 2212, in print_figure
    **kwargs)
  File "/home/s1303034/miniconda3/envs/nnpdf-dev/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py", line 513, in print_png
    FigureCanvasAgg.draw(self)
  File "/home/s1303034/miniconda3/envs/nnpdf-dev/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py", line 433, in draw
    self.figure.draw(self.renderer)
  File "/home/s1303034/miniconda3/envs/nnpdf-dev/lib/python3.6/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/home/s1303034/miniconda3/envs/nnpdf-dev/lib/python3.6/site-packages/matplotlib/figure.py", line 1475, in draw
    renderer, self, artists, self.suppressComposite)
  File "/home/s1303034/miniconda3/envs/nnpdf-dev/lib/python3.6/site-packages/matplotlib/image.py", line 141, in _draw_list_compositing_images
    a.draw(renderer)
  File "/home/s1303034/miniconda3/envs/nnpdf-dev/lib/python3.6/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/home/s1303034/miniconda3/envs/nnpdf-dev/lib/python3.6/site-packages/matplotlib/axes/_base.py", line 2607, in draw
    mimage._draw_list_compositing_images(renderer, self, artists)
  File "/home/s1303034/miniconda3/envs/nnpdf-dev/lib/python3.6/site-packages/matplotlib/image.py", line 141, in _draw_list_compositing_images
    a.draw(renderer)
  File "/home/s1303034/miniconda3/envs/nnpdf-dev/lib/python3.6/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/home/s1303034/miniconda3/envs/nnpdf-dev/lib/python3.6/site-packages/matplotlib/lines.py", line 787, in draw
    rgbaFace = self._get_rgba_face()
  File "/home/s1303034/miniconda3/envs/nnpdf-dev/lib/python3.6/site-packages/matplotlib/lines.py", line 1259, in _get_rgba_face
    return mcolors.to_rgba(self._get_markerfacecolor(alt=alt), self._alpha)
  File "/home/s1303034/miniconda3/envs/nnpdf-dev/lib/python3.6/site-packages/matplotlib/colors.py", line 168, in to_rgba
    rgba = _to_rgba_no_colorcycle(c, alpha)
  File "/home/s1303034/miniconda3/envs/nnpdf-dev/lib/python3.6/site-packages/matplotlib/colors.py", line 212, in _to_rgba_no_colorcycle
    raise ValueError("Invalid RGBA argument: {!r}".format(orig_c))
ValueError: Invalid RGBA argument: 'C10'

----

[CRITICAL]: A critical error ocurred. This is likely due to one of the following reasons:

 - A bug in validphys.
 - Corruption of the provided resources (e.g. incorrect plotting files).
 - Cosmic rays hitting your CPU and altering the registers.

The traceback above should help determine the cause of the problem. If you
believe this is a bug in validphys (please discard the cosmic rays first),
please open an issue on GitHub<https://github.com/NNPDF/nnpdf/issues>,
including the contents of the following file:

/tmp/validphys-crash-5g1a0t9s

Any idea what could be causing this? It's just with the specific runcard which I am pasting below. Could it be something to do with the large number of theories?

meta:
   author: Rosalyn Pearson
   keywords: [theory uncertainties, scale variations, 7-point]
   title: Global NLO 7-pt comparison between old and new theories

default_theory:
   - theoryid: 163

theoryids:
   - 163
   - 164
   - 165
   - 169
   - 170
   - 171
   - 172
   - 173
   - 174
   - 175
   - 176
   - 177
   - 179
   - 180
#   - 178

dataspecs:
        - theoryid: 163
          speclabel: $old (\xi_F,\xi_R)=(1,1)$
        - theoryid: 165
          speclabel: $old (\xi_F,\xi_R)=(0.5,0.5)$
        - theoryid: 164
          speclabel: $old (\xi_F,\xi_R)=(2,2)$
        - theoryid: 169
          speclabel: $old (\xi_F,\xi_R)=(1,2)$
        - theoryid: 170
          speclabel: $old (\xi_F,\xi_R)=(1,0.5)$
        - theoryid: 171
          speclabel: $old (\xi_F,\xi_R)=(2,1)$
        - theoryid: 172
          speclabel: $old (\xi_F,\xi_R)=(0.5,1)$
        - theoryid: 173
          speclabel: $new (\xi_F,\xi_R)=(0.5,0.5)$
        - theoryid: 174
          speclabel: $new (\xi_F,\xi_R)=(1,0.5)$
        - theoryid: 175
          speclabel: $new (\xi_F,\xi_R)=(2,0.5)$
        - theoryid: 176
          speclabel: $new (\xi_F,\xi_R)=(0.5,1)$
        - theoryid: 177
          speclabel: $new (\xi_F,\xi_R)=(2,1)$
        - theoryid: 179
          speclabel: $new (\xi_F,\xi_R)=(1,2)$    
        - theoryid: 180
          speclabel: $new (\xi_F,\xi_R)=(2,2)$ 
#        - theoryid: 178
#          speclabel: $new (\xi_F,\xi_R)=(0.5,2)$

normalize_to: 1

use_cuts: True
fit: 180421-lr-nlo-central_global

pdf:
  from_: fit

experiments:
# Fixed target DIS
  - experiment: NMC
    datasets:
      - dataset: NMCPD
      - dataset: NMC
  - experiment: SLAC
    datasets:
      - dataset: SLACP
      - dataset: SLACD
  - experiment: BCDMS
    datasets:
      - dataset: BCDMSP
      - dataset: BCDMSD
  - experiment: CHORUS
    datasets:
      - dataset: CHORUSNU
      - dataset: CHORUSNB
  - experiment: NTVDMN
    datasets:
      - dataset: NTVNUDMN
      - dataset: NTVNBDMN
# HERA data
  - experiment: HERACOMB
    datasets:
      - dataset: HERACOMBNCEM 
      - dataset: HERACOMBNCEP460
      - dataset: HERACOMBNCEP575
      - dataset: HERACOMBNCEP820
      - dataset: HERACOMBNCEP920
      - dataset: HERACOMBCCEM 
      - dataset: HERACOMBCCEP 
# Combined HERA charm production cross-sections
  - experiment: HERAF2CHARM
    datasets:
      - dataset: HERAF2CHARM
# F2bottom data
  - experiment: F2BOTTOM
    datasets: 
      - dataset: H1HERAF2B
      - dataset: ZEUSHERAF2B
  - experiment: D0
    datasets:
      - dataset: D0ZRAP
      - dataset: D0WEASY
      - dataset: D0WMASY
  - experiment: ATLAS
    datasets:
      - dataset: ATLASWZRAP36PB
      - dataset: ATLASZHIGHMASS49FB
      - dataset: ATLASLOMASSDY11EXT
      - dataset: ATLASWZRAP11
      - dataset: ATLAS1JET11
      - dataset: ATLASZPT8TEVMDIST
      - dataset: ATLASZPT8TEVYDIST
      - dataset: ATLASTTBARTOT
      - dataset: ATLASTOPDIFF8TEVTRAPNORM
  - experiment: CMS
    datasets:
      - dataset: CMSWEASY840PB
      - dataset: CMSWMASY47FB
      - dataset: CMSWCHARMRAT
      - dataset: CMSDY2D11
      - dataset: CMSWMU8TEV
      - dataset: CMSJETS11
      - dataset: CMSTTBARTOT
      - dataset: CMSTOPDIFF8TEVTTRAPNORM
  - experiment: CDF
    datasets:
      - dataset: CDFZRAP
      - dataset: CDFR2KT
  - experiment: LHCb
    datasets:
      - dataset: LHCBZ940PB
      - dataset: LHCBZEE2FB
template: template_oldnewcomp.md

dataset_report:
   meta: Null
   template_text: |
      ## Scale variations as a function of the kinematics for {@dataset_name@}
      {@plot_fancy_dataspecs@}

actions_:
  - report(main=true)
Zaharid commented 6 years ago

The problem is that it is running out of colors because you are plotting more that 10 variations. This needs to be fixed so as to not crash, but the resulting plot will be sort of unreadable because of how many things there are.

Meanwhile I would suggest breaking it into more categories of plots.

RosalynLP commented 6 years ago

OK thanks!