fork download
  1. import csv
  2.  
  3. class Experimento:
  4.  
  5. def __init__(self, material: str, num_points: int, time: float=20.0, expType: str='varredura'):
  6.  
  7. if expType not in ('varredura','ponto fixo'):
  8. raise ValueError('Tipo de experimento inválido. Selecione entre Varredura ou Ponto Fixo. \n NOTA: não utilize letras maiúsculas!')
  9.  
  10. self.num_points = num_points
  11. self.time = time
  12. self.material = material
  13. self.expType = expType
  14.  
  15. class Ponto_Fixo(Experimento):
  16.  
  17. def __init__(self, material: str, num_points: int, x: int, z: int, time: float=20.0):
  18. super().__init__(material, num_points, time, 'ponto fixo')
  19. self.x = x
  20. self.z = z
  21. self.expID = material + ' x' + str(self.x) + ' z' + str(self.z) + ' pt=' + str(num_points)
  22.  
  23. header = ['data','material','ponto','x','z','contagem','tempo(s)']
  24.  
  25. print(header)
  26.  
  27.  
  28. if __name__ == "__main__":
  29. material = 'agua+CaCO3'
  30. expType = 'ponto fixo'
  31. tempo = 20.0
  32. num_points = 6
  33. x = 2
  34. z = 2
  35.  
  36. def new_experiment(material, num_points, tempo, x, z, expType):
  37.  
  38. if expType == 'ponto fixo':
  39.  
  40. Ponto_Fixo(material, num_points, x, z, tempo)
  41.  
  42. novo_exp = new_experiment(material, num_points, tempo, x, z, expType)
Success #stdin #stdout 0.02s 9608KB
stdin
Standard input is empty
stdout
['data', 'material', 'ponto', 'x', 'z', 'contagem', 'tempo(s)']