33 lines
859 B
Python
33 lines
859 B
Python
#!/usr/bin/python
|
|
|
|
import sys
|
|
sys.path.append(".")
|
|
sys.path.append("..")
|
|
sys.path.append("../..") # Adds higher directory to python modules path
|
|
|
|
import os
|
|
import time
|
|
import numpy as np
|
|
from libs.spacemap import SpaceBlock
|
|
from libs.spacemap import SpaceRay
|
|
from libs.spacemap import SpaceMap
|
|
|
|
|
|
def test():
|
|
spacemap = SpaceMap(width=6.4, length=6.4, block_size=0.1)
|
|
print(spacemap.getLosses())
|
|
print(spacemap.getLoss(np.array([1, 2, 3]), 1))
|
|
ray = SpaceRay(SpaceBlock(0.0, 0.0), SpaceBlock(2, 6.38))
|
|
ray.computeLinePassThroughLoss(spacemap)
|
|
ray.setTotalLoss(0.0)
|
|
ray.setInitPower(0, gamma=2.0)
|
|
ray.setTravelDistance(0.0)
|
|
pwr = ray.computeResultingPwr()
|
|
print("pwr = {}".format(pwr))
|
|
print(ray.this_pass_through_blks[0].related_rays)
|
|
print(ray.this_pass_through_blks[0])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
test()
|