Skip to content

Commit 8784327

Browse files
committed
use black to format things
1 parent 581141e commit 8784327

30 files changed

Lines changed: 2130 additions & 1400 deletions

docs/pyscript_editor.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ def _raw(html: str) -> nodes.raw:
132132
"""
133133

134134

135-
def _head_html(mini_coi: str, version: str, hide_gutters: bool, hide_env_label: bool) -> str:
135+
def _head_html(
136+
mini_coi: str, version: str, hide_gutters: bool, hide_env_label: bool
137+
) -> str:
136138
parts = []
137139
if mini_coi:
138140
parts.append(f'<script src="{mini_coi}"></script>')
@@ -194,7 +196,9 @@ def run(self) -> list[nodes.Node]:
194196
# ---- inject <head> assets once per document ----
195197
injected = getattr(env, _HEAD_KEY, set())
196198
if env.docname not in injected:
197-
result.append(_raw(_head_html(mini_coi, version, hide_gutters, hide_env_label)))
199+
result.append(
200+
_raw(_head_html(mini_coi, version, hide_gutters, hide_env_label))
201+
)
198202
injected.add(env.docname)
199203
setattr(env, _HEAD_KEY, injected)
200204

@@ -227,7 +231,9 @@ def run(self) -> list[nodes.Node]:
227231
with open(abs_src, encoding="utf-8") as fh:
228232
code = fh.read()
229233
except OSError as exc:
230-
raise self.error(f":src: could not read file {abs_src!r}: {exc}") from exc
234+
raise self.error(
235+
f":src: could not read file {abs_src!r}: {exc}"
236+
) from exc
231237
env.note_dependency(abs_src)
232238
else:
233239
code = "\n".join(self.content)
@@ -272,7 +278,7 @@ def run(self) -> list[nodes.Node]:
272278
editor_html += (
273279
f'<div id="{ed_target}">'
274280
f'<img src="{escaped_src}" alt="Pre-rendered output" />'
275-
f'</div>\n'
281+
f"</div>\n"
276282
)
277283
else:
278284
editor_html += f'<div id="{ed_target}"></div>\n'
@@ -300,7 +306,9 @@ def _copy_placeholder_images(app: Sphinx, exception: Exception | None) -> None:
300306
try:
301307
shutil.copy2(src_abs, dest)
302308
except OSError as exc:
303-
logger.warning("pyscript_editor: cannot copy placeholder %r: %s", src_rel, exc)
309+
logger.warning(
310+
"pyscript_editor: cannot copy placeholder %r: %s", src_rel, exc
311+
)
304312

305313

306314
# ---------------------------------------------------------------------------

docs/scripts/binary_pck/erotat.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,15 @@ def erotat():
8181
#
8282
sep = spiceypy.vsep(itrfx, x)
8383

84-
print(f"ITRF93 - IAU_EARTH +X axis separation angle (deg): {sep * spiceypy.dpr():13.6f}")
84+
print(
85+
f"ITRF93 - IAU_EARTH +X axis separation angle (deg): {sep * spiceypy.dpr():13.6f}"
86+
)
8587

8688
sep = spiceypy.vsep(itrfz, z)
8789

88-
print(f"ITRF93 - IAU_EARTH +Z axis separation angle (deg): {sep * spiceypy.dpr():13.6f}\n")
90+
print(
91+
f"ITRF93 - IAU_EARTH +Z axis separation angle (deg): {sep * spiceypy.dpr():13.6f}\n"
92+
)
8993

9094
#
9195
# Find the azimuth and elevation of apparent

docs/scripts/event_finding/viewpr.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#
44
import spiceypy
55

6+
67
def viewpr():
78
#
89
# Local Parameters
@@ -164,7 +165,7 @@ def viewpr():
164165
else:
165166
print(f"Visibility stop time: {timstr}")
166167
print(" ")
167-
168+
168169
spiceypy.unload(METAKR)
169170

170171

docs/scripts/event_finding/visibl.py

Lines changed: 107 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,20 @@
33
#
44
import spiceypy
55

6+
67
def visibl():
78
#
89
# Local Parameters
910
#
10-
METAKR = 'visibl.tm'
11+
METAKR = "visibl.tm"
1112
SCLKID = -82
12-
TDBFMT = 'YYYY MON DD HR:MN:SC.### TDB ::TDB'
13+
TDBFMT = "YYYY MON DD HR:MN:SC.### TDB ::TDB"
1314
MAXIVL = 1000
1415
MAXWIN = 2 * MAXIVL
1516
#
1617
# Load the meta-kernel.
1718
#
18-
spiceypy.furnsh( METAKR )
19+
spiceypy.furnsh(METAKR)
1920
#
2021
# Assign the inputs for our search.
2122
#
@@ -26,13 +27,13 @@ def visibl():
2627
# increase the accuracy of the occultation times we'll
2728
# compute using gfoclt.
2829
#
29-
srfpt = 'DSS-14'
30-
obsfrm = 'DSS-14_TOPO'
31-
target = 'MEX'
32-
abcorr = 'CN+S'
33-
start = '2004 MAY 2 TDB'
34-
stop = '2004 MAY 6 TDB'
35-
elvlim = 6.0
30+
srfpt = "DSS-14"
31+
obsfrm = "DSS-14_TOPO"
32+
target = "MEX"
33+
abcorr = "CN+S"
34+
start = "2004 MAY 2 TDB"
35+
stop = "2004 MAY 6 TDB"
36+
elvlim = 6.0
3637
#
3738
# The elevation limit above has units of degrees; we convert
3839
# this value to radians for computation using SPICE routines.
@@ -46,17 +47,17 @@ def visibl():
4647
# reference frame is required for the target since its
4748
# orientation is not used.
4849
#
49-
back = target
50-
bshape = 'POINT'
51-
bframe = ' '
52-
front = 'MARS'
53-
fshape = 'ELLIPSOID'
54-
fframe = 'IAU_MARS'
50+
back = target
51+
bshape = "POINT"
52+
bframe = " "
53+
front = "MARS"
54+
fshape = "ELLIPSOID"
55+
fframe = "IAU_MARS"
5556
#
5657
# The occultation type should be set to 'ANY' for a point
5758
# target.
5859
#
59-
occtyp = 'any'
60+
occtyp = "any"
6061
#
6162
# Since SPICE doesn't directly support the AZ/EL coordinate
6263
# system, we use the equivalent constraint
@@ -66,9 +67,9 @@ def visibl():
6667
# in the latitudinal coordinate system, where the reference
6768
# frame is topocentric and is centered at the viewing location.
6869
#
69-
crdsys = 'LATITUDINAL'
70-
coord = 'LATITUDE'
71-
relate = '>'
70+
crdsys = "LATITUDINAL"
71+
coord = "LATITUDE"
72+
relate = ">"
7273
#
7374
# The adjustment value only applies to absolute extrema
7475
# searches; simply give it an initial value of zero
@@ -86,52 +87,64 @@ def visibl():
8687
#
8788
# Display a banner for the output report:
8889
#
89-
print('\nInputs for target visibility search:\n')
90-
print(f' Target = {target}')
91-
print(f' Observation surface location = {srfpt}')
90+
print("\nInputs for target visibility search:\n")
91+
print(f" Target = {target}")
92+
print(f" Observation surface location = {srfpt}")
9293
print(f" Observer's reference frame = {obsfrm}")
93-
print(f' Blocking body = {front}')
94+
print(f" Blocking body = {front}")
9495
print(f" Blocker's reference frame = {fframe}")
95-
print(f' Elevation limit (degrees) = {elvlim:f}')
96-
print(f' Aberration correction = {abcorr}')
97-
print(f' Step size (seconds) = {stepsz:f}')
96+
print(f" Elevation limit (degrees) = {elvlim:f}")
97+
print(f" Aberration correction = {abcorr}")
98+
print(f" Step size (seconds) = {stepsz:f}")
9899
#
99100
# Convert the start and stop times to ET.
100101
#
101-
etbeg = spiceypy.str2et( start )
102-
etend = spiceypy.str2et( stop )
102+
etbeg = spiceypy.str2et(start)
103+
etend = spiceypy.str2et(stop)
103104
#
104105
# Display the search interval start and stop times
105106
# using the format shown below.
106107
#
107108
# 2004 MAY 06 20:15:00.000 (TDB)
108109
#
109-
btmstr = spiceypy.timout( etbeg, TDBFMT )
110-
print(f' Start time = {btmstr}')
110+
btmstr = spiceypy.timout(etbeg, TDBFMT)
111+
print(f" Start time = {btmstr}")
111112
etmstr = spiceypy.timout(etend, TDBFMT)
112-
print(f' Stop time = {etmstr}')
113+
print(f" Stop time = {etmstr}")
113114

114-
print( ' ' )
115+
print(" ")
115116
#
116117
# Initialize the "confinement" window with the interval
117118
# over which we'll conduct the search.
118119
#
119120
cnfine = spiceypy.cell_double(2)
120-
spiceypy.wninsd( etbeg, etend, cnfine )
121+
spiceypy.wninsd(etbeg, etend, cnfine)
121122
#
122123
# In the call below, the maximum number of window
123124
# intervals gfposc can store internally is set to MAXIVL.
124125
# We set the cell size to MAXWIN to achieve this.
125126
#
126-
riswin = spiceypy.cell_double( MAXWIN )
127+
riswin = spiceypy.cell_double(MAXWIN)
127128
#
128129
# Now search for the time period, within our confinement
129130
# window, during which the apparent target has elevation
130131
# at least equal to the elevation limit.
131132
#
132-
spiceypy.gfposc( target, obsfrm, abcorr, srfpt,
133-
crdsys, coord, relate, revlim,
134-
adjust, stepsz, MAXIVL, cnfine, riswin )
133+
spiceypy.gfposc(
134+
target,
135+
obsfrm,
136+
abcorr,
137+
srfpt,
138+
crdsys,
139+
coord,
140+
relate,
141+
revlim,
142+
adjust,
143+
stepsz,
144+
MAXIVL,
145+
cnfine,
146+
riswin,
147+
)
135148
#
136149
# Now find the times when the apparent target is above
137150
# the elevation limit and is not occulted by the
@@ -147,76 +160,100 @@ def visibl():
147160
#
148161
# Find occultations within the view period window.
149162
#
150-
print( ' Searching using ellipsoid target shape model...' )
151-
eocwin = spiceypy.cell_double( MAXWIN )
152-
fshape = 'ELLIPSOID'
153-
spiceypy.gfoclt( occtyp, front, fshape, fframe,
154-
back, bshape, bframe, abcorr,
155-
srfpt, stepsz, riswin, eocwin )
156-
print( ' Done.' )
163+
print(" Searching using ellipsoid target shape model...")
164+
eocwin = spiceypy.cell_double(MAXWIN)
165+
fshape = "ELLIPSOID"
166+
spiceypy.gfoclt(
167+
occtyp,
168+
front,
169+
fshape,
170+
fframe,
171+
back,
172+
bshape,
173+
bframe,
174+
abcorr,
175+
srfpt,
176+
stepsz,
177+
riswin,
178+
eocwin,
179+
)
180+
print(" Done.")
157181
#
158182
# Subtract the occultation window from the view period
159183
# window: this yields the time periods when the target
160184
# is visible.
161185
#
162-
evswin = spiceypy.wndifd( riswin, eocwin )
186+
evswin = spiceypy.wndifd(riswin, eocwin)
163187
#
164188
# Repeat the search using low-resolution DSK data
165189
# for the front body.
166190
#
167-
print( ' Searching using DSK target shape model...' )
168-
docwin = spiceypy.cell_double( MAXWIN )
169-
fshape = 'DSK/UNPRIORITIZED'
170-
spiceypy.gfoclt( occtyp, front, fshape, fframe,
171-
back, bshape, bframe, abcorr,
172-
srfpt, stepsz, riswin, docwin )
173-
print( ' Done.\n' )
174-
dvswin = spiceypy.wndifd( riswin, docwin )
191+
print(" Searching using DSK target shape model...")
192+
docwin = spiceypy.cell_double(MAXWIN)
193+
fshape = "DSK/UNPRIORITIZED"
194+
spiceypy.gfoclt(
195+
occtyp,
196+
front,
197+
fshape,
198+
fframe,
199+
back,
200+
bshape,
201+
bframe,
202+
abcorr,
203+
srfpt,
204+
stepsz,
205+
riswin,
206+
docwin,
207+
)
208+
print(" Done.\n")
209+
dvswin = spiceypy.wndifd(riswin, docwin)
175210
#
176211
# The function wncard returns the number of intervals
177212
# in a SPICE window.
178213
#
179-
winsiz = spiceypy.wncard( evswin )
214+
winsiz = spiceypy.wncard(evswin)
180215
if winsiz == 0:
181-
print( 'No events were found.' )
216+
print("No events were found.")
182217
else:
183218
#
184219
# Display the visibility time periods.
185220
#
186221
print(
187-
f'Visibility start and stop times of {target} as seen from {srfpt}\n'
188-
'using both ellipsoidal and DSK target shape models:\n'
222+
f"Visibility start and stop times of {target} as seen from {srfpt}\n"
223+
"using both ellipsoidal and DSK target shape models:\n"
189224
)
190-
for i in range(winsiz):
225+
for i in range(winsiz):
191226
#
192227
# Fetch the start and stop times of
193228
# the ith interval from the ellipsoid
194229
# search result window evswin.
195230
#
196-
[intbeg, intend] = spiceypy.wnfetd( evswin, i )
231+
[intbeg, intend] = spiceypy.wnfetd(evswin, i)
197232
#
198233
# Convert the rise time to TDB calendar strings.
199234
# Write the results.
200235
#
201-
btmstr = spiceypy.timout( intbeg, TDBFMT )
202-
etmstr = spiceypy.timout( intend, TDBFMT )
203-
print(f' Ell: {btmstr} : {etmstr}')
236+
btmstr = spiceypy.timout(intbeg, TDBFMT)
237+
etmstr = spiceypy.timout(intend, TDBFMT)
238+
print(f" Ell: {btmstr} : {etmstr}")
204239
#
205240
# Fetch the start and stop times of
206241
# the ith interval from the DSK
207242
# search result window dvswin.
208243
#
209-
[dintbg, dinten] = spiceypy.wnfetd( dvswin, i )
244+
[dintbg, dinten] = spiceypy.wnfetd(dvswin, i)
210245
#
211246
# Convert the rise time to TDB calendar strings.
212247
# Write the results.
213248
#
214-
btmstr = spiceypy.timout( dintbg, TDBFMT )
215-
etmstr = spiceypy.timout( dinten, TDBFMT )
216-
print(f' DSK: {btmstr} : {etmstr}\n')
249+
btmstr = spiceypy.timout(dintbg, TDBFMT)
250+
etmstr = spiceypy.timout(dinten, TDBFMT)
251+
print(f" DSK: {btmstr} : {etmstr}\n")
217252
#
218253
# End of result display loop.
219254
#
220-
spiceypy.unload( METAKR )
221-
if __name__ == '__main__':
222-
visibl()
255+
spiceypy.unload(METAKR)
256+
257+
258+
if __name__ == "__main__":
259+
visibl()

0 commit comments

Comments
 (0)