which is why I need the eight (x, y) pairs. This is one example dataset where I know the output from my R code differs from my current Python code and I'm trying to figure out why and how to replicate the "correct" values.
@Code-Apprentice Then it's possibly not even on-topic for Python. The standard unit-testing methodology to do ports is write yourself a bunch of unit-tests, from simple to complicated, then fix them one-by-one. Fix the ordinary case before the log-logistic case. Fix the p0 = (0, 0) case before the p0 = (-1, 1) case. Put in numerical tolerances on unit-testing numerical comparisons. etc.
At least plot the Python vs R curve-fits to sufficiently motivate Python users to believe that the error might be on the Python-side. And put those graphs above the code so they get seen. You're asking people's advice, that's my advice. Python users won't care if the error is anything caused by drc package, or its documentation.
@Code-Apprentice Ok. Can you also eliminate p0 = (0, 0)?
Ok recommend you change the absolute first line of your question to "In the following code, the curve-fit in my Python version produces incorrect (slope, intercept) coeffts whereas the coeffts from the R version are correct." But I strongly suggest you post the plots of both graphs (on log-linear axes), to motivate the reader (then they can confirm at-a-glance that Python's wrong but R is right - which they currently totally can't). Otherwise they mightn't believe you the Python version's wrong.
...else people might (reasonably) suspect the issues could equally be in drc package. As someone jokingly remarked to me yesterday "Trust me, I'm a lawyer"
yah, the question needs a stronger leadin, and a more direct question up front
and I could make the requirements more clear. It's not so much of an issue as the Python being "wrong" and the R being "right". The R code could certainly have a bug in it, but I still need to duplicate its output anyway.
@Code-Apprentice Appeal to our pro-Python jingoism (at least, don't make it sound like an appeal to Python developers to debug some R guy's long-dormant package which appears to have 0 unit-tests). Also, I searched a bit on Python numeric unittests, and you might find Automate your data analysis testing (Stephen Childs, PyCon Canada 2016) useful. Good luck, bye
@smci yah, I think my original question got lost in the weeds. Ultimately, I'm trying to find what technique the drc package is using for the regression. I think I finally found it as I dug past the data parsing (section a in your earlier comments) to the meat of the algorithm (section b). It calls a function named optim() that isn't doing least squares like the curve_fit() I'm using in the python code.
@Code-Apprentice "Ultimately, I'm trying to find what technique the drc package is using for the regression." Well that was self-evidently never a Python question, so off-topic here and in [Python] tag. You should have asked Christian Witz, drc users and R biotech users on the mailing lists they use for that. Anyway I'm glad my tips on reading R functions helped you pinpoint it.
...I do encourage you to contact Christian Witz and see if he'd be interested in you submitting some code cleanup, real comment lines that explain what's going on (not dead code commented-out). Fail that, agitate (on the R biotech mailing lists) for some community ownership of drc code. Also, make sure your employer is more cautious in future to voluntarily accruing technical debt on a single-sourced, borderline-unsupported package.
Suggestion for the room rules, maybe as a nudge or a guideline: if a discussion about helping someone solve a problem becomes protracted, please move it to a temporary private room - Generously apply user discretion and common sense. @Kevin
@Code-Apprentice, I did not know you could use python with IntelliJ; how does that compare to Pycharm?
I have data frame , one column is completely in hex format , i need to convert into ASCII format , How do we convert the entire column value from hex to ASCII
different search phrases depending on the precise problem, which of course the OP is not revealing
a better question would look like "I want to do X, I have tried the steps A B C D, but the result from C isn't exactly what D needs to produce X" with actual code
helping us see that you can handle A and B and D lets us focus on the actual problem rather than start from "is it plugged in" and "do you know Python"
Also in that thread: "For a while we had an official team gruntler. One of those people who just smooth ruffled feathers by the way they listen and care about you." I think that is a fantastic idea. I was almost done with it until someone asked if you can be "combobulated"
Yes @AndrasDeak, maybe it is not necessary to add this recommendation; I was a bit peeved by the wall of long posts pertaining to one topic that went on and on.
@ReblochonMasque I assume that suggestion was prompted by the R - Python discussion between Code-Apprentice & smci. We normally handle stuff like that on a case-by-case basis, but I guess it wouldn't hurt to have a room rule that covers discussions that are so localised that no other room visitors are likely to be interested or able to contribute.
just wanted to ask whether sorting all the particles by their x coordinates in a physics sim and then seeing how close together each element is from the next is a good method of collision detection?
Yes, that was it. Indeed @PM2Ring, no biggie. I contend that it could be mentioned in the rules as a suggestion that could help the room attendees know what options are available to them when they realize they may have over reached?
@3141 I suppose so. It depends if the particles tend to form clusters for any reason. And as Andras said, the number of dimensions can also have an impact.
@3141 Seriously, I suggest you research the existing algorithms. Since the middle of last century, there have been many thousands of person-years invested in investigating stuff related to nearest neighbours & clustering.
I know a bit about clustering & nearest neighbours as it relates to colour spaces: efficiently creating colour palettes and mapping images to palettes. Mostly in C, for speed, but I've done some stuff in Python, using PIL & Numpy to handle some of the processing.
I've been thinking about what you said @PM2Ring about black holes being cold in a previous conversation. I came across this and find myself confused about the term "temperature"
This all seems to be in regard to what is emitted but, to me, temperature is an internal state. It doesn't depend on what is emitted to the surroundings?
If thermodynamics breaks down though, is there any meaning to "temperature" in this case? I assume there is, but it's not in line with my traditional understanding
Im guessing it's being used in layman's terms because they didn't clarify it at the end of the article
@roganjosh inside? I wouldn't bet. Outside, if an object emits light according to Planck's law it makes sense to identify the corresponding temperature
"Temperature" is the intensive quantity conjugate to entropy, so... :P
Exactly, last time I looked, I got stuck at the point where you measure temperatures of bodies from their emitted radiation, but quid of a BH that doesn't radiate?
From an engineering point of view we would have conductive, convective and radiative heat transfer. From a physics point of view, are they the same mechanism, just different mediums?
My understanding of conductive transfer would be through a physical mechanism of contact between materials, but this measurement of temperature is just accounting for radiative transfer
@roganjosh Sorry about the delay. I was busy on MSE... I just had a quick look at the article you linked. Yes, black holes have a temperature, but the amount of power they emit is ridiculously tiny, and it's not exactly emitted by the singularity of the BH, or even by its event horizon. It's emitted by the space outside the event horizon.
@roganjosh so the colloquial impression of temperature is "hot/not hot" but when you put your hand on something you're really feeling heat transfer, not temperature (see 100-celsius copper vs. 100-celsius polystyrene). It's further muddled by the fact that heat transfer leads to an increase in temperature, which means that it also leads to thermal equilibrium, so our thermometers are usually based on heat transfer
but it turns out that if you use conduction to measure temperature (thermometer) or use radiation to measure temperature (measuring thermal radiation spectrum) you'll get the same temperature
And with Planck's law, what we usually imagine is that a cavity in equilibrium will contain electromagnetic radiation that is in thermal equilibrium with the walls of the cavity. This is described by Planck's law which uniquely identifies temperature. But even outside equilibrium we end up seeing this radiation by anything that has finite temperature (in other words, everything). Still I tend to think of this as the surface of objects that's emitting the radiation.
Now, with a black hole, if a black hole does have a surface, any radiation emitted by that surface would be deep inside the event horizon so we'd never see it. Thus any radiation we do see from a black hole doesn't come from the black hole itself
And if you think "why black hole if it radiates?", consider that the ideal radiation described by Planck's law is called black-body radiation, because interestingly it's the radiation emitted by a body that absorbs 100% of all EM radiation it receives. So the blackness of a black body, just like the blackness of a black hole, relates to the fact that if you shine a light on it, it'll eat it all up. Still they radiate :)
Here's a crude analogy: if you stress stuff, it tends to heat up. Eg, bend a piece of coat-hanger wire a few times, and the bend gets quite warm. In the immediate vicinity of a BH space itself is so stressed that it heats up, but due to the way general relativity works, the amount of heat radiation in the region that an observer sees depends on the observer's motion.
To get some solid numbers, we can use this handy Hawking radiation calculator. Eg, a small BH, 3 times the mass of the Sun, has a Schwarzschild radius just under 8.862 km, and radiates 10^-29 watts at a temperature of 20 nanokelvin. Larger BHs have colder temperatures.
Ok, between the pair of you, I have a much better understanding. I think :) thanks. We learned about black body radiation but I didn't have a proper idea of how it fit in with any of the things I was doing in engineering. It makes more sense now I see it extrapolated outside of my own domain
I guess for my question w.r.t. the singularity, I best give Elon Musk a tinkle and book my next voyage
We don't know what the core of a BH is like. We need a quantum gravity theory to address questions like that. It might be a mathematical singularity, but most physicists expect that quantum effects will fuzz things out, preventing a singularity.
And even if we do have a quantum gravity theory, we'll never be able to verify its predictions about BH cores, since no information about the inside of a BH can ever cross over the event horizon.
all our attempts at reconciling quantum and gravity fail, so hopefully by the time we figure it out we'll be a few paradigms further down the road and perhaps we'll know something that will allow confirmation
But if the BH core is a mathematical singularity, as predicted by pure non-quantum GR, then it's still not an easy thing to think about. The singularity is never in the past of any observer, even one who's fallen into the BH, heading towards the singularity.
Also, it's not like a point in space, more like a point missing from space. If you made a map of a BH, the singularity is not like a blank region on the map, with the words "there be dragons". It's like there's a hole in that section of the map
@AndrasDeak Well hopefully we'll have various other observations to help confirm quantum gravity, that'll give us some confidence that it works correctly in regimes where we can't make direct observations, like inside BHs, or the instant of the Big Bang. But even doing those other observations will be technically challenging, eg up close observations of extreme gravity situations like neutron stars and BH accretion discs.
@Dair We do that, from time to time, especially during off-peak times, if there aren't Python discussions going on. We also occasionally have discussions about other topics, like food and music.
@ReblochonMasque My company pays for an IntelliJ Ultimate License for me. It has a plugin available for Python that basically has the features of PyCharm. There's some differences in the UI, but afaik, it's otherwise the same.
@ReblochonMasque Why did I bother? I decided to help Code-Apprentice understand whether it was/wasn't on-topic on Python (vs R, or replicability), and help them ask their questions better in a way that gets answers, since they weren't getting answers. I see lots of conversations here that do not interest me in the least. Moving it to another room would prevent any future new users finding it. I wouldn't have bothered continuing unless I thought there was something in it some new users would appreciate.
Weird, I wouldn't expect most users wanting to translate R to python. Same as if I helped someone translate MATLAB to python I wouldn't expect that to interest anybody else.
Like every couple of months, I'm once again considering to learn how to properly package and publish some of my stuff. But only if it's not too much effort. So, can someone tell give me a TL;DR of what releasing a first/new version of a module entails? Is it as easy as incrementing the version number and pushing to master, or is there other stuff that needs to be done (like building wheels or something)?
requirements.txt is outdated and should never have been used as means to document package requirements in the first place. pyproject.toml is a new general packaging config that is neat, but not well supported. Not for pip install from github anyway, so it's not that interesting yet
@smci True, moving the discussion to another room would make it harder to find... unless you put some useful keywords and phrases here, with the link to your room. On the plus side, it means the transcript of your conversation isn't interrupted by other chitchat.
@PM2Ring I will not bother responding to users like that unless it's perceived to be of general use (e.g. to future new users, how to ask a question to get responses, etc.); so I wouldn't bother having that conversation in a private room. None of the rest of you here or elsewhere on SO responded to the user's questions. (I reasked on their behalf in the main R room 'GMTs' and that finally got a response: chat.stackoverflow.com/transcript/message/47489078#47489078)
it's not that complex to make a package installable. there is only two pitfalls, really: 1) tweaking your project to still work properly if you are trying to do something strange, and 2) knowing what setuptools considers to be "strange"
aha! those are metadata, so you need to read them in the setup.py and include them in the setuptools.setup call under license and description_long, respectively
I was talking about things like config files next to your code files. those don't get picked up automatically
@AndrasDeak I wasn't speaking to you, and anyway that's irrelevant to what's being discussed (whether I should have engaged with the user, in this room).
Apologies, I thought "None of the rest of you here or elsewhere on SO responded to the user's questions." was somehow a commentary on something the rest of us here did or didn't do
it looked differently when I started but even then I only found chat via a user's profile
@roganjosh for posterity
@smci in any case you did well for engaging the user, we were only talking about whether at one point you could've went to a dedicated chatroom for the problem
@AndrasDeak assuming that with "package manager" you mean the human kind, the long_description is what pipy renders when you search for the package via a browser, so it's only useful if you upload it it to an index. The license.. I think if code isn't bundled with a license, the default is "private", which means that you can't use it commercially or in open source. So if you want your code to be used, you should add one.
@Arne "upload it to an index" is what I meant for the former, thanks. And the license is still valid if it's just sitting there in the project under LICENSE, right? So that also means "yes", probably
so the packaging howto tells me to put the license description manually in classifiers rather than using LICENSE somehow, but I suspect the latter is relevant when there's a custom license
I think it's nice if the code knows which version it has, but opinions differ. I definitely also saw project that only have a version hardcoded in the setup.py directly
I'm getting pretty confused with Big O in this. 2357122 already told me it's O(1) and like yam am I going to dispute that, but it goes against all my senses. Is there even value in Big O evaluation in this case?
the answerer changed the problem and added a parameter
The original question had for j in range(3) for k in range(4) which could imply one or two different parameters. It could be O(f(n)) or O(f(n,m)), respectively, and until OP edits to something that has any kind of asymptotics it won't be answerable. We can guess, but we don't have to.
@Aran-Fey I moved to poetry for all my private projects, packaging is a little different then. the main idea is that it's risky to actually import your own code during built time, because it isn't installed at that point. so to stay safe, instead of doing version = mypackage.version I do exec(open('mypackage/VERSION.py').read()), with the content in VERSION.py being exactly version = "0.1.0"
oh, that's actually understandable. The default value for that parameter is actually inspect.Parameter.empty. Shouldn't be surprised that that causes problems
if my reasoning sounds vague, that's because it is. I just remember burning myself a bunch of time some months ago, and deciding to never again try to import my source code during build time. It's very likely that you're smarter than me and just avoid the things that tripped me
Ok, I see. I don't think not being installed will be a problem for any of my modules, so for the time being I'll leave it as it is
user6568562
22:16
@roganjosh I feel this question is some kind of exercise at the end of a Big-O Notation chapter with an aim to hammer down the point that the N is related to the size/nature of the input, not constants/fixed operations