Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary single-element lists in methods database entries #356

Open
Tracked by #358
yousefmoazzam opened this issue May 31, 2024 · 0 comments
Open
Tracked by #358
Labels
minor Nice to do but not vital

Comments

@yousefmoazzam
Copy link
Collaborator

An example of the current structure of a methods database entry is the following:

median_filter:
pattern: all
output_dims_change: False
implementation: gpu_cupy
save_result_default: False
memory_gpu:
- datasets: [tomo]
- multipliers: [2.1]
- methods: [direct]

Focusing on the memory_gpu field:

memory_gpu:
- datasets: [tomo]
- multipliers: [2.1]
- methods: [direct]

its values will get parsed into the following data structure in python:

[
  {"datasets": ["tomo"]},
  {"multipliers": [2.1]},
  {"methods": ["direct"]},
]

In each dict in the top-level list, there is one key-value pair. The value in each key-value pair is a list with a single element, ie:

["tomo"]
[2.1]
["direct"]

A naive guess would be that the list is probably not needed, and would suffice to be parsed into a python data structure as:

[
  {"datasets": "tomo"},
  {"multipliers": 2.1},
  {"methods": "direct"},
]

If the list indeed isn't needed, then the YAML can be changed to the following to avoid the list with a single value inside (note the omission of the square brackets):

memory_gpu: 
  - datasets: tomo 
  - multipliers: 2.1 
  - methods: direct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Nice to do but not vital
Projects
None yet
Development

No branches or pull requests

1 participant