# Blog: Meeting update: average_script_visit

File average_script_visit, 3.0 KB (added by , 12 years ago) |
---|

Line | |
---|---|

1 | ActivateDatabase("localhost:/media/grassdata/erica/from_bluehive/FinalRunsNewest/BP/chombo00046.hdf") |

2 | filename = "average_vrad_00046.curve" |

3 | DeleteActivePlots() |

4 | AddPlot("Pseudocolor", "vrad", 1, 1) |

5 | SetActivePlots(0) |

6 | |

7 | # inner_sphere(): |

8 | AddOperator("Clip", 1) |

9 | ClipAtts = ClipAttributes() |

10 | ClipAtts.quality = ClipAtts.Fast # Fast, Accurate |

11 | ClipAtts.funcType = ClipAtts.Sphere # Plane, Sphere |

12 | ClipAtts.plane1Status = 1 |

13 | ClipAtts.plane2Status = 0 |

14 | ClipAtts.plane3Status = 0 |

15 | ClipAtts.plane1Origin = (0, 0, 0) |

16 | ClipAtts.plane2Origin = (0, 0, 0) |

17 | ClipAtts.plane3Origin = (0, 0, 0) |

18 | ClipAtts.plane1Normal = (1, 0, 0) |

19 | ClipAtts.plane2Normal = (0, 1, 0) |

20 | ClipAtts.plane3Normal = (0, 0, 1) |

21 | ClipAtts.planeInverse = 0 |

22 | ClipAtts.planeToolControlledClipPlane = ClipAtts.Plane1 # None, Plane1, Plane2, Plane3 |

23 | ClipAtts.center = (0, 0, 0) |

24 | ClipAtts.radius = 0.06 |

25 | ClipAtts.sphereInverse = 1 |

26 | SetOperatorOptions(ClipAtts, 1) |

27 | DrawPlots() |

28 | f = open(filename, "w") |

29 | f.write("# average_vrad\n") |

30 | #Query, write average: |

31 | Query("Average Value") |

32 | t2 = GetQueryOutputValue() |

33 | str = "%25.15e %25.15e\n" %(ClipAtts.radius, t2) |

34 | f.write(str) |

35 | RemoveAllOperators(1) |

36 | for i in range(48): |

37 | dx=0.03 |

38 | #inner sphere: |

39 | AddOperator("Clip", 1) |

40 | ClipAtts = ClipAttributes() |

41 | ClipAtts.quality = ClipAtts.Fast # Fast, Accurate |

42 | ClipAtts.funcType = ClipAtts.Sphere # Plane, Sphere |

43 | ClipAtts.plane1Status = 1 |

44 | ClipAtts.plane2Status = 0 |

45 | ClipAtts.plane3Status = 0 |

46 | ClipAtts.plane1Origin = (0, 0, 0) |

47 | ClipAtts.plane2Origin = (0, 0, 0) |

48 | ClipAtts.plane3Origin = (0, 0, 0) |

49 | ClipAtts.plane1Normal = (1, 0, 0) |

50 | ClipAtts.plane2Normal = (0, 1, 0) |

51 | ClipAtts.plane3Normal = (0, 0, 1) |

52 | ClipAtts.planeInverse = 0 |

53 | ClipAtts.planeToolControlledClipPlane = ClipAtts.Plane1 # None, Plane1, Plane2, Plane3 |

54 | ClipAtts.center = (0, 0, 0) |

55 | ClipAtts.radius = 0.06 + i*dx |

56 | ClipAtts.sphereInverse = 0 |

57 | SetOperatorOptions(ClipAtts, 1) |

58 | #Outer-sphere: |

59 | AddOperator("Clip", 1) |

60 | ClipAtts = ClipAttributes() |

61 | ClipAtts.quality = ClipAtts.Fast # Fast, Accurate |

62 | ClipAtts.funcType = ClipAtts.Sphere # Plane, Sphere |

63 | ClipAtts.plane1Status = 1 |

64 | ClipAtts.plane2Status = 0 |

65 | ClipAtts.plane3Status = 0 |

66 | ClipAtts.plane1Origin = (0, 0, 0) |

67 | ClipAtts.plane2Origin = (0, 0, 0) |

68 | ClipAtts.plane3Origin = (0, 0, 0) |

69 | ClipAtts.plane1Normal = (1, 0, 0) |

70 | ClipAtts.plane2Normal = (0, 1, 0) |

71 | ClipAtts.plane3Normal = (0, 0, 1) |

72 | ClipAtts.planeInverse = 0 |

73 | ClipAtts.planeToolControlledClipPlane = ClipAtts.Plane1 # None, Plane1, Plane2, Plane3 |

74 | ClipAtts.center = (0, 0, 0) |

75 | ClipAtts.radius = 0.06 + (i+1)*dx |

76 | ClipAtts.sphereInverse = 1 |

77 | SetOperatorOptions(ClipAtts, 1) |

78 | DrawPlots() |

79 | Query("Average Value") |

80 | t2 = GetQueryOutputValue() |

81 | str = "%25.15e %25.15e\n" %(ClipAtts.radius, t2) |

82 | #Not sure how to differentiate clips..., would like the outer radius |

83 | f.write(str) |

84 | RemoveAllOperators(1) |

85 | f.close() |

86 | DeleteAllPlots() |

87 | OpenDatabase(filename) |

88 | AddPlot("Curve", "average_vrad") |

89 | DrawPlots() |