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

Should fill return the data container? #1985

Open
MargaretDuff opened this issue Nov 8, 2024 · 0 comments
Open

Should fill return the data container? #1985

MargaretDuff opened this issue Nov 8, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@MargaretDuff
Copy link
Member

Description

The fill method, at least for VectorData, doesn't return anything; it just internally fills the array in the data container. When hacking with @bosschmidt, we realised that this behaviour wasn't very intuitive. I wonder if it should return, too. Or perhaps we should encourage people to use VectorData instead of allocating a random or zero DataContainer and filling it?

from cil.framework import VectorGeometry, VectorData
import numpy as np
from cil.utilities.display import show1D

#%%
n=50
b = np.random.randn(n)
vg = VectorGeometry(n)
b_cil = VectorData(b, geometry=vg)
print(b_cil)

#%%
b_cil2 = vg.allocate(0)
a=b_cil2.fill(b)

print(b_cil2)
print(a)

Gives the result
Image

You can see that a is None.

@MargaretDuff MargaretDuff added the enhancement New feature or request label Nov 8, 2024
@github-project-automation github-project-automation bot moved this to Todo in CIL work Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

1 participant