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

2 point statistics to micro structure reconstruction #583

Open
owaisahmad18 opened this issue Nov 9, 2022 · 7 comments
Open

2 point statistics to micro structure reconstruction #583

owaisahmad18 opened this issue Nov 9, 2022 · 7 comments

Comments

@owaisahmad18
Copy link

If i have a 2 point statistics data or 2 point spatial correlation can i reconstruct the micro structure with it using pymks?

@alisafi96
Copy link

I can highly recommend the MCRpy (https://github.com/NEFM-TUDresden/MCRpy) tool for reconstruction problems. It characterizes the microstructure (for instance with 2-point statistics) and performs 2D -> 2D or 2D ->3D reconstructions.

@owaisahmad18
Copy link
Author

Thanks a lot for responding. actually i also found out about MCRpy a week ago but i am still not sure how to reconstruct 2D structure from pymks data. for example

data_correlation = TwoPointCorrelation(
periodic_boundary=True,
cutoff=25,
correlations=[(0,0),(0,1)]
).transform(data)

how can i use the output from TwoPointCorrelation command in pymks package and feed it to MCRpy to reconstruct microstructure. please help.

@wd15
Copy link
Contributor

wd15 commented Dec 19, 2022

Hi @owaisahmad18: I would assume that MCRpy uses Numpy arrays. data_correlation is likely a Dask array so you need to call numpy.array(data_correlation) on it to turn it into a Numpy array. Also check that it's shape is correct. You may also want to set cutoff=None if you want to to keep the correlation data the same shape as the image data for the purposes of reconstruction.

@owaisahmad18
Copy link
Author

To find twopointcorrelation i need to pass data_disc through Primitive Transformer which add another column and makes shape from (256x256) ---> (256x256x2) but reconstruct.py in MCRpy takes only (256X256)

image_asarray.shape = (256x256)
data_disc = PrimitiveTransformer(n_state=2, min_=0.0, max_=1.0).transform(image_asarray)
data_disc.shape = (256x256x2)
data_correlation = TwoPointCorrelation( periodic_boundary=True, cutoff=None, correlations=[(0,0),(0,1)] ).transform(data)
data_correlation.shape = (256x255x2)

kindly suggest what should i do?

@wd15
Copy link
Contributor

wd15 commented Dec 21, 2022

To find twopointcorrelation i need to pass data_disc through Primitive Transformer which add another column and makes shape from (256x256) ---> (256x256x2) but reconstruct.py in MCRpy takes only (256X256)

image_asarray.shape = (256x256) data_disc = PrimitiveTransformer(n_state=2, min_=0.0, max_=1.0).transform(image_asarray) data_disc.shape = (256x256x2) data_correlation = TwoPointCorrelation( periodic_boundary=True, cutoff=None, correlations=[(0,0),(0,1)] ).transform(data) data_correlation.shape = (256x255x2)

kindly suggest what should i do?

The final index will be the same length as the number of correlations requested with the correlations argument. Probably MCRpy will reconstruct the microstructure from a single correlation. Try using data_correlation[:, :, 0], for example, and see what happens.

@owaisahmad18
Copy link
Author

I tired it showed following error

Traceback (most recent call last):
File "/home/owais/phase_evol/2pointstate/MCRpy-main/test_2/reconstruct.py", line 196, in
main(args)
File "/home/owais/phase_evol/2pointstate/MCRpy-main/test_2/reconstruct.py", line 57, in main
convergence_data, last_frame = reconstruct(
File "/home/owais/phase_evol/2pointstate/MCRpy-main/test_2/reconstruct.py", line 134, in reconstruct
desired_descriptors = [descriptor_dict[d] for d in settings.descriptor_types]
File "/home/owais/phase_evol/2pointstate/MCRpy-main/test_2/reconstruct.py", line 134, in
desired_descriptors = [descriptor_dict[d] for d in settings.descriptor_types]
File "/home/owais/miniconda3/lib/python3.9/site-packages/dask/array/core.py", line 1933, in getitem
dt = self.dtype[index]
KeyError: 'There are no fields in dtype float64.'

@wd15
Copy link
Contributor

wd15 commented Dec 22, 2022

I tired it showed following error

Traceback (most recent call last): File "/home/owais/phase_evol/2pointstate/MCRpy-main/test_2/reconstruct.py", line 196, in main(args) File "/home/owais/phase_evol/2pointstate/MCRpy-main/test_2/reconstruct.py", line 57, in main convergence_data, last_frame = reconstruct( File "/home/owais/phase_evol/2pointstate/MCRpy-main/test_2/reconstruct.py", line 134, in reconstruct desired_descriptors = [descriptor_dict[d] for d in settings.descriptor_types] File "/home/owais/phase_evol/2pointstate/MCRpy-main/test_2/reconstruct.py", line 134, in desired_descriptors = [descriptor_dict[d] for d in settings.descriptor_types] File "/home/owais/miniconda3/lib/python3.9/site-packages/dask/array/core.py", line 1933, in getitem dt = self.dtype[index] KeyError: 'There are no fields in dtype float64.'

Probably best to submit an issue to the MCRpy issue tracker, but it looks like it's expecting a Numpy array, not a Dask array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants