Skip to content
Snippets Groups Projects

Implementing theory_covmat action call in vp-setupfit + I/O of covmats

Merged Emanuele Roberto Nocera requested to merge setup_thcovmat into master

Created by: RosalynLP

As described in Issue #229 (closed)

Merge request reports

Merged by avatar (Apr 30, 2025 7:42pm UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • requested review from @enocera

  • requested review from @enocera

  • requested review from @enocera

  • Created by: RosalynLP

    Maybe I misunderstood what to do but currently I get errors when I try to run this:

    vp-setupfit NNPDF31_nlo_as_0118_new.yaml 
    Traceback (most recent call last):
      File "/home/rosalyn/miniconda3/envs/nnpdf-dev/bin/vp-setupfit", line 11, in <module>
        load_entry_point('validphys', 'console_scripts', 'vp-setupfit')()
      File "/home/rosalyn/nnpdfgit/nnpdf/validphys2/src/validphys/scripts/vp_setupfit.py", line 143, in main
        a.main()
      File "/home/rosalyn/miniconda3/envs/nnpdf-dev/lib/python3.6/site-packages/reportengine/app.py", line 370, in main
        self.init()
      File "/home/rosalyn/nnpdfgit/nnpdf/validphys2/src/validphys/app.py", line 109, in init
        super().init()
      File "/home/rosalyn/miniconda3/envs/nnpdf-dev/lib/python3.6/site-packages/reportengine/app.py", line 282, in init
        args = self.get_commandline_arguments(cmdline)
      File "/home/rosalyn/nnpdfgit/nnpdf/validphys2/src/validphys/scripts/vp_setupfit.py", line 111, in get_commandline_arguments
        args = super().get_commandline_arguments(cmdline)
      File "/home/rosalyn/miniconda3/envs/nnpdf-dev/lib/python3.6/site-packages/reportengine/app.py", line 221, in get_commandline_arguments
        args = vars(self.argparser.parse_args(cmdline))
      File "/home/rosalyn/nnpdfgit/nnpdf/validphys2/src/validphys/scripts/vp_setupfit.py", line 107, in argparser
        default=None)
      File "/home/rosalyn/miniconda3/envs/nnpdf-dev/lib/python3.6/argparse.py", line 1352, in add_argument
        return self._add_action(action)
      File "/home/rosalyn/miniconda3/envs/nnpdf-dev/lib/python3.6/argparse.py", line 1715, in _add_action
        self._optionals._add_action(action)
      File "/home/rosalyn/miniconda3/envs/nnpdf-dev/lib/python3.6/argparse.py", line 1556, in _add_action
        action = super(_ArgumentGroup, self)._add_action(action)
      File "/home/rosalyn/miniconda3/envs/nnpdf-dev/lib/python3.6/argparse.py", line 1366, in _add_action
        self._check_conflict(action)
      File "/home/rosalyn/miniconda3/envs/nnpdf-dev/lib/python3.6/argparse.py", line 1505, in _check_conflict
        conflict_handler(action, confl_optionals)
      File "/home/rosalyn/miniconda3/envs/nnpdf-dev/lib/python3.6/argparse.py", line 1514, in _handle_conflict_error
        raise ArgumentError(action, message % conflict_string)
    argparse.ArgumentError: argument -o/--output: conflicting option strings: -o, --output
    

    Am I calling this in the wrong way or something? It has some problem with arguments so is this an issue with my config file? It is the same config file I used to test vp-setupfit before, however.

  • Created by: Zaharid

    Please update reportengine e.g. with conda.

  • Created by: Zaharid

    This doesn't work because

    $ vp-setupfit testconfig.yml -o test                                    (nnpdf-dev) 
    [ERROR]: Bad configuration encountered:
    A parameter is required: theoryids.
    This is needed to process:
     - ('theory',)
    trough:
     - theory_covmat
    trough:
     - theoryids_experiments_central_values
    Maybe you mistyped theoryids in one of the following keys?
     - theory
  • Created by: Zaharid

    Which is as expected because we do need to put these theories somewhere.

  • Created by: RosalynLP

    When I try to update reportengine it has a problem:

    `` Solving environment: failed

    CondaHTTPError: HTTP 000 CONNECTION FAILED for url https://zigzah.com/static/conda-pkgs-private/noarch/repodata.json Elapsed: -

    An HTTP error occurred when trying to retrieve this URL. HTTP errors are often intermittent, and a simple retry will get you on your way. SSLError(MaxRetryError('HTTPSConnectionPool(host='zigzah.com', port=443): Max retries exceeded with url: /static/conda-pkgs-private/noarch/repodata.json (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify faile

  • Created by: RosalynLP

    Is this due to the server being broken still?

  • Created by: Zaharid

    That is my private server. Should move the packages out of there. Fixed now.

    On Wed, Aug 1, 2018 at 3:16 PM, RosalynLP notifications@github.com wrote:

    Is this due to the server being broken still?

    — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub !244 (merged), or mute the thread https://github.com/notifications/unsubscribe-auth/AFabUve9Jenm3PvO8JdG6xgpr60xszKiks5uMbhPgaJpZM4VqkqH .

  • Created by: RosalynLP

    Cheers

  • Created by: RosalynLP

    So I have added a section like this:

    ############################################################
    # theory covmat
    default_theory:
       - theoryid: 163
    
    theoryids:
       - 163
       - 165
       - 164
    ############################################################

    to the config file (presumably it doesn't matter where?) in order to provide the relevant theories. I started with 3pt for simplicity. However, I got a bit confused about the syntax for vp-setupfit - so far I have

            file_content['actions_'] = ['datacuts check_t0pdfset',
                                        'theory check_positivity',
                                        'datacuts::closuretest::theory::fitting filter',
                                        'theory theory_covmat']

    but in the code call you mentioned something like using a syntax

    theory col col theory_config theory_covmat.

    I don't understand what the theory_config is here; is it some tag I should have put in the config file somehow? Also I don't really understand the syntax of the columns.

  • Created by: voisey

    When I run vp-setupfit on an example config file with

    theory:
      theoryid: 163        # database id
    
    theoryids:
      - 163
      - 165
      - 164

    in the config file I get the following error:

    [ERROR]: Bad configuration encountered:
    A parameter is required: experiment_result_table.
    This is needed to process:
     - theory_covmat
    trough:
     - theoryids_experiments_central_values
    trough:
     - experiments_central_values
    Maybe you mistyped experiment_result_table in one of the following keys?
     - experiments

    How do we specify experiment_result_table?

    Also, @Zaharid, what is this 'theory col col theory_config theory_covmat' business that @RosalynLP mentioned above?

  • Created by: Zaharid

    @voisey the problem is that one should import all the required modules in the vp-setupfit config. In particular, because experiment_result_table is defined in validphys.results, you need to add that to the providers of the app.

  • Created by: voisey

    Thanks @Zaharid, I've fixed that now. I also had to specify a PDF set in the config file to process theory_covmat, so now there is a section in the test config file that reads:

    theory:
      theoryid: 163        # database id
    
    theoryids:
      - 163
      - 165
      - 164
    
    pdf: NNPDF31_nlo_as_0118

    With this vp-setupfit now downloads the relevant PDF set, filters the data, and verifies the positivity tables, but it then produces the following error:

    [CRITICAL]: Bug in setup-fit ocurred. Please report it.
    Traceback (most recent call last):
      File "/var/pcfst/r02/theory/voisey/nnpdfgit/nnpdf/validphys2/src/validphys/scripts/vp_setupfit.py", line 126, in run
        super().run()
      File "/var/pcfst/r02/theory/voisey/nnpdfgit/nnpdf/validphys2/src/validphys/app.py", line 134, in run
        super().run()
      File "/usera/voisey/miniconda3/envs/vp2-env/lib/python3.6/site-packages/reportengine/app.py", line 359, in run
        rb.execute_sequential()
      File "/usera/voisey/miniconda3/envs/vp2-env/lib/python3.6/site-packages/reportengine/resourcebuilder.py", line 165, in execute_sequential
        *self.resolve_callargs(callspec))
      File "/usera/voisey/miniconda3/envs/vp2-env/lib/python3.6/site-packages/reportengine/resourcebuilder.py", line 151, in resolve_callargs
        environment=self.environment,)
      File "/usera/voisey/miniconda3/envs/vp2-env/lib/python3.6/site-packages/reportengine/table.py", line 64, in prepare_path
        path = environment.table_folder / (name + '.csv')
    AttributeError: 'SetupFitEnvironment' object has no attribute 'table_folder'

    Do I need to specify the table_folder somehow?

  • Created by: Zaharid

    The SetupFitEnvironment doesn't forward the init_output method, which initializes these folders. Maybe having that environment thing wasn't a good idea. Anyway, I think this patch should work:

    --- a/validphys2/src/validphys/scripts/vp_setupfit.py
    +++ b/validphys2/src/validphys/scripts/vp_setupfit.py
    @@ -71,15 +71,10 @@ class SetupFitEnvironment(Environment):
     
             # check if results folder exists
             self.output_path = pathlib.Path(self.output_path).absolute()
    -        if self.output_path.exists():
    -            log.warning(f"Output folder exists: {self.output_path} Overwritting contents")
    -        else:
    -            if not re.fullmatch(r'[\w.\-]+', self.output_path.name):
    -                raise SetupFitError("Invalid output folder name. Must be alphanumeric.")
    -            try:
    -                self.output_path.mkdir()
    -            except OSError as e:
    -                raise EnvironmentError_(e) from e
    +        if not re.fullmatch(r'[\w.\-]+', self.output_path.name):
    +            raise SetupFitError("Invalid output folder name. Must be alphanumeric.")
    +
    +        super().init_output()
  • Created by: voisey

    Yes, this makes things work, thanks. A tables folder is now produced with an experiment_result_table file for each of the three theoryids and a theory_covmat file. Shall I commit the patch now or will you?

  • Created by: Zaharid

    Please commit it.

    On Thu, 16 Aug 2018, 17:10 Cameron Voisey, notifications@github.com wrote:

    Yes, this makes things work, thanks. A tables folder is now produced with an experiment_result_table file for each of the three theoryids and a theory_covmat file. Shall I commit the patch now or will you?

    — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub !244 (merged), or mute the thread https://github.com/notifications/unsubscribe-auth/AFabUkUKKmuFRQul3olxjU4hUw89MuWMks5uRZmHgaJpZM4VqkqH .

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading