@@ -199,7 +199,7 @@ def getAxisName(topic):
199199
200200
201201def getDomeData (
202- client : EfdClient , begin : Time , end : Time , prePadding : float , postPadding : float , threshold : float = 2.7
202+ client : EfdClient , begin : Time , end : Time , prePadding : float , postPadding : float
203203) -> tuple [pd .DataFrame , pd .DataFrame ]:
204204 """Get dome data and when dome is within threshold of being in position.
205205
@@ -215,16 +215,14 @@ def getDomeData(
215215 The amount of time in seconds to pad before the begin time.
216216 postPadding : `float`
217217 The amount of time in seconds to pad after the end time.
218- threshold : `float`, optional
219- The threshold in degrees for considering the dome to be in position.
220218
221219 Returns
222220 -------
223221 domeData : `pd.DataFrame`
224222 The dome data with actual and commanded positions.
225- domeBelowThreshold : `pd.DataFrame`
226- A dataframe with a single entry indicating the time when the dome
227- position error drops below the threshold.
223+ domeVignetted : `pd.DataFrame`
224+ A dataframe with an entry indicating when the telescope
225+ is no longer vignetted
228226 """
229227 domeData = getEfdData (
230228 client ,
@@ -235,21 +233,25 @@ def getDomeData(
235233 prePadding = prePadding ,
236234 postPadding = postPadding ,
237235 )
238- # find the time when the dome position error drops below threshold
239- domeData ["diff" ] = (domeData ["positionActual" ] - domeData ["positionCommanded" ]).abs ()
240- # Boolean mask where condition holds
241- mask = domeData ["diff" ] < threshold
242- # Rising edge: True when mask is True
243- # but previous sample was False (or NaN at start)
244- rising = mask & (~ mask .shift (1 , fill_value = False ))
245- if rising .any ():
246- # The last rising edge
247- # (latest time where we enter the < threshold region)
248- event_time = rising [rising ].index .max ()
249-
250- # Make a new dataframe with the domeBelowThreshold
251- domeBelowThreshold = pd .DataFrame (data = {"inPosition" : [True ]}, index = [event_time ])
252- return domeData , domeBelowThreshold
236+ # Get the data with the vignetted flag
237+ vignettedData = getEfdData (
238+ client ,
239+ "lsst.sal.MTDomeTrajectory.logevent_telescopeVignetted" ,
240+ columns = ["vignetted" ],
241+ begin = begin ,
242+ end = end ,
243+ prePadding = prePadding ,
244+ postPadding = postPadding ,
245+ )
246+
247+ if len (vignettedData ) == 0 :
248+ vignettedTime = begin .utc .to_datetime ()
249+ else :
250+ vignettedData = vignettedData [vignettedData ["vignetted" ] == 1 ]
251+ vignettedTime = vignettedData .index [- 1 ]
252+ # Make a new dataframe with the vignetting data
253+ domeVignetted = pd .DataFrame (data = {"vignetted" : [False ]}, index = [vignettedTime ])
254+ return domeData , domeVignetted
253255
254256
255257def plotExposureTiming (
@@ -315,7 +317,7 @@ def plotExposureTiming(
315317 el = mountData .elevationData
316318 rot = mountData .rotationData
317319
318- domeData , domeBelowThreshold = getDomeData (client , begin , end , prePadding , postPadding )
320+ domeData , domeVignetted = getDomeData (client , begin , end , prePadding , postPadding )
319321
320322 # Calculate relative heights for the gridspec
321323 narrowHeight = narrowHeightRatio
@@ -466,12 +468,12 @@ def plotExposureTiming(
466468 ),
467469 ]
468470 )
469- # Add special domeBelowThreshold axvline
471+ # Add special domeVignetted axvline
470472 if label == "Dome" :
471- inPositionTransitions = domeBelowThreshold
472- for time , data in inPositionTransitions .iterrows ():
473- inPosition = data ["inPosition " ]
474- if inPosition :
473+ vignettingTransitions = domeVignetted
474+ for time , data in vignettingTransitions .iterrows ():
475+ vignetted = data ["vignetted " ]
476+ if not vignetted :
475477 axes [axisName ].axvline (time , color = "magenta" , linestyle = "--" , alpha = inPositionAlpha )
476478
477479 legendEntries [axisName ].extend (
@@ -481,7 +483,7 @@ def plotExposureTiming(
481483 [0 ],
482484 color = "magenta" ,
483485 linestyle = "-" ,
484- label = f"{ label } below threshold=True " ,
486+ label = f"{ label } vignetted=False " ,
485487 alpha = inPositionAlpha ,
486488 ),
487489 ]
@@ -541,6 +543,11 @@ def plotExposureTiming(
541543 ]
542544 bottomLegendAx .legend (handles = shadingLegendHandles , loc = "center" , bbox_to_anchor = (0.4 , 0.5 ), ncol = 2 )
543545
546+ # For some reason xlim is different on the Dome plot.
547+ # This sets it to match:
548+ az_xlim = axes ["az" ].get_xlim ()
549+ axes ["dome" ].set_xlim (az_xlim )
550+
544551 # Set labels with horizontal orientation
545552 for axisName , ax in axes .items ():
546553 ax .set_ylabel (
@@ -553,7 +560,6 @@ def plotExposureTiming(
553560 ha = "right" ,
554561 va = "center" ,
555562 )
556-
557563 axes ["rot" ].set_xlabel ("Time (UTC)" )
558564
559565 # Add title centered on main plot area only
0 commit comments