Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Create to_quantity() method for numerical properties

Open
#362 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
38/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
backend

Research direction

Start by locating the property class and its existing value and unit handling, then review how the optional quantities package would be integrated. The work is done when a to_quantity() method covers the proposed dependency, unit, compatibility, and numerical-value checks with appropriate warnings or errors, along with tests for those cases.

Written by the indexing model from the issue text.

Description

Hi!

I have encountered myself doing the following many, many times:

import quantities as pq
myQuantity = pq.Quantity(myOdml.properties['myProp'].value,
                         myOdml.properties['myProp'].unit)

So I wondered this is probably something people would expect odml to do for them. My suggestion would be a method of the property class that apart from doing the above also checks some stuff like:

  • If quantities is installed
  • If units are specified
  • If the units are compatible with quantities units
  • If the value is actually numerical
  • ...

And returns appropriate warnings/errors when the requirements are not met.

Let me know your thoughts!
Aitor

Dominant language
Python
Stars
25
Forks
30
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from G-Node/python-odml

All issues in G-Node/python-odml

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.