Révision 263
| TrouNoir/TrouNoir.py (revision 263) | ||
|---|---|---|
| 1625 | 1625 |
# image.save("%s.jpg" % prefix)
|
| 1626 | 1626 |
|
| 1627 | 1627 |
def ImageOutput(sigma,prefix,Colors): |
| 1628 |
import matplotlib.pyplot as plt |
|
| 1629 |
start_time=time.time() |
|
| 1630 |
if Colors == 'Red2Yellow': |
|
| 1631 |
plt.imsave("%s.png" % prefix, sigma, cmap='afmhot')
|
|
| 1632 |
else: |
|
| 1633 |
plt.imsave("%s.png" % prefix, sigma, cmap='Greys_r')
|
|
| 1634 |
save_time = time.time()-start_time |
|
| 1635 |
print("Save image as %s.png file" % prefix)
|
|
| 1636 |
print("Save Time : %f" % save_time)
|
|
| 1637 |
|
|
| 1628 |
try: |
|
| 1629 |
import matplotlib.pyplot as plt |
|
| 1630 |
start_time=time.time() |
|
| 1631 |
if Colors == 'Red2Yellow': |
|
| 1632 |
plt.imsave("%s.png" % prefix, sigma, cmap='afmhot')
|
|
| 1633 |
else: |
|
| 1634 |
plt.imsave("%s.png" % prefix, sigma, cmap='Greys_r')
|
|
| 1635 |
save_time = time.time()-start_time |
|
| 1636 |
print("Save image as %s.png file" % prefix)
|
|
| 1637 |
print("Save Time : %f" % save_time)
|
|
| 1638 |
except: |
|
| 1639 |
from PIL import Image |
|
| 1640 |
start_time=time.time() |
|
| 1641 |
Max = sigma.max() |
|
| 1642 |
Min = sigma.min() |
|
| 1643 |
# Normalize value as 8bits Integer |
|
| 1644 |
SigmaInt = (255 * (sigma - Min) / (Max - Min)).astype("uint8")
|
|
| 1645 |
image = Image.fromarray(SigmaInt) |
|
| 1646 |
image.save("%s.jpg" % prefix)
|
|
| 1647 |
save_time = time.time()-start_time |
|
| 1648 |
print("Save image as %s.png file" % prefix)
|
|
| 1649 |
print("Save Time : %f" % save_time)
|
|
| 1650 |
|
|
| 1638 | 1651 |
def BlackHoleCL(zImage,fImage,InputCL): |
| 1639 | 1652 |
|
| 1640 | 1653 |
kernel_params = {}
|
| ... | ... | |
| 1700 | 1713 |
mf = cl.mem_flags |
| 1701 | 1714 |
|
| 1702 | 1715 |
if Method=='TrajectoPixel' or Method=='TrajectoCircle': |
| 1703 |
TrajectoriesCL = cl.Buffer(ctx, mf.WRITE_ONLY | mf.COPY_HOST_PTR, hostbuf=Trajectories) |
|
| 1704 |
IdLastCL = cl.Buffer(ctx, mf.WRITE_ONLY | mf.COPY_HOST_PTR, hostbuf=IdLast) |
|
| 1716 |
# TrajectoriesCL = cl.Buffer(ctx, mf.WRITE_ONLY | mf.COPY_HOST_PTR, hostbuf=Trajectories)
|
|
| 1717 |
# IdLastCL = cl.Buffer(ctx, mf.WRITE_ONLY | mf.COPY_HOST_PTR, hostbuf=IdLast)
|
|
| 1705 | 1718 |
|
| 1706 |
zImageCL = cl.Buffer(ctx, mf.WRITE_ONLY | mf.COPY_HOST_PTR, hostbuf=zImage) |
|
| 1707 |
fImageCL = cl.Buffer(ctx, mf.WRITE_ONLY | mf.COPY_HOST_PTR, hostbuf=fImage) |
|
| 1719 |
# zImageCL = cl.Buffer(ctx, mf.WRITE_ONLY | mf.COPY_HOST_PTR, hostbuf=zImage) |
|
| 1720 |
# fImageCL = cl.Buffer(ctx, mf.WRITE_ONLY | mf.COPY_HOST_PTR, hostbuf=fImage) |
|
| 1721 |
|
|
| 1722 |
TrajectoriesCL = cl.Buffer(ctx, mf.WRITE_ONLY, Trajectories.nbytes) |
|
| 1723 |
IdLastCL = cl.Buffer(ctx, mf.WRITE_ONLY, IdLast.nbytes) |
|
| 1724 |
|
|
| 1725 |
zImageCL = cl.Buffer(ctx, mf.WRITE_ONLY, zImage.nbytes) |
|
| 1726 |
fImageCL = cl.Buffer(ctx, mf.WRITE_ONLY, fImage.nbytes) |
|
| 1708 | 1727 |
|
| 1709 | 1728 |
start_time=time.time() |
| 1710 | 1729 |
|
Formats disponibles : Unified diff