Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solving issue #59 #60

Merged
merged 1 commit into from
Aug 21, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions src/pulses/SequencePulseTemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def add_mapping_function(self,source:str,target:str,func:Callable,*args,**kwargs
self.__targets[target] = source
else:
raise DoubleMappingException(target)

def get_mapping_function(self,source:str,target:str)-> Callable:
@property
def mapping_function(self,source:str,target:str)-> Callable:
return self.functions[source][target]

def remove_mapping_function(self,source:str,target:str) -> None:
Expand All @@ -37,11 +37,12 @@ def remove_mapping_function(self,source:str,target:str) -> None:
def set_mapping_function(self,source:str, target:str,func:Callable,*args,**kwargs) -> None:
self.functions[source][target] = partial(func,*args,**kwargs)

def get_sources(self) -> List[str]:
@property
def sources(self) -> List[str]:
return self.functions.keys()

def get_targets(self) -> List[str]:
@property
def targets(self) -> List[str]:
return self.__targets.keys()


Expand All @@ -68,7 +69,7 @@ def __init__(self) -> None:
super().__init__()
self.subtemplates = [] # type: List[PulseTemplate]
self.mapping = Mapping() # type: Mapping
self.__is_interruptable = None
self.__is_interruptable = True

@property
def parameter_names(self) -> Set[str]:
Expand Down Expand Up @@ -97,20 +98,22 @@ def parameter_declarations(self) -> Set[ParameterDeclaration]:
# TODO: min, max and default values might have to be mapped to? especially in the case that min, max are ParameterDeclarations as well
parameter_declarations.add(declaration)
return parameter_declarations

def get_measurement_windows(self, parameters: Dict[str, Parameter] = None) -> List[MeasurementWindow]:

@property
def measurement_windows(self, parameters: Dict[str, Parameter] = None) -> List[MeasurementWindow]:
measurement_windows = []
for subtemplate in self.subtemplates:
# TODO: parameters might have to be mapped
measurement_windows = measurement_windows + subtemplate.get_measurement_windows(parameters)
measurement_windows = measurement_windows + subtemplate.measurement_windows(parameters)
return measurement_windows

@property
def is_interruptable(self) -> bool:
for subtemplate in self.subtemplates:
if not subtemplate.is_interruptable():
return False
return True
return self.__is_interruptable

@is_interruptable.setter
def is_interruptable(self, new_value: bool):
self.__is_interruptable

def get_mapping(self) -> Mapping:
return self.mapping
Expand Down