@MisterMiyagi In any case it got reopened, and I got around to post the answer, and it ties in with what you were thinking with regarding the use of typing.Literal because that's what I was also thinking given that other thread I provided the answer for.
@roganjosh I noticed in the transcript that you mentioned leap seconds a few days ago. Python datetime doesn't support leap seconds. The POSIX standard is internally inconsistent regarding leap seconds. On the one hand, the count of seconds in the UNIX epoch time must ignore leap seconds. On the other hand, POSIX time is supposed to agree with UTC time. There's some discussion at unix.stackexchange.com/q/283164/88378 Also see ucolick.org/~sla/leapsecs/epochtime.html
Cabbage @AnttiHaapala If you think datetime is a mess, you ain't seen nuthin'. Take a look at the insane history of UTC, summarised by astronomer Steve Allen of the Lick Observatory. Be warned, even the summary is rather large... http://www.ucolick.org/~sla/leapsecs/timescales.html He briefly discusses some of the key issues here http://www.ucolick.org/~sla/leapsecs/
@MisterMiyagi The leap second system permits negative leap seconds, but they've never been needed. We might get one in the near future, though. There are lots of tiny irregularities in Earth's rotation, but the general long-term trend is that the rotation is slowing down, due to tidal interaction with the Moon, which transfers angular momentum from Earth's rotation to the Moon's rotation & revolution.
We've theoretically known about the tidal slowdown for a long time, but it's pretty hard to measure precisely. The tiny irregularities were suspected, but were impossible to measure before the invention of the atomic clock.
The SI second was defined in terms of the caesium atomic clock in the early 1960s. Its definition was chosen to closely agree with the ephemeris second. And that second corresponds with the mean solar second of ~1820. The Earth is (on average) rotating slower than what it was two centuries ago. So the mean solar day is slightly longer than 86400 SI seconds.
So although the purpose of the leap second is to compensate for the variations in Earth's rotation, it mostly just compensates for the fact that the SI second has always been too short.
> The recent history of precision chronology has been a litany of committees that fail to reach decisions, with poor communication and misunderstanding between various involved parties, punctuated by hasty decision making, and technical details hidden by paywalls, particularly in regard to leap seconds. (This has led to the embarrassing situation that the POSIX standard is internally inconsistent regarding leap seconds).
I've got a perplexing issue where two strings that apparently look the same don't behave the same way in code. Does anyone know of a checklist or something I can use to hunt down the issue?
One of the strings is extracted using Eugene Yarmash's code here: stackoverflow.com/questions/46258499/…; the other is hard-coded using the printed output of the first string
@Allure did you try to put in a list? A trick I use when I don't know if there is hidden characters. Another one is just to use bytes instead and compare
you can use .strip() since it's a string. But if you want to just remove one said, you can just use rstrip() or lstrip() to remove it from right or left side
Before the development of the electronic quartz clock, our most precise clock was the rotation of the Earth relative to the stars. So all official time scales were derived from astronomical observations.
Even in the modern era, we still need astronomical observations because we want our days to be connected to Earth's rotation.
The SI standard only defines the duration of the second. It's oblivious to days and years.
OTOH, for precise ephemeris calculations of the bodies in the Solar System we need to use a uniform time scale. Time based on the Earth's rotation isn't uniform, and the tiny irregularities are unpredictable.
The timescale used by JPL in its Solar System calculations is essentially the time of a clock that's comoving with the Solar System's barycentre, but outside the Sun's gravity well.
Relative to that clock, atomic clocks on the Earth speed up and slow down due to variations in the gravitational potential as we orbit the Sun. And due to the gravity of the Moon & the planets. And the asteroids...
the other thing, where you said "mean solar second"... that implies there's, like, a measurable second-to-second variation in the rotation speed of the earth?
(er I guess if you're saying "solar" then it's about the year length rather than the day length... ?)
but not just the trend towards slowing down, but actual measurable jitter?
@tripleee I see @MisterMiyagi re-hammered it. The new duplicates seem awkward. There should be a self-written canonical probably
for short-circuiting, I mean
this question can't really be at the "top of the pile", because "what's the difference" basically never works, and in this case there are two clear differences (short-circuiting, and retaining the operand value)
I'm going to think really hard about how I present the analogous material on Codidact, and then the rest of you are welcome to do the CC BY-SA thing ;)
I came to the realization that, rather than contributing to sopython/canon, I would much rather just write the canonicals, and thus split the topic space into questions elegantly rather than hoping the organic approach works out
and I'm doing it on a different site because, well, @roganjosh's pinned post ;)
@KarlKnechtel The question formulation skew is a bit awkward, but the topic is exactly the "why are function versions of these operators different/not possible".
@KarlKnechtel Solar time speeds up & slows down compared to sidereal time (based on the Earth's rotation relative to the stars). That's because the ecliptic (Earth's orbital plane) is tilted relative to the equatorial plane. And because the orbit is an ellipse, and we orbit faster when we're closer to the Sun.
oh. So that's quite a bit of variation over the course of a year, then. IIRC the variation in solar distance is something like 3%, and something something Kepler's law...
@PM2Ring I have to say, this is 100% fascinating. It's also 100% reassuring that I don't have to deal with this in my $DAYJOB. Keep 'em coming, those information snippets!
On the point of Unix timestamps being skewed, I've long since wondered why they aren't literally seconds since the epoch. The seconds-since-epoch-but-without-those-seconds-there doesn't seem to fix all that much.
> The recent history of precision chronology has been a litany of committees that fail to reach decisions, with poor communication and misunderstanding between various involved parties, punctuated by hasty decision making, and technical details hidden by paywalls, particularly in regard to leap seconds. (This has led to the embarrassing situation that the POSIX standard is internally inconsistent regarding leap seconds).
hmm my pr is "constantly" being rejected with the comment: "you don't test if the object is constructed with teh correct parameters". How would I mock this?
the function is like:
def foo(someArg, otherArg):
c = MyClass(someArg)
return c.doAction(otherArg)
The IERS keep track of this stuff. en.wikipedia.org/wiki/… They publish the details regularly. This helps astronomers enormously. If you're looking at distant stuff, it's important to know which direction your telescope is actually pointing. :) It would be inefficient for every observatory to make a detailed observation of the Earth's orientation every time they made an observation.
@Aran-Fey "it's my responsibility to make sure it's called with the right arguments, that if you supply somarg to the function the class is also initialized with somearg"
Well there is some calculation betwen "someArg" and the passing to the function (increment by 1)
can't go against more senior people, he suggests I would rework the code to not use object inheritance or I would make a fixture to test the result of doAction (it should send a http request and return the result)
fundamentally the code works by sending post requests, yes? and it does that, consistently, by calling some other API (perhaps a standard library one)?
so, there should, with proper architecture, be a single point where a mock can be injected for that
well c.doAction() performs c._post_request() which I could mock itself. But then if I test if the url is correct and we (say) no longer use http but ftp to sent data (which the higher level doesn't care about), I need to update the tests.
you don't have to test that the url is the correct complete http url (and open yourself up to brittleness if you use ftp later). You only have to test that the url corresponds to the foo arguments in the expected manner
and actually, does the code really not separately encapsulate the process of computing the url to request?
If you wrote MyClass then yes test it, if not then, eh, why do they care, they should consult with that package, or reject your pull request for using a package with insufficient testing (or more insultingly to you, make you write another pr for that package to include the tests they want before they want your pr merged)
though honestly without the context it is hard for any of us to say what is actually required here
They told me: "if you can, make sure to rewrite the MyClass so it can be tested better".
Annoying thing is, PR is based on the senior's older code from this summer, where I even asked if he shouldn't make it testable, but it was replied with "yagni"; and now manager tells me the current story is taking suddenly much more time :/
@PM2Ring (I don't have the privs to propose an edit s/principle/principal/g) (other than if I "fix" the British spelling travelling, but it's a quote from Wikipedia)
@tripleee Eek! Thanks. How embarrassing. :) At least it wasn't an arithmetic / numerical error. A few months ago, I fixed one of those on one of my old popular answers. Nobody had mentioned it in 3 years...
I'm Australian, so my spelling mostly follows British spelling. But I use "color" when I'm writing code that uses it as a keyword. And when I'm talking about such code, just to maintain consistency.
@KarlKnechtel The axial tilt causes a speed variation because we're projecting motion from the ecliptic to the celestial equator. Let's pretend the Sun's apparent orbit is a perfect circle, and it moves on that circle at uniform speed. The angular distance along the ecliptic is the ecliptic longitude. The angular distance along the celestial equator is called the right ascension. Both are zero at the March equinox.
Let x be the ecliptic longitude, y be the right ascension, and oe be the obliquity of the ecliptic (i.e., the axial tilt). Then from spherical trig, we get tan(y) = cos(oe) * tan(x). Now we need to take the derivative to see how the speed dy/dx varies with x. That's fairly easy. But I'll let Sage do it.
We see that the speed is minimum at 0° & 180°, the equinoxes, and maximum at the solstices, 90° & -90°.
Intuitively, when the Sun is near the solstices it's moving almost parallel to the equator, so its projection onto the equator is moving fast. But near the equinoxes, it's got more vertical motion towards or away from the equator, and a smaller motion component parallel to the equator.
Strange I'm trying to make a comment on this post https://astronomy.stackexchange.com/questions/55900/what-on-site-equipment-is-installed-with-radio-telescopes and it tells me it's 50 rep in that community as well. But I get the message: × User does not have permission to comment on this post
I need to write some code that displays a 2d numpy array as a table, but I'm unsure how to orient it. Do people generally treat the first dimension as x or as y?
how can I argue with people to tell them that small files (instead of 500+ line files) is more useful? I personally really like that due to easier scrolling and less difficulty noticing in which class/function I am. However that is often dismissed and countered by "less import problems".
Right ok. You are welcome to explain what you have done and where you are stuck, but it's not just me that you're directing it to because you're not using my code
And we already covered how you can share code. Multiple times, in fact. I don't want to go in circles again
Ok. Well firstly, this is so much better than our first time around - thank you! And this seems simple enough to solve on the surface. Can you paste the full traceback to dpaste too please? I had some ambiguity over exactly which library YODA actually referred to
AttributeError Traceback (most recent call last) Cell In[19], line 1 ----> 1 results = match_aos(aos, "Ncharge_Towards/ZplusJet_UE/NCharged_Towards_Ys=0.500000_Yb=0.500000" ) 2 print(results) Cell In[15], line 31 29 if re_patts: 30 for rp in re_patts: ---> 31 if (not search and rp.match(ao.path())) or (search and rp.search(ao.path())): 32 match = True 33 break AttributeError: 'str' object has no attribute 'path'