Révision 238 TrouNoir/TrouNoir.py
TrouNoir.py (revision 238) | ||
---|---|---|
1738 | 1738 |
|
1739 | 1739 |
if Method=='TrajectoPixel' or Method=='TrajectoCircle': |
1740 | 1740 |
if not NoImage: |
1741 |
print(Trajectories.shape) |
|
1742 | 1741 |
AngleStep=4*numpy.pi/TrackPoints |
1743 | 1742 |
Angles=numpy.arange(0.,4*numpy.pi,AngleStep) |
1744 | 1743 |
Angles.shape=(1,TrackPoints) |
1745 |
print(Angles.shape) |
|
1746 | 1744 |
Hostname=gethostname() |
1747 | 1745 |
Date=time.strftime("%Y%m%d_%H%M%S") |
1748 | 1746 |
ImageInfo="%s_Device%i_%s_%s" % (Method,Device,Hostname,Date) |
... | ... | |
1903 | 1901 |
|
1904 | 1902 |
cuda.memcpy_dtoh(zImage,zImageCU) |
1905 | 1903 |
cuda.memcpy_dtoh(fImage,fImageCU) |
1904 |
if Method=='TrajectoPixel' or Method=='TrajectoCircle': |
|
1905 |
cuda.memcpy_dtoh(Trajectories,TrajectoriesCU) |
|
1906 | 1906 |
elapsed = time.time()-start_time |
1907 | 1907 |
print("\nCompute Time : %f" % compute) |
1908 | 1908 |
print("Elapsed Time : %f\n" % elapsed) |
... | ... | |
1917 | 1917 |
|
1918 | 1918 |
Context.detach() |
1919 | 1919 |
|
1920 |
if Method=='TrajectoPixel' or Method=='TrajectoCircle': |
|
1921 |
if not NoImage: |
|
1922 |
AngleStep=4*numpy.pi/TrackPoints |
|
1923 |
Angles=numpy.arange(0.,4*numpy.pi,AngleStep) |
|
1924 |
Angles.shape=(1,TrackPoints) |
|
1925 |
Hostname=gethostname() |
|
1926 |
Date=time.strftime("%Y%m%d_%H%M%S") |
|
1927 |
ImageInfo="%s_Device%i_%s_%s" % (Method,Device,Hostname,Date) |
|
1928 |
|
|
1929 |
# numpy.savetxt("TrouNoirTrajectories_%s.csv" % ImageInfo, |
|
1930 |
# numpy.transpose(numpy.concatenate((Angles,Trajectories),axis=0)), |
|
1931 |
# delimiter=' ', fmt='%.2e') |
|
1932 |
numpy.savetxt("TrouNoirTrajectories.csv", |
|
1933 |
numpy.transpose(numpy.concatenate((Angles,Trajectories),axis=0)), |
|
1934 |
delimiter=' ', fmt='%.2e') |
|
1935 |
|
|
1936 |
|
|
1920 | 1937 |
return(elapsed) |
1921 | 1938 |
|
1922 | 1939 |
if __name__=='__main__': |
... | ... | |
1948 | 1965 |
NoImage = False |
1949 | 1966 |
# Threads in CUDA |
1950 | 1967 |
Threads = 32 |
1968 |
# Trackpoints of trajectories |
|
1969 |
TrackPoints=2048 |
|
1951 | 1970 |
|
1952 |
HowToUse='%s -h [Help] -b [BlackBodyEmission] -n [NoImage] -p <Einstein/Newton> -s <SizeInPixels> -m <Mass> -i <DiscInternalRadius> -x <DiscExternalRadius> -a <AngleAboveDisc> -d <DeviceId> -c <Greyscale/Red2Yellow> -g <CUDA/OpenCL> -o <EachPixel/TrajectoCircle/TrajectoPixel/EachCircle/Original> -t <ThreadsInCuda> -v <FP32/FP64>' |
|
1971 |
HowToUse='%s -h [Help] -b [BlackBodyEmission] -n [NoImage] -p <Einstein/Newton> -s <SizeInPixels> -m <Mass> -i <DiscInternalRadius> -x <DiscExternalRadius> -a <AngleAboveDisc> -d <DeviceId> -c <Greyscale/Red2Yellow> -g <CUDA/OpenCL> -o <EachPixel/TrajectoCircle/TrajectoPixel/EachCircle/Original> -t <ThreadsInCuda> -v <FP32/FP64> -k <TrackPoints>'
|
|
1953 | 1972 |
|
1954 | 1973 |
try: |
1955 |
opts, args = getopt.getopt(sys.argv[1:],"hbns:m:i:x:a:d:g:v:o:t:c:p:",["blackbody","noimage","camera","size=","mass=","internal=","external=","angle=","device=","gpustyle=","variabletype=","method=","threads=","colors=","physics="])
|
|
1974 |
opts, args = getopt.getopt(sys.argv[1:],"hbns:m:i:x:a:d:g:v:o:t:c:p:k:",["blackbody","noimage","camera","size=","mass=","internal=","external=","angle=","device=","gpustyle=","variabletype=","method=","threads=","colors=","physics=","trackpoints="])
|
|
1956 | 1975 |
except getopt.GetoptError: |
1957 | 1976 |
print(HowToUse % sys.argv[0]) |
1958 | 1977 |
sys.exit(2) |
... | ... | |
2003 | 2022 |
VariableType = arg |
2004 | 2023 |
elif opt in ("-s", "--size"): |
2005 | 2024 |
Size = int(arg) |
2025 |
elif opt in ("-k", "--trackpoints"): |
|
2026 |
TrackPoints = int(arg) |
|
2006 | 2027 |
elif opt in ("-m", "--mass"): |
2007 | 2028 |
Mass = float(arg) |
2008 | 2029 |
elif opt in ("-i", "--internal"): |
... | ... | |
2036 | 2057 |
print("Method of resolution : %s" % Method) |
2037 | 2058 |
print("Colors for output images : %s" % Colors) |
2038 | 2059 |
print("Physics used for Trajectories : %s" % Physics) |
2060 |
print("Trackpoints of Trajectories : %i" % TrackPoints) |
|
2039 | 2061 |
|
2040 | 2062 |
if GpuStyle=='CUDA': |
2041 | 2063 |
print("\nSelection of CUDA device") |
... | ... | |
2075 | 2097 |
# print(Devices,Alu) |
2076 | 2098 |
|
2077 | 2099 |
# MyImage=numpy.where(numpy.random.zeros(Size,Size)>0,1,-1).astype(numpy.float32) |
2078 |
TrackPoints=2048 |
|
2079 | 2100 |
zImage=numpy.zeros((Size,Size),dtype=numpy.float32) |
2080 | 2101 |
fImage=numpy.zeros((Size,Size),dtype=numpy.float32) |
2081 | 2102 |
|
Formats disponibles : Unified diff