split () for i, name in enumerate ( points ): xy = 45 * i, 1 ax. array ( xytext )) # Finally, some decorations. ![]() annotate ( name, ( xi, yi ), c = 'white', ha = 'center', va = 'center', textcoords = 'offset points', xytext = 2.2 * np. annotate ( day_i, ( xi, yi ), c = 'white', ha = 'center', va = 'center', textcoords = 'offset points', xytext = xytext, size = 8 ) # On the 15th of each month, put the month name. side = 'right' if ( year, month ) < ( 2021, 10 ) else 'left' if side = 'left' : xytext = - offset_x * dy, offset_y * dx else : xytext = offset_x * dy, - offset_y * dx # Label the dates 1, 11, and 21. sqrt ( dx * dx + dy * dy ) dx /= length dy /= length # Offset the text at a right angle to the direction of travel. day_i = day xi = x yi = y dx = xi - x dy = yi - y length = np. # Build a unit vector pointing in the direction Venus is traveling. flatnonzero ( fives ): if i = 0 : continue # We can’t compute dx/dy with no previous point. offset_x, offset_y = 10, 8 for i in np. ![]() scatter ( x, y, size, 'white', edgecolor = 'black', linewidth = 0.25, zorder = 2 ) # Put day and month labels off to the sides of the curve. (Except for the 30th, which would sit too # close to the 1st of the following month.) fives = ( day % 5 = 1 ) & ( day < 30 ) ax. plot ( x, y, c = '#fff6', zorder = 1 ) # Next, put a circle representing Venus on the 1st of the month and on # every fifth day after that. maxmag = max ( m ) minmag = min ( m ) size = 40 - 30 * ( m - minmag ) / ( maxmag - minmag ) # Start with a smooth curve tracing Venus's motion. degrees m = planetary_magnitude ( apparent ) # Convert magnitude to marker size, remembering that smaller magnitude # numbers mean a brighter Venus (and thus a larger marker). apparent () alt, az, distance = apparent. astype ( int ) apparent = ( earth + observer ). year, month, day, hour, minute, second = t. find_discrete ( start, end, f ) sunsets = ( y = 0 ) t = t # For each moment of sunset, ask Skyfield for the month number, the day # number, and for Venus’s altitude, azimuth, and magnitude. sunrise_sunset ( eph, observer ) t, y = almanac. eph = load ( 'de421.bsp' ) earth, sun, venus = eph, eph, eph observer = wgs84. split () # Figure out the times of sunset over our range of dates. ![]() Import numpy as np import matplotlib.pyplot as plt from lors import LinearSegmentedColormap from skyfield import almanac from skyfield.api import load, wgs84 from skyfield.magnitudelib import planetary_magnitude MONTH_NAMES = '0 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |