Python astropy.units.s() Examples
The following are 30
code examples of astropy.units.s().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
astropy.units
, or try the search function
.
Example #1
Source File: helios.py From heliopy with GNU General Public License v3.0 | 7 votes |
def load_local_file(self, interval): # Read in data headings = ['probe', 'year', 'doy', 'hour', 'minute', 'second', 'naverage', 'Bx', 'By', 'Bz', '|B|', 'sigma_Bx', 'sigma_By', 'sigma_Bz'] colspecs = [(1, 2), (2, 4), (4, 7), (7, 9), (9, 11), (11, 13), (13, 15), (15, 22), (22, 29), (29, 36), (36, 42), (42, 48), (48, 54), (54, 60)] data = pd.read_fwf(self.local_path(interval), names=headings, header=None, colspecs=colspecs) # Process data data['year'] += 1900 # Convert date info to datetime data['Time'] = pd.to_datetime(data['year'], format='%Y') + \ pd.to_timedelta(data['doy'] - 1, unit='d') + \ pd.to_timedelta(data['hour'], unit='h') + \ pd.to_timedelta(data['minute'], unit='m') + \ pd.to_timedelta(data['second'], unit='s') data = data.drop(['year', 'doy', 'hour', 'minute', 'second'], axis=1) data = data.set_index('Time', drop=False) return data
Example #2
Source File: base.py From baseband with GNU General Public License v3.0 | 6 votes |
def tell(self, unit=None): """Current offset in the file. Parameters ---------- unit : `~astropy.units.Unit` or str, optional Time unit the offset should be returned in. By default, no unit is used, i.e., an integer enumerating samples is returned. For the special string 'time', the absolute time is calculated. Returns ------- offset : int, `~astropy.units.Quantity`, or `~astropy.time.Time` Offset in current file (or time at current position). """ if unit is None: return self.offset # "isinstance" avoids costly comparisons of an actual unit with 'time'. if not isinstance(unit, u.UnitBase) and unit == 'time': return self.start_time + self.tell(unit=u.s) return (self.offset / self.sample_rate).to(unit)
Example #3
Source File: test_OpticalSystem.py From EXOSIMS with BSD 3-Clause "New" or "Revised" License | 6 votes |
def outspec_compare(self, outspec1, outspec2): r"""Compare two _outspec dictionaries. This is in service of the roundtrip comparison, test_roundtrip.""" self.assertEqual(sorted(list(outspec1)), sorted(list(outspec2))) for k in outspec1: if isinstance(outspec1[k], list): # this happens for scienceInstrument and starlightSuppression, # which are lists of dictionaries for (d1, d2) in zip(outspec1[k], outspec2[k]): for kk in d1: if kk.split("_")[0] == 'koAngles': self.assertEqual(d1[kk][0], d2[kk][0]) self.assertEqual(d1[kk][1], d2[kk][1]) else: self.assertEqual(d1[kk], d2[kk]) else: # these are strings or numbers, but not Quantity's, # because the outspec does not contain Quantity's self.assertEqual(outspec1[k], outspec2[k])
Example #4
Source File: SS_det_only.py From EXOSIMS with BSD 3-Clause "New" or "Revised" License | 6 votes |
def hist(self, nplan, xedges, yedges): """Returns completeness histogram for Monte Carlo simulation This function uses the inherited Planet Population module. Args: nplan (float): number of planets used xedges (float ndarray): x edge of 2d histogram (separation) yedges (float ndarray): y edge of 2d histogram (dMag) Returns: h (ndarray): 2D numpy ndarray containing completeness histogram """ s, dMag = self.genplans(nplan) # get histogram h, yedges, xedges = np.histogram2d(dMag, s.to('AU').value, bins=1000, range=[[yedges.min(), yedges.max()], [xedges.min(), xedges.max()]]) return h, xedges, yedges
Example #5
Source File: test_OpticalSystem.py From EXOSIMS with BSD 3-Clause "New" or "Revised" License | 6 votes |
def test_roundtrip(self): r"""Test of initialization and __init__ -- round-trip parameter check. Method: Instantiate an OpticalSystem, use its resulting _outspec to instantiate another OpticalSystem. Assert that all quantities in each dictionary are the same. This checks that OpticalSystem objects are in fact reproducible from the _outspec alone. """ optsys = self.fixture(**deepcopy(specs_simple)) self.validate_basic(optsys, specs_simple) # save the _outspec outspec1 = optsys._outspec # recycle the _outspec into a new OpticalSystem optsys_next = self.fixture(**deepcopy(outspec1)) # this is the new _outspec outspec2 = optsys_next._outspec # ensure the two _outspec's are the same self.outspec_compare(outspec1, outspec2)
Example #6
Source File: SLSQPScheduler.py From EXOSIMS with BSD 3-Clause "New" or "Revised" License | 6 votes |
def objfun(self,t,sInds,fZ): """ Objective Function for SLSQP minimization. Purpose is to maximize summed completeness Args: t (ndarray): Integration times in days. NB: NOT an astropy quantity. sInds (ndarray): Target star indices (of same size as t) fZ (astropy Quantity): Surface brightness of local zodiacal light in units of 1/arcsec2 Same size as t """ good = t*u.d >= 0.1*u.s # inds that were not downselected by initial MIP comp = self.Completeness.comp_per_intTime(t[good]*u.d, self.TargetList, sInds[good], fZ[good], self.ZodiacalLight.fEZ0, self.WAint[sInds][good], self.detmode) #self.vprint(-comp.sum()) # for verifying SLSQP output return -comp.sum()
Example #7
Source File: SLSQPScheduler.py From EXOSIMS with BSD 3-Clause "New" or "Revised" License | 6 votes |
def objfun_deriv(self,t,sInds,fZ): """ Jacobian of objective Function for SLSQP minimization. Args: t (astropy Quantity): Integration times in days. NB: NOT an astropy quantity. sInds (ndarray): Target star indices (of same size as t) fZ (astropy Quantity): Surface brightness of local zodiacal light in units of 1/arcsec2 Same size as t """ good = t*u.d >= 0.1*u.s # inds that were not downselected by initial MIP tmp = self.Completeness.dcomp_dt(t[good]*u.d, self.TargetList, sInds[good], fZ[good], self.ZodiacalLight.fEZ0, self.WAint[sInds][good], self.detmode).to("1/d").value jac = np.zeros(len(t)) jac[good] = tmp return -jac
Example #8
Source File: imp.py From heliopy with GNU General Public License v3.0 | 6 votes |
def i8_mag15s(starttime, endtime): identifier = 'I8_15SEC_MAG' units = OrderedDict([('N_of_points', u.dimensionless_unscaled), ('SourceFlag', u.dimensionless_unscaled), ('|B|', u.nT), ('Bx gse', u.nT), ('By gse', u.nT), ('Bz gse', u.nT), ('By gsm', u.nT), ('Bz gsm', u.nT), ('Bxx gse', u.nT**2), ('Byy gse', u.nT**2), ('Bzz gse', u.nT**2), ('Byx gse', u.nT**2), ('Bzx gse', u.nT**2), ('Bzy gse', u.nT**2), ('Time shift', u.s), ('SW_flag', u.dimensionless_unscaled)]) for coord in ['GSE', 'GSET', 'GSM', 'GSMT']: for i in range(3): units[f'SC_Pos_{coord}_{i}'] = u.earthRad return _imp8(starttime, endtime, identifier, units=units)
Example #9
Source File: SS_char_only2.py From EXOSIMS with BSD 3-Clause "New" or "Revised" License | 6 votes |
def __init__(self, occHIPs=[], **specs): SurveySimulation.__init__(self, **specs) self._outspec['occHIPs'] = occHIPs if occHIPs is not []: occHIPs_path = os.path.join(EXOSIMS.__path__[0],'Scripts',occHIPs) assert os.path.isfile(occHIPs_path), "%s is not a file."%occHIPs_path with open(occHIPs_path, 'r') as ofile: HIPsfile = ofile.read() self.occHIPs = HIPsfile.split(',') if len(self.occHIPs) <= 1: self.occHIPs = HIPsfile.split('\n') else: self.occHIPs = occHIPs
Example #10
Source File: base.py From baseband with GNU General Public License v3.0 | 6 votes |
def __init__(self, fh_raw, squeeze=True, subset=(), verify=True): fh_raw = DADAFileReader(fh_raw) header0 = fh_raw.read_header() super().__init__(fh_raw, header0, squeeze=squeeze, subset=subset, verify=verify) # Store number of frames, for finding last header. with self.fh_raw.temporary_offset() as fh_raw: self._raw_file_size = fh_raw.seek(0, 2) self._nframes, partial_frame_nbytes = divmod( self._raw_file_size, self.header0.frame_nbytes) # If there is a partial last frame. if partial_frame_nbytes > 0: # If partial last frame contains payload bytes. if partial_frame_nbytes > self.header0.nbytes: self._nframes += 1 # If there's only one frame and it's incomplete. if self._nframes == 1: self._header0 = self._last_header self._samples_per_frame = ( self._last_header.samples_per_frame) # Otherwise, ignore the partial frame unless it's the only # frame, in which case raise an EOFError. elif self._nframes == 0: raise EOFError('file (of {0} bytes) appears to end without' 'any payload.'.format(partial_frame_nbytes))
Example #11
Source File: test_vdif.py From baseband with GNU General Public License v3.0 | 6 votes |
def test_corrupt_stream(self, tmpdir): corrupt_file = str(tmpdir.join('test.vdif')) with vdif.open(SAMPLE_FILE, 'rb') as fh, \ open(corrupt_file, 'w+b') as s: frameset = fh.read_frameset() header0 = frameset.frames[0].header frameset.tofile(s) frameset = fh.read_frameset() frameset.tofile(s) # Now add lots of the final frame, i.e., with the wrong thread_id. fh.seek(-5032, 2) frame2 = fh.read_frame() for i in range(15): frame2.tofile(s) s.seek(0) with vdif.open(s, 'rs') as f2: assert f2.header0 == header0 with pytest.raises(HeaderNotFoundError): f2._last_header
Example #12
Source File: base.py From baseband with GNU General Public License v3.0 | 6 votes |
def get_fh(self, name, mode, kwargs={}): """Ensure name is a filehandle, opening it if necessary.""" if mode == 'wb' and self.is_sequence(name): raise ValueError(f"{self.fmt} does not support writing to a " f"sequence or template in binary mode.") if self.is_fh(name): return name if self.is_template(name): name = self.get_fns(name, mode, kwargs) open_kwargs = {'mode': (mode[0].replace('w', 'w+') + mode[1].replace('s', 'b'))} if self.is_sequence(name): opener = sf.open if 'file_size' in kwargs: open_kwargs['file_size'] = kwargs.pop('file_size') else: opener = io.open return opener(name, **open_kwargs)
Example #13
Source File: ulysses.py From heliopy with GNU General Public License v3.0 | 5 votes |
def swoops_ions(starttime, endtime): """ Import SWOOPS ion data. Parameters ---------- starttime : datetime Start of interval endtime : datetime End of interval Returns ------- data : :class:`~sunpy.timeseries.TimeSeries` Requested data """ units = OrderedDict([('T_p_large', u.K), ('T_p_small', u.K), ('v_t', u.km / u.s), ('v_r', u.km / u.s), ('v_n', u.km / u.s), ('r', u.au), ('n_a', u.cm**-3), ('n_p', u.cm**-3), ('hlat', u.deg), ('hlon', u.deg), ('iqual', u.dimensionless_unscaled)]) downloader = _swoopsionDownloader(units) return downloader.load(starttime, endtime)
Example #14
Source File: ulysses.py From heliopy with GNU General Public License v3.0 | 5 votes |
def swics_abundances(starttime, endtime): """ Import swics abundance data. The variables in this dataset are: - VEL_ALPHA: alpha velocity - RAT_C6_C5: ratio of carbon 6+ to 5+ - RAT_O7_O6: ratio of oxygen 7+ to 6+ - RAT_FE_O: abundance ratio of iron to oxygen - CHARGE_FE: average charge state of iron - N_CYC: number of instrument cycles in average See http://ufa.esac.esa.int/ufa-sl-server/data-action?PROTOCOL=HTTP&PRODUCT_TYPE=ALL&FILE_NAME=readme.txt&FILE_PATH=/ufa/HiRes/data/swics for more information. Parameters ---------- starttime : datetime Start of interval endtime : datetime End of interval Returns ------- data : :class:`~sunpy.timeseries.TimeSeries` Requested data """ names = ['year', 'doy', 'hour', 'minute', 'second', 'VEL_ALPHA', 'RAT_C6_C5', 'RAT_O7_O6', 'RAT_FE_O', 'CHARGE_FE', 'N_CYC'] product = 'uswichst' units = OrderedDict([('VEL_ALPHA', u.km / u.s), ('RAT_C6_C5', u.dimensionless_unscaled), ('RAT_O7_O6', u.dimensionless_unscaled), ('RAT_FE_O', u.dimensionless_unscaled), ('CHARGE_FE', u.dimensionless_unscaled), ('N_CYC', u.dimensionless_unscaled)]) return _swics(starttime, endtime, names, product, units)
Example #15
Source File: test_models.py From heliopy with GNU General Public License v3.0 | 5 votes |
def test_parker_spiral(): spiral = ParkerSpiral(100 * u.km / u.s, 0 * u.au, 0 * u.deg) longs = spiral.longitude([1, 2] * u.au) assert_quantity_allclose(longs[0], -254.7492444 * u.deg) assert_quantity_allclose(longs[1], -509.4984888 * u.deg)
Example #16
Source File: ulysses.py From heliopy with GNU General Public License v3.0 | 5 votes |
def _convert_ulysses_time(data): """Method to convert timestamps to datetimes""" if (data['year'] < 1900).all(): data.loc[data['year'] > 50, 'year'] += 1900 data.loc[data['year'] < 50, 'year'] += 2000 data['Time'] = pd.to_datetime(data['year'].astype(str) + ':' + data['doy'].astype(str), format='%Y:%j') data['Time'] += (pd.to_timedelta(data['hour'], unit='h') + pd.to_timedelta(data['minute'], unit='m') + pd.to_timedelta(data['second'], unit='s')) data = data.drop(['year', 'doy', 'hour', 'minute', 'second'], axis=1) return data
Example #17
Source File: test_guppi.py From baseband with GNU General Public License v3.0 | 5 votes |
def test_header_extraction(self): # Follow Nikhil's J1810 Arecibo observation file naming scheme: # puppi_58132_J1810+1744_2176.0000.raw, etc. template = 'puppi_{stt_imjd}_{src_name}_{scannum}.{file_nr:04d}.raw' fns = GUPPIFileNameSequencer(template, self.header) assert fns[0] == 'puppi_58132_J1810+1744_2176.0000.raw' assert fns[29] == 'puppi_58132_J1810+1744_2176.0029.raw'
Example #18
Source File: base.py From baseband with GNU General Public License v3.0 | 5 votes |
def __repr__(self): return ("{name}(fh_raw={s.fh_raw}, kday={s.kday}, " "ref_time={s.ref_time}, nchan={s.nchan}, bps={s.bps})" .format(name=self.__class__.__name__, s=self))
Example #19
Source File: test_vdif.py From baseband with GNU General Public License v3.0 | 5 votes |
def test_io_invalid(self, tmpdir): tmp_file = str(tmpdir.join('ts.dat')) with open(tmp_file, 'wb') as fw: fw.write(b' ') with pytest.raises(TypeError): # Extra argument. vdif.open(tmp_file, 'rb', bla=10) with pytest.raises(ValueError): # Missing w or r. vdif.open(tmp_file, 's')
Example #20
Source File: test_vdif.py From baseband with GNU General Public License v3.0 | 5 votes |
def test_invalid_last_frame(self, tmpdir): # Some VDIF frames encountered in the wild have a last frame with a # header which is mostly zeros and marked invalid. Check that we # properly ignore such a frame. See gh-271. test_file = str(tmpdir.join('test2.vdif')) with vdif.open(SAMPLE_FILE, 'rs') as fh, \ open(test_file, 'ab') as s, \ vdif.open(s, 'ws', header0=fh.header0, nthread=8) as fw: data = fh.read() for _ in range(5): fw.write(data) assert s.seek(0, 2) == 5032 * 8 * 2 * 5 bad_header = vdif.VDIFHeader.fromvalues(edv=0, frame_nbytes=5032, invalid_data=True) bad_header.tofile(s) s.write(b'\0' * 5000) assert s.tell() == 5032 * (8 * 2 * 5 + 1) # For this short test file, one gets the wrong sample rate by # looking for the frame number returning to zero; so we pass # the correct one in. with vdif.open(test_file, 'rs', sample_rate=32*u.MHz) as f2: assert f2.start_time == fh.start_time assert f2.shape[0] == 5*fh.shape[0] assert abs(f2.stop_time - fh.stop_time - 4*(fh.stop_time-fh.start_time)) < 1.*u.ns d2 = f2.read() assert np.all(d2.reshape(5, -1, 8) == data)
Example #21
Source File: flatfield.py From ctapipe with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, subarray, **kwargs): """ Parent class for the flat-field calculators. Fills the MonitoringCameraContainer.FlatfieldContainer on the base of a given flat-field event sample. The sample is defined by a maximal interval of time (sample_duration) or a minimal number of events (sample_duration). The calculator is supposed to be called in an event loop, extract and collect the event charge and fill the PedestalContainer Parameters ---------- subarray: ctapipe.instrument.SubarrayDescription Description of the subarray tel_id : int id of the telescope (default 0) sample_duration : int interval of time (s) used to gather the pedestal statistics sample_size : int number of pedestal events requested for the statistics n_channels : int number of waveform channel to be considered charge_product : str Name of the charge extractor to be used config : traitlets.loader.Config Configuration specified by config file or cmdline arguments. Used to set traitlet values. Set to None if no configuration to pass. kwargs """ super().__init__(**kwargs) # load the waveform charge extractor self.extractor = ImageExtractor.from_name( self.charge_product, config=self.config, subarray=subarray, ) self.log.info(f"extractor {self.extractor}")
Example #22
Source File: header.py From baseband with GNU General Public License v3.0 | 5 votes |
def set_time(self, time, frame_rate=None): """Converts Time object to ref_epoch, seconds, and frame_nr. For non-integer seconds, a frame rate is needed to calculate the 'frame_nr'. Parameters ---------- time : `~astropy.time.Time` The time to use for this header. frame_rate : `~astropy.units.Quantity`, optional For calculating 'frame_nr' from the fractional seconds. """ seconds = time - self.ref_time int_sec = int(seconds.sec) # Round to nearest ns to handle timestamp difference errors. frac_sec = seconds - int_sec * u.s if abs(frac_sec) < 1. * u.ns: frame_nr = 0 elif abs(1. * u.s - frac_sec) < 1. * u.ns: int_sec += 1 frame_nr = 0 else: if frame_rate is None: raise ValueError("this header does not provide a frame " "rate. Pass it in explicitly.") frame_nr = int((frac_sec * frame_rate).to(u.one).round()) if abs(frame_nr / frame_rate - 1. * u.s) < 1. * u.ns: frame_nr = 0 int_sec += 1 self['seconds'] = int_sec self['frame_nr'] = frame_nr
Example #23
Source File: header.py From baseband with GNU General Public License v3.0 | 5 votes |
def get_time(self, frame_rate=None): """Converts ref_epoch, seconds, and frame_nr to Time object. Uses 'ref_epoch', which stores the number of half-years from 2000, and 'seconds'. By default, it also calculates the offset using the current frame number. For non-zero 'frame_nr', this requires the frame rate, which is calculated from the sample rate in the header. Parameters ---------- frame_rate : `~astropy.units.Quantity`, optional For non-zero 'frame_nr', this is required to calculate the corresponding offset. Returns ------- time : `~astropy.time.Time` """ frame_nr = self['frame_nr'] if frame_nr == 0: offset = 0. else: if frame_rate is None: raise ValueError("this header does not provide a frame " "rate. Pass it in explicitly.") offset = (frame_nr / frame_rate).to_value(u.s) return (self.ref_time + TimeDelta(self['seconds'], offset, format='sec'))
Example #24
Source File: header.py From baseband with GNU General Public License v3.0 | 5 votes |
def fromfile(cls, fh, edv=None, verify=True): """Read VDIF Header from file. Parameters ---------- fh : filehandle To read data from. edv : int, False, or None, optional Extended data version. If `False`, a legacy header is used. If `None` (default), it is determined from the header. (Given it explicitly is mostly useful for a slight speed-up.) verify : bool, optional Whether to do basic verification of integrity. Default: `True`. """ # Assume non-legacy header to ensure those are done fastest. # Since a payload will follow, it is OK to read too many bytes even # for a legacy header; we just rewind below. s = fh.read(32) if len(s) != 32: raise EOFError self = cls(eight_word_struct.unpack(s), edv, verify=False) if self.edv is False: # Legacy headers are 4 words, so rewind, and remove excess data. fh.seek(-16, 1) self.words = self.words[:4] if verify: self.verify() return self
Example #25
Source File: base.py From baseband with GNU General Public License v3.0 | 5 votes |
def __call__(self, name, mode='rs', **kwargs): """ Open baseband file(s) for reading or writing. Opened as a binary file, one gets a wrapped filehandle that adds methods to read/write a frame. Opened as a stream, the handle is wrapped further, with methods such as reading and writing to the file as if it were a stream of samples. Parameters ---------- name : str or filehandle, or sequence of str File name, filehandle, sequence of file names, or template. mode : {'rb', 'wb', 'rs', or 'ws'}, optional Whether to open for reading or writing, and as a regular binary file or as a stream. Default: 'rs', for reading a stream. **kwargs Additional arguments when opening the file as a stream. """ mode = self.normalize_mode(mode) if mode == 'ws': # Stream writing always needs a header. Construct from # other keywords if necessary. kwargs['header0'] = self.get_header0(kwargs) fh = self.get_fh(name, mode, kwargs) try: return self.classes[mode](fh, **kwargs) except Exception: if fh is not name: fh.close() raise
Example #26
Source File: base.py From baseband with GNU General Public License v3.0 | 5 votes |
def normalize_mode(self, mode): if mode in self.classes: return mode if mode[::-1] in self.classes: return mode[::-1] if mode in {'r', 'w'}: return mode + 's' raise ValueError(f'invalid mode: {mode} ' f'({self.fmt} supports {set(self.classes)}).')
Example #27
Source File: base.py From baseband with GNU General Public License v3.0 | 5 votes |
def stop_time(self): """Time at the end of the file, just after the last sample. See also `start_time` for the start time of the file, and `time` for the time of the sample pointer's current offset. """ return (self._get_time(self._last_header) + (self.samples_per_frame / self.sample_rate))
Example #28
Source File: base.py From baseband with GNU General Public License v3.0 | 5 votes |
def time(self): """Time of the sample pointer's current offset in file. See also `start_time` for the start time, and (if available) `stop_time` for the end time, of the file. """ return super().time
Example #29
Source File: flatfield.py From ctapipe with BSD 3-Clause "New" or "Revised" License | 5 votes |
def calculate_time_results( self, trace_time, masked_pixels_of_sample, time_start, trigger_time, ): """Calculate and return the time results """ masked_trace_time = np.ma.array(trace_time, mask=masked_pixels_of_sample) # median over the sample per pixel pixel_median = np.ma.median(masked_trace_time, axis=0) # mean over the sample per pixel pixel_mean = np.ma.mean(masked_trace_time, axis=0) # std over the sample per pixel pixel_std = np.ma.std(masked_trace_time, axis=0) # median of the median over the camera median_of_pixel_median = np.ma.median(pixel_median, axis=1) # time outliers from median relative_median = pixel_median - median_of_pixel_median[:, np.newaxis] time_median_outliers = np.logical_or( pixel_median < self.time_cut_outliers[0], pixel_median > self.time_cut_outliers[1], ) return { # FIXME Why divided by two here? "sample_time": u.Quantity((trigger_time - time_start) / 2, u.s), "sample_time_min": u.Quantity(time_start, u.s), "sample_time_max": u.Quantity(trigger_time, u.s), "time_mean": np.ma.getdata(pixel_mean), "time_median": np.ma.getdata(pixel_median), "time_std": np.ma.getdata(pixel_std), "relative_time_median": np.ma.getdata(relative_median), "time_median_outliers": np.ma.getdata(time_median_outliers), }
Example #30
Source File: test_models.py From heliopy with GNU General Public License v3.0 | 5 votes |
def test_spiral_rot_rate(): # Check that a slower rotation rate results in a less wound spiral v = 100 * u.km / u.s r0 = 0 * u.au l0 = 0 * u.deg spiral1 = ParkerSpiral(v, r0, l0) spiral2 = ParkerSpiral(v, r0, l0, 14 * u.deg / u.day) long1 = spiral1.longitude(1 * u.au) long2 = spiral1.longitude(2 * u.au) assert long1 > long2