Révision 257
TrouNoir/TrouNoir.py (revision 257) | ||
---|---|---|
1649 | 1649 |
TrackPoints=InputCL['TrackPoints'] |
1650 | 1650 |
Physics=InputCL['Physics'] |
1651 | 1651 |
NoImage=InputCL['NoImage'] |
1652 |
TrackSave=InputCL['TrackSave'] |
|
1652 | 1653 |
|
1653 | 1654 |
PhysicsList=DictionariesAPI() |
1654 | 1655 |
|
... | ... | |
1798 | 1799 |
Date=time.strftime("%Y%m%d_%H%M%S") |
1799 | 1800 |
ImageInfo="%s_Device%i_%s_%s" % (Method,Device,Hostname,Date) |
1800 | 1801 |
|
1801 |
# numpy.savetxt("TrouNoirTrajectories_%s.csv" % ImageInfo,
|
|
1802 |
# numpy.transpose(numpy.concatenate((Angles,Trajectories),axis=0)),
|
|
1803 |
# delimiter=' ', fmt='%.2e')
|
|
1804 |
numpy.savetxt("TrouNoirTrajectories.csv",
|
|
1805 |
numpy.transpose(numpy.concatenate((Angles,Trajectories),axis=0)),
|
|
1806 |
delimiter=' ', fmt='%.2e') |
|
1802 |
if TrackSave:
|
|
1803 |
# numpy.savetxt("TrouNoirTrajectories_%s.csv" % ImageInfo,
|
|
1804 |
# numpy.transpose(numpy.concatenate((Angles,Trajectories),axis=0)),
|
|
1805 |
# delimiter=' ', fmt='%.2e')
|
|
1806 |
numpy.savetxt("TrouNoirTrajectories.csv",
|
|
1807 |
numpy.transpose(numpy.concatenate((Angles,Trajectories),axis=0)),delimiter=' ', fmt='%.2e')
|
|
1807 | 1808 |
|
1808 | 1809 |
TrajectoriesCL.release() |
1809 | 1810 |
IdLastCL.release() |
... | ... | |
1992 | 1993 |
return(elapsed) |
1993 | 1994 |
|
1994 | 1995 |
if __name__=='__main__': |
1995 |
|
|
1996 |
|
|
1997 |
# Default device: first one! |
|
1998 |
Device=0 |
|
1999 |
# Default implementation: OpenCL, most versatile! |
|
1996 | 2000 |
GpuStyle = 'OpenCL' |
1997 | 2001 |
Mass = 1. |
1998 | 2002 |
# Internal Radius 3 times de Schwarzschild Radius |
... | ... | |
2005 | 2009 |
# Radiation of disc : BlackBody or Monochromatic |
2006 | 2010 |
BlackBody = False |
2007 | 2011 |
# Size of image |
2008 |
Size=256
|
|
2012 |
Size=1024
|
|
2009 | 2013 |
# Variable Type |
2010 | 2014 |
VariableType='FP32' |
2011 | 2015 |
# ? |
... | ... | |
2022 | 2026 |
Threads = 32 |
2023 | 2027 |
# Trackpoints of trajectories |
2024 | 2028 |
TrackPoints=2048 |
2029 |
# Tracksave of trajectories |
|
2030 |
TrackSave=False |
|
2025 | 2031 |
|
2026 |
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>' |
|
2032 |
HowToUse='%s -h [Help] -b [BlackBodyEmission] -j [TrackSave] -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>'
|
|
2027 | 2033 |
|
2028 | 2034 |
try: |
2029 |
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="])
|
|
2035 |
opts, args = getopt.getopt(sys.argv[1:],"hbnjs:m:i:x:a:d:g:v:o:t:c:p:k:",["tracksave","blackbody","noimage","camera","size=","mass=","internal=","external=","angle=","device=","gpustyle=","variabletype=","method=","threads=","colors=","physics=","trackpoints="])
|
|
2030 | 2036 |
except getopt.GetoptError: |
2031 | 2037 |
print(HowToUse % sys.argv[0]) |
2032 | 2038 |
sys.exit(2) |
... | ... | |
2089 | 2095 |
Angle = numpy.pi/180.*(90.-float(arg)) |
2090 | 2096 |
elif opt in ("-b", "--blackbody"): |
2091 | 2097 |
BlackBody = True |
2098 |
elif opt in ("-j", "--tracksave"): |
|
2099 |
TrackSave = True |
|
2092 | 2100 |
elif opt in ("-n", "--noimage"): |
2093 | 2101 |
NoImage = True |
2094 | 2102 |
elif opt in ("-o", "--method"): |
... | ... | |
2113 | 2121 |
print("Colors for output images : %s" % Colors) |
2114 | 2122 |
print("Physics used for Trajectories : %s" % Physics) |
2115 | 2123 |
print("Trackpoints of Trajectories : %i" % TrackPoints) |
2124 |
print("Tracksave of Trajectories : %i" % TrackSave) |
|
2116 | 2125 |
|
2117 | 2126 |
if GpuStyle=='CUDA': |
2118 | 2127 |
print("\nSelection of CUDA device") |
... | ... | |
2168 | 2177 |
InputCL['Physics']=Physics |
2169 | 2178 |
InputCL['Threads']=Threads |
2170 | 2179 |
InputCL['NoImage']=NoImage |
2180 |
InputCL['TrackSave']=TrackSave |
|
2171 | 2181 |
|
2172 | 2182 |
if GpuStyle=='OpenCL': |
2173 | 2183 |
duration=BlackHoleCL(zImage,fImage,InputCL) |
Formats disponibles : Unified diff