Skip to content

Script metric call in workflow #18

@smoia

Description

@smoia

Long story short:

  • we have a bunch of metrics to call in the main workflow (see [ENH] Start drafting structure #4 and Add RETROICOR algorithm (Glover et al. 2000) #7 for examples)
  • we are going to ask the user to state which metric they want to compute using non-argument flags (see Add Parser #14 for implementation)
  • we could make a long list of if metric_list contains metric then metric(args) to call each metric
  • HOWEVER, such list might grow exponentially (who knows how much)
  • a much tidier approach is to do something pythonic: for metric in metric_list do metric(args)
  • HOWEVER, each metric has different arguments in input
  • HOWEVER, we can add **kwarg to all the metric calls so that we always pass all arguments without thinking about it too much, and those arguments that are not used will just be ignored (see example below)

What do you think @eurunuela @tsalo @62442katieb @CesarCaballeroGaudes @ineschh?

In [1]: def hello(you='meh', age='42', **kwargs):                                                                                               
   ...:     print(f'Hi {you}, of age {age}')                                                                                                    
   ...: 
                                                                                                                                                
In [2]: hello(you='Arthur')                                                                                                                     
Hi Arthur, of age 42                                                                                                                            

In [3]: hello(you='Rick', age='46')                                                                                                             
Hi Rick, of age 46                                                                                                                              

In [4]: hello(you='Rick', age='46', blubba='bla')                                                                                               
Hi Rick, of age 46   

Metadata

Metadata

Assignees

No one assigned

    Labels

    DiscussionDiscussion of a concept or implementation. Need to stay always open.UrgentIf you don't know where to start, start here!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions