Skip to content
Snippets Groups Projects
Commit ba0eeadb authored by Daniel Toyra's avatar Daniel Toyra
Browse files

Added instance variable notNan to the class surfacemap.

parent e6b55c96
No related branches found
No related tags found
No related merge requests found
...@@ -37,13 +37,14 @@ class MirrorROQWeights: ...@@ -37,13 +37,14 @@ class MirrorROQWeights:
if self.tBack is not None: self.tBack.writeToFile(f=f) if self.tBack is not None: self.tBack.writeToFile(f=f)
class surfacemap(object): class surfacemap(object):
def __init__(self, name, maptype, size, center, step_size, scaling, data=None): def __init__(self, name, maptype, size, center, step_size, scaling, notNan=None ,data=None):
self.name = name self.name = name
self.type = maptype self.type = maptype
self.center = center self.center = center
self.step_size = step_size self.step_size = step_size
self.scaling = scaling self.scaling = scaling
self.notNan = notNan
self.__interp = None self.__interp = None
if data is None: if data is None:
...@@ -51,6 +52,11 @@ class surfacemap(object): ...@@ -51,6 +52,11 @@ class surfacemap(object):
else: else:
self.data = data self.data = data
if notNan is None:
self.notNan = np.ones(size)
else:
self.notNan = notNan
self._rom_weights = None self._rom_weights = None
def write_map(self, filename): def write_map(self, filename):
...@@ -360,6 +366,24 @@ class surfacemap(object): ...@@ -360,6 +366,24 @@ class surfacemap(object):
return fig return fig
def remove_curvature(self, Rc0, w=0, display='off'):
# Removes curvature from mirror map by fitting a sphere to
# mirror surface. Based on the file
# 'FT_remove_curvature_from_mirror_map.m'.
# Rc0 - Initial guess of the radius of curvature
# w - Beam radius on mirror [m], used for weighting. w=0
# switches off weighting.
# display - Display mode of the fitting routine. Can be 'off',
# 'iter', 'notify', or 'final'.
zOffset = self.data[round(self.center[1]), round(self.center[0])]
params = Rc
print(zOffset)
return 0
class mergedmap: class mergedmap:
""" """
A merged map combines multiple surfaces map to form one. Such a map can be used A merged map combines multiple surfaces map to form one. Such a map can be used
...@@ -697,10 +721,13 @@ class zernikemap(surfacemap): ...@@ -697,10 +721,13 @@ class zernikemap(surfacemap):
self.data = data self.data = data
# Reads surface map files and return surfacemap-object.
# supported mapFormat: 'finesse', 'ligo', 'zygo'.
# All ascii formats.
def read_map(filename, mapFormat='finesse'): def read_map(filename, mapFormat='finesse'):
# Function turning input x into float. # Function turning input x into float.
g = lambda x: float(x) g = lambda x: float(x)
if mapFormat == 'finesse': if mapFormat == 'finesse':
with open(filename, 'r') as f: with open(filename, 'r') as f:
...@@ -717,7 +744,6 @@ def read_map(filename, mapFormat='finesse'): ...@@ -717,7 +744,6 @@ def read_map(filename, mapFormat='finesse'):
data = np.loadtxt(filename, dtype=np.float64,ndmin=2,comments='%') data = np.loadtxt(filename, dtype=np.float64,ndmin=2,comments='%')
# Converts raw zygo and ligo mirror maps to the finesse # Converts raw zygo and ligo mirror maps to the finesse
# format. Based on translation of the matlab scripts # format. Based on translation of the matlab scripts
# 'FT_read_zygo_map.m' and 'FT_read_ligo_map.m' # 'FT_read_zygo_map.m' and 'FT_read_ligo_map.m'
...@@ -931,13 +957,13 @@ def read_map(filename, mapFormat='finesse'): ...@@ -931,13 +957,13 @@ def read_map(filename, mapFormat='finesse'):
data[isNan] = 0 data[isNan] = 0
# TODO: Add options for reading .xyz-zygo and virgo maps. # TODO: Add options for reading virgo maps, and .xyz zygo
# maps (need .xys file for this). Binary ligo-maps?
# The intensity data is not used to anything here. Remove # The intensity data is not used to anything here. Remove
# or add to pykat? # or add to pykat?
return surfacemap(name, maptype, size, center, step, return surfacemap(name, maptype, size, center, step,
scaling, data) scaling, notNan, data)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment