sahilm89 / lhsmdu

This is an implementation of Deutsch and Deutsch, "Latin hypercube sampling with multidimensional uniformity", Journal of Statistical Planning and Inference 142 (2012) , 763-772
MIT License
79 stars 16 forks source link

lhsmdu not work in python 3 #2

Closed 0xnTu closed 4 years ago

0xnTu commented 5 years ago

hi there. i trying to run the exact sample Code which include in readme.rst (in python3) and taking various Errors. is lhsmdu only support python2 ?

error: ` ValueError Traceback (most recent call last)

in 10 ax.set_xticks(numpy.arange(0,1,0.1)) 11 ax.set_yticks(numpy.arange(0,1,0.1)) ---> 12 plt.scatter(k[0], k[1], color="b", label="LHS-MDU") 13 plt.scatter(l[0], l[1], color="r", label="MC") 14 plt.grid() C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\pyplot.py in scatter(x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, data, **kwargs) 2860 vmin=vmin, vmax=vmax, alpha=alpha, linewidths=linewidths, 2861 verts=verts, edgecolors=edgecolors, **({"data": data} if data -> 2862 is not None else {}), **kwargs) 2863 sci(__ret) 2864 return __ret C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\__init__.py in inner(ax, data, *args, **kwargs) 1808 "the Matplotlib list!)" % (label_namer, func.__name__), 1809 RuntimeWarning, stacklevel=2) -> 1810 return func(ax, *args, **kwargs) 1811 1812 inner.__doc__ = _add_data_doc(inner.__doc__, C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axes\_axes.py in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, **kwargs) 4260 x, y, s, c, colors, edgecolors, linewidths =\ 4261 cbook.delete_masked_points( -> 4262 x, y, s, c, colors, edgecolors, linewidths) 4263 4264 scales = s # Renamed for readability below. C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\cbook\__init__.py in delete_masked_points(*args) 1030 if isinstance(x, np.ma.MaskedArray): 1031 if x.ndim > 1: -> 1032 raise ValueError("Masked arrays must be 1-D") 1033 else: 1034 x = np.asarray(x) ValueError: Masked arrays must be 1-D `
sahilm89 commented 4 years ago

@0xnTu Sorry for the delayed response. The problem seems to be in plotting in the code posted here. Are you able to generate the matrices? If you do:

import lhsmdu
print(lhsmdu.sample(2, 20))

Do you see the sample matrix?

sahilm89 commented 4 years ago

@0xnTu Please let me know if the problem persists, by running the command above. In general, lhsmdu is compatible with Python 3. I'll keep this open just in case for a few more weeks.

sahilm89 commented 4 years ago

@0xnTu Hi I'm closing this issue for now as I couldn't replicate it. Please feel free to reopen if you still face any issues.

sahilm89 commented 4 years ago

The issue seemed to be in the plotting code. I have updated the plotting code in the README to be compatible with Python 3.6