new interpolation scheme

Edit: Rendered version here
I've added an interpolation function in this pull request https://github.com/stan-dev/math/pull/1814
@bbbales2 alerted me to the need for this sort of interpolation, but there are lots of judgement calls on the way in terms of algorithm and implementation.
@bgoodri mentioned that there might be some relevant interpolation schemes in upcoming Boost releases.
@bob-carpenter has commented on other interpolation issues and discourse discussions in the past.

@bgoodri @wds15
@bbbales2 and I were hoping to get your thoughts on an interpolation algorithm for which I just made a pull request here https://github.com/stan-dev/math/pull/1814.
@bbbales2 mentioned that the need for interpolation has come up in a few places in math issues and discourse discussions. Ben and I chatted about what would make sense. We settled on what's basically linear interpolation with some Gaussian smoothing (and shifting so that the interpolated points intersect the reference points). As a bonus, the interpolated function and its derivative are basically analytic.
Here's a simple example of how that looks:

Haven't looked at it but there is all kinds of stuff in Boost
https://www.boost.org/doc/libs/1_72_0/libs/math/doc/html/interpolation.html
On Fri, Apr 3, 2020 at 4:31 PM pgree<EMAIL_ADDRESS>wrote:

@bgoodri https://github.com/bgoodri @wds15 https://github.com/wds15
@bbbales2 https://github.com/bbbales2 and I were hoping to get your
thoughts on an interpolation algorithm for which I just made a pull request
here stan-dev/math#1814 https://github.com/stan-dev/math/pull/1814.
@bbbales2 https://github.com/bbbales2 mentioned that the need for
interpolation has come up in a few places in math issues and discourse
discussions. Ben and I chatted about what would make sense. We settled on
what's basically linear interpolation with some Gaussian smoothing (and
shifting so that the interpolated points intersect the reference points).
As a bonus, the interpolated function and its derivative are basically
analytic.
Here's a simple example of how that looks:
[image: Screen Shot 2020-04-03 at 4 20 50 PM]
https://user-images.githubusercontent.com/61166344/78401747-6fa13900-75c7-11ea-8c83-214f3de2fc95.png
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/stan-dev/design-docs/pull/18#issuecomment-608644551,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAZ2XKQIN2G5Z2BPR2M5GPDRKZBTJANCNFSM4LZBH4AQ
.

@betanalpha may also have useful input.  At some point, you wind up building spline models and then GPs.  So the question in my mind is how elaborate to make a simple interpolation function.
For comparison, here's the interpolation function in BUGS and JAGS:
interp.lin(u, xs, ys) = ys[n] + p * (ys[n+1] - ys[n])
where

u is a scalar,
xs and ys are the same size vectors,
xs is sorted in ascending order,
xs[n] <= u < xs[n + 1], and
p = (u - xs[n]) / (x[n + 1] - x[n]).

So it's not differentiable at points in xs, nor is it defined outside of (xs[1], xs[N]) where N = size(xs).
So the question is what the extra smoothness is going to buy us on the algorithm side?

At the very least, I'd extend to f(x) = f(x_1) below the minimum value and f(x) = f(x_N) above the maximum value (or, if we go with some smoother curve, an equivalent sort of extrapolation).  I don't want to overthink this one:  an extrapolation is just an extrapolation; it generally won't be right and we don't want to pretend otherwise.  But a null extrapolation can come in handy.  It comes up from time to time, and it's always a pain to do this extension "manually."

On Apr 3, 2020, at 5:09 PM, Bob Carpenter<EMAIL_ADDRESS>wrote:
@betanalpha https://github.com/betanalpha may also have useful input. At some point, you wind up building spline models and then GPs. So the question in my mind is how elaborate to make a simple interpolation function.
For comparison, here's the interpolation function in BUGS and JAGS:
interp.lin(u, xs, ys) = ys[n] + p * (ys[n+1] - ys[n])
where
u is a scalar,
xs and ys are the same size vectors,
xs is sorted in ascending order,
xs[n] <= u < xs[n + 1], and
p = (u - xs[n]) / (x[n + 1] - x[n]).
So it's not differentiable at points in xs, nor is it defined outside of (xs[1], xs[N]) where N = size(xs).
So the question is what the extra smoothness is going to buy us on the algorithm side?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub https://github.com/stan-dev/design-docs/pull/18#issuecomment-608667453, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZYCUM2H2DNIFXJVFBILATRKZGBXANCNFSM4LZBH4AQ.

“Yes-anding” Bob’s comment I do not think that any deterministic interpolation scheme
is a good idea for Stan because there is no unique way to interpolate and interpolation
as a deterministic process is ill-posed.  Interpolation is fundamentally an inference problem
— we have finite data and maybe some constraints like smoothness implicit coded in
the interpolation model.  There will always be an infinite number of ways to satisfy these
constraints and so reporting just one will always be underestimating the uncertainty
inherent to the problem.  Giving users access to a single interpolator within the Stan
language will just give them easy ways to build bad models.
Were interpolation this easy people would spend their careers on splines and GPs
which are nothing but interpolation with uncertainty!

On Apr 3, 2020, at 5:09 PM, Bob Carpenter<EMAIL_ADDRESS>wrote:
@betanalpha https://github.com/betanalpha may also have useful input. At some point, you wind up building spline models and then GPs. So the question in my mind is how elaborate to make a simple interpolation function.
For comparison, here's the interpolation function in BUGS and JAGS:
interp.lin(u, xs, ys) = ys[n] + p * (ys[n+1] - ys[n])
where
u is a scalar,
xs and ys are the same size vectors,
xs is sorted in ascending order,
xs[n] <= u < xs[n + 1], and
p = (u - xs[n]) / (x[n + 1] - x[n]).
So it's not differentiable at points in xs, nor is it defined outside of (xs[1], xs[N]) where N = size(xs).
So the question is what the extra smoothness is going to buy us on the algorithm side?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/stan-dev/design-docs/pull/18#issuecomment-608667453, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALU3FTHY7A2X6W7RGCLEPTRKZGBXANCNFSM4LZBH4AQ.

@betanalpha --- I wasn't trying to say this was a bad idea.   I think for any tool we provide it's easy to say that something more sophisticated should be used.
So my question was really (a) do we just do simple interpolation and leave the data points non-differentiable, or (b) do we do something like this?

Thanks for all the comments. We decided to implement a scheme in which the interpolated function is differentiable based on several comments/requests on discourse and github:
https://discourse.mc-stan.org/t/linear-interpolation-and-searchsorted-in-stan/13318/1
https://discourse.mc-stan.org/t/vectors-arrays-interpolation-other-things/10253/17
https://github.com/stan-dev/stan/issues/1165
https://github.com/stan-dev/stan/issues/1214
https://github.com/stan-dev/math/issues/58
@avehtari might also be interested as he has commented in discourse on interpolation.

Edit: Also, I understand the part about uncertainty, but we also do this all the time. A linear regression is deterministic and an ODE's just a fancier version of a deterministic interpolation subject to some side conditions. We can put errors on top of this if we need to. But I do agree it's hard to imagine a generative model where this is something you'd use. I suspect that's why it's not already in Stan.

Right.  To me interpolation is a 100% a modeling problem, not something that can be solved with a new function.  The ambiguity of possible interpolation schemes just reinforces the fact that this isn't something that can be solved deterministically.  We already have a wide range of possible interpolation models, including GPs and splines, so what does this offer other than making it easy for users to ignore the inferential need?

It's great to see progress in this regard. I do think that we really need something like this. While I agree in that interpolation is an inference problem in many cases, there are a good deal of applications where we condition on some input function - for example on the dosing history in PK/PD problems.
I would welcome if we would have interpolation functions of varying complexity. Simple first:

last observation carry forward (constant between successive values)
linear interpolation
something smoothed as you are suggesting

While I would appreciate all of them being done at once, I don't want to put this on you (unless you want to). However, please make a proposal as to how such functions would like consistently. We would like to have a common and meaningful syntax for them.
Now, for the smoothing flavours, I would find it important to give users control over (easy) tuning parameters for the smoothness. It's hard for me to see that the smoothing is universally correct for every application.
As I would attempt to use this type of functions as forcing functions to ODEs, I would very much appreciate that these functions are fast. Hearing that you call an error function does not sound like it is very fast. Recall that for ODE solvers this function will get called many times. Maybe requiring sorted inputs and all that will also help you to speed up things?
Now, for the documentation of all of this, it would be great if you could advise users as to how they can minimise the amount of data needed to pass into the interpolation function while maintaining good accuracy in representing the to-be approximated function.
I hope this helps; please let me know if some points are not clear enough.
(for PK/PD problems in particular it would be awesome to super-impose a series of exponentials directly... just to spark your creativity...)

So the question is what the extra smoothness is going to buy us on the algorithm side?

I think HMC requires one derivative for the stats math to work. Leapfrog integrator takes two derivatives to keep its second order error (which I assume is important cuz there's a pretty big difference between first and second order methods).
Given we control what goes in, I would like to keep both of those derivatives.

At some point, you wind up building spline models and then GPs

I don't think that's always true even in a statistics sense. Sometimes you'd do some sorta random process, and sometimes you'd just give up and fit a line.

do we just do simple interpolation and leave the data points non-differentiable

In @bob-carpenter 's notation, I think the easiest is u is differentiable and xs and ys are data.

There will always be an infinite number of ways to satisfy these constraints and so reporting just one will always be underestimating the uncertainty inherent to the problem

This argument works for everything in the model. Why normal instead of something else, why logistic link, etc.

To me interpolation is a 100% a modeling problem

True, but I think it's like measurement error models -- everything could be a measurement error model but most of the time we just pretend a measurement 3.4 means 3.4000000000000... and roll with it. Same here -- something got fit or measured somewhere else and the knowledge is encoded as a lookup table, so just condition on that. We assuming ignoring this uncertainty isn't gonna hurt us. sqrt(5^2 + 12^2) = 13, etc.

Re: algorithms,

I don't like piecewise constant. Those discontinuities could really mess up the sampler. I could see how if this was a forcing function in an ODE the output could still be differentiable, but ODE solvers don't like those steps either.

People do piecewise linear now. I suspect they'd do cubic splines or whatever we gave them. I think interpolation is something people do out of convenience than anything.

I suspect if we required sorted inputs, we'd get bugs. Maybe if we checked every time we did a lookup for out-of-order things we'd catch errors, but it still seems finicky.

For N data points, linear/cubic interpolation would be O(N) algorithms if we checked sorting every time, and O(logn) without, so the second seems attractive, but it is nice to have functions that are super safe about stuff.
Doing GP interpolation and just taking the mean would require an O(N^3) solve in transformed data and then some O(N) dot product evaluations. The advantage there is that the sort isn't necessary and a a dot product is easier (though the complexity is the same).
If we vectorize these functions, the linear/cubic interpolations can amortize the order checks. The GP complexity remains the same. In the ODE use case though we don't get to vectorize though.
I guess what's the complexity of the algorithm in https://github.com/stan-dev/math/pull/1814 ?

People do piecewise linear now. I suspect they'd do cubic splines or whatever we gave them.

I agree.  I think it just comes down to efficiency in the HMC context.

I think the easiest is u is differentiable and xs and ys are data

We should make everything differentiable if it's just an ordinary Stan program.

I suspect if we required sorted inputs, we'd get bugs.

That matches what BUGS did.  Without the sorting, we have to walk over the entire input array instead of using binary search.  And if we allowed a vector of prediction inputs we'd want to do the sorting for efficiency internally.

I think HMC requires one derivative for the stats math to work.

Because of broken reversibility?  The thing is that the curve around the interpolated points has to big enough to matter because otherwise it's going to work just like having a non-differentiable point in terms of divergence.

We should make everything differentiable if it's just an ordinary Stan program.

I will look into this. Right now, the codes only provide derivatives of f(t) with respect to t where f is the interpolated function.

I would find it important to give users control over (easy) tuning parameters for the smoothness

We can include an input in the interpolation function that corresponds to how much smoothing the user wants. For example, the input could be a number on the interval [0, 1] where 0 corresponds to linear interpolation and 1 is a very smooth interpolation. Do you think that would be enough user control over smoothing?

I would very much appreciate that these functions are fast. Hearing that you call an error function does not sound like it is very fast

It shouldn't be a problem to speed up the evaluation of the error function if it's not fast right now.

it would be great if you could advise users as to how they can minimise the amount of data needed to pass into the interpolation function while maintaining good accuracy

Sounds good, will do.

I guess what's the complexity of the algorithm in stan-dev/math#1814 ?

Under reasonable conditions, it's O(n + k*log(n)) where n is the number of points in the function tabulation and k is the length of the sorted vector of points at which the user wants to evaluate the interpolated function. How big do you reasonably expect k and n to be in practice? The constant could dominate for small k and n.

I don't quite see as to why everything must be differentiable - as long as things are data everything is fine.
Things which can be cast to a var aka a parameter should always stay differentiable, of course.
Yet, we do condition in our models on the covariates "X" most of the time without modelling this space.
In that sense last observation carry forward or linear interpolation are fine ways of interpolating to me at least.

For example, the input could be a number on the interval [0, 1] where 0 corresponds to linear interpolation and 1 is a very smooth interpolation. Do you think that would be enough user control over smoothing?

I know how to interpret 0 there, but I don't know how to interpret 1.
Somehow it needs to be possible for people to check what they're doing. expose_stan_functions is one way, but that's not available for cmdstan users.
If someone is putting an interpolation in their model, somewhere in their workflow they need to check if it's doing the right thing.

How big do you reasonably expect k and n to be in practice

Just making up numbers, I think the most common k would be 1, and n would be in the 10-100 range.

In that sense last observation carry forward or linear interpolation are fine ways of interpolating to me at least.

differentiability of u so it can be a parameter would be convenient. I don't think xs or ys are gonna be worth the effort (and it'd screw up performance of interpolating with a GP mean -- O(N^3) complexity even if it were possible).

I don't quite see as to why everything must be differentiable - as long as things are data everything is fine.

We could put data qualifiers in front of arguments.  But why do that if we don't have to?

Yet, we do condition in our models on the covariates "X" most of the time without modelling this space.

The point is just that if I write normal_lpdf(y | x * beta, sigma), any of y, x, beta, sigmacan be a variable.  It's just a mdoeling choice to use constantx`.  Same goes for our linear regression glm function.
It's no big deal if it's too hard to make these differentiable.  We just have to be very careful to document that with data qualifiers.

input could be a number on the interval [0, 1] where 0 corresponds to linear interpolation and 1 is a very smooth interpolation.

Did you mean smoothness or regularization?  Something like a Matern covariance matrix for a GP has a parameter that determines order of differentiability, which seems like a natural way to control smoothness in the differentiability sense.  But if you mean regularization, that's more like the kind of bandwidth control you get in kernel smoothers where the limit is something like a straight line.

Did you mean smoothness or regularization?

By smoothness I meant the size of the standard deviation in the Gaussian kernel in the convolution.

I know how to interpret 0 there, but I don't know how to interpret 1.

One idea is we could impose a maximum on the standard deviation in the kernel. For example, we could set the maximum standard deviation to be 1/3 the smallest distance between successive points. There are certainly issues that could come up with this approach, and it might not be very clear to the user what's happening without reading a lot of documentation.
Does anyone have thoughts on how to include a smoothness parameter that isn't confusing to the user? Or how important it is to have such a parameter?

For example, we could set the maximum standard deviation to be 1/3 the smallest distance between successive points.

This seems to be more attached to if the interpolation goes through all the data points or not? Would there be a way to write smoothness in terms of maximum error from any data point? That sounds like something that would have to be computed beforehand.

Does anyone have thoughts on how to include a smoothness parameter that isn't confusing to the user?

The options are (I'll annotate downsides, upsides as I understand them):

Piecewise constant - Not differentiable in a way that'd probably mess up NUTS if u was parameter. O(K logN) assuming inputs sorted

Piecewise linear - It's what people are using. Not differentiable in u. Fast. O(K logN) assuming inputs sorted.

Cubic spline - Has a derivative in u. Fast. Probably interpolates badly with non-uniform points. O(K logN) assuming inputs sorted

Boost interpolants - Probably has derivatives in u. Boost handles testing/maintenance. Seems to advertise working for periodic functions, non-uniformly spaced points, etc. Varies.

The Gaussian convolution thing - Has (lots of?) derivatives in u. Requires setting smoothing parameter. O(N + k logN)

Expectation of GP - Might have derivatives in u? I'm just assuming it does lol. Requires O(N^3) computation beforehand. Two smoothing parameters to set for RBF kernel. O(KN)

--
Other things:
It seems weird to talk about interpolation but not talk about error. I suspect the types of interpolations people are doing are writing down points off a plot in a paper and calling it a day.  I don't think people are doing interpolations that need to be accurate to 1e-8 though.
I don't think an interpolation utility in Stan is something for automatically interpolating a cloud of points. Like, I think we should design this to operate in the realm where we expect to go through all the points. Line going through a cloud of points is the more-statistics problem and we aren't really trying to solve that here.
Regarding @andrewgelman's comment about extrapolation

Do we handle that automatically in some way?

Do we accept xs at -inf and +inf?

Do we have a switch for this behavior?

I put in a vote for piecewise linear, at least as one of the options.    I also vote for extending x_1 at the low end and x_N at the high end.
For what it's worth, I was never seeing this interpolation thing as a data smoother or as a statistical model; to me, it's always just been a math function.  To put it another way, I was never thinking of using the interpolator as a model for "y"; I was always thinking about it as being for "x".
It's just something that comes up often enough in applications, for example we have data from a bunch of years and we're adjusting to the census, but we only have the census every 10 years.  A real model would be better, but as a researcher/modeler, I have to pick my battles!
I was never imagining the interpolator as something to fit to a cloud of points.  But who knows, maybe it's a good idea?  As in many cases, a generalization that may seem inappropriate can still be useful.
Andrew

On Apr 7, 2020, at 4:36 PM, Ben Bales<EMAIL_ADDRESS>wrote:
For example, we could set the maximum standard deviation to be 1/3 the smallest distance between successive points.
This seems to be more attached to if the interpolation goes through all the data points or not? Would there be a way to write smoothness in terms of maximum error from any data point? That sounds like something that would have to be computed beforehand.
Does anyone have thoughts on how to include a smoothness parameter that isn't confusing to the user?
The options are (I'll annotate downsides, upsides as I understand them):
Piecewise constant - Not differentiable in a way that'd probably mess up NUTS if u was parameter. O(K logN) assuming inputs sorted
Piecewise linear - It's what people are using. Not differentiable in u. Fast. O(K logN) assuming inputs sorted.
Cubic spline - Has a derivative in u. Fast. Probably interpolates badly with non-uniform points. O(K logN) assuming inputs sorted
Boost interpolants - Probably has derivatives in u. Boost handles testing/maintenance. Seems to advertise working for periodic functions, non-uniformly spaced points, etc. Varies.
The Gaussian convolution thing - Has (lots of?) derivatives in u. Requires setting smoothing parameter. O(N + k logN)
Expectation of GP - Might have derivatives in u? I'm just assuming it does lol. Requires O(N^3) computation beforehand. Two smoothing parameters to set for RBF kernel. O(KN)
--
Other things:
It seems weird to talk about interpolation but not talk about error. I suspect the types of interpolations people are doing are writing down points off a plot in a paper and calling it a day. I don't think people are doing interpolations that need to be accurate to 1e-8 though.
I don't think an interpolation utility in Stan is something for automatically interpolating a cloud of points. Like, I think we should design this to operate in the realm where we expect to go through all the points. Line going through a cloud of points is the more-statistics problem and we aren't really trying to solve that here.
Regarding @andrewgelman https://github.com/andrewgelman's comment about extrapolation
Do we handle that automatically in some way?
Do we accept xs at -inf and +inf?
Do we have a switch for this behavior?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/stan-dev/design-docs/pull/18#issuecomment-610607485, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZYCUIWD6DDZFAUZVPHLQTRLOFFXANCNFSM4LZBH4AQ.

I don't think that's always true even in a statistics sense. Sometimes you'd do some sorta random process, and sometimes you'd just give up and fit a line.
This argument works for everything in the model. Why normal instead of something else, why logistic link, etc.

These are not correct analogies to the proposed interpolation.  In all of those cases one
is imposing assumptions to define a model pi(data | parameters) * pi(parameters) that
captures many possible configurations and then conditioning on the data to infer them.
Even the most degenerate limit, where there is only a single model configuration that
is indifferent to the observed data, is not comparable to the proposed interpolation.
The proposed interpolation rather uses the data to inform the structure of the model
itself before any inference is performed, implicitly introducing a form of empirical Bayes
that is fundamentally different to any purely generative model.

I think HMC requires one derivative for the stats math to work. Leapfrog integrator takes two derivatives to keep its second order error (which I assume is important cuz there's a pretty big difference between first and second order methods).
Because of broken reversibility? The thing is that the curve around the interpolated points has to big enough to matter because otherwise it's going to work just like having a non-differentiable point in terms of divergence.

Neither of these statements are true.  I find it incredibly frustrating when arguments
like this are based on speculation about the algorithms.
For all intents and purposes the interpolation would have to be smooth (infinite derivatives)
to avoid compromising shadow Hamiltonian systems and hence the scalability of symplectic
integrators.

Yet, we do condition in our models on the covariates "X" most of the time without modelling this space.

Because in regression one assumes that the distribution of the covariates is ignorable
if we only want to infer the conditional behavior of y given the observed covariates,
pi(y, x | theta) = pi(y | x, theta) * pi(x | theta) = pi(y | x, theta) * pi(x) \propto pi(y | x, theta).
In order to condition on unobserved covariates one has to model pi(x) as it is no longer
ignorable.  Imposing a fixed interpolation presumes a delta function around some particular
interpolation while a data-dependent interpolation implicitly introduces empirical Bayes.

I've updated the Guide-Level Explanation section of the design doc here with a couple of Stan code snippets showing possible implementations of linear interpolation and smooth interpolation.
@andrewgelman for the linear interpolation we will extend x_1 at the low end and x_N at the high end
@wds15 - the example I just added to the design doc uses interpolation in the context of ODE solves, so I would be curious to get your thoughts on this. I haven't included in this version a couple of features you mentioned above including the tuning parameter for smoothness.

I'm not a fan of this Gaussian convolution scheme which seems too complicated. I don't think users want to fiddle with a smoothing parameter.
While piecewise linear interpolation is very attractive due to its simplicity it has the disadvantage that it interacts poorly with Stan's gradient-based algorithms.
As an alternative, here's an efficient and easy to understand scheme that can have as many derivatives as needed.
The green curve interpolates the black dots:

It's constructed as follows:
Any three consecutive points define a second degree polynomial. These form the quadratic envelope. The interpolant is weighted average of the two quadratics where the weight depends on the relative distance to the points the quadratics are centered on. In the above picture the weight function is simply
w(t) = 1 - t

The weight function could be any strictly decreasing smooth function with w(0)=1 and w(1)=0.
If the first N derivatives of the weight function vanish at both endpoints then the resulting interpolant has N+1 continuous derivatives. So the above choice gives a piecewise cubic polynomial interpolant that has one continuous derivative. It is basically cubic Hermite interpolation.
Trying to increase the differentiability naturally leads one to consider the weight function
w(t) = 1 - 3t^2 + 2t^3

which gives a piecewise quintic polynomial with two continuous derivatives.
Finally, going all the way to infinitely-differentiable, one option is
w(t) = 1/(1 + exp(1/(1-t) - 1/t))

Regardless of the weight function, the quadratic envelope restricts the interpolant to behave in a somewhat predictable fashion. The interpolant depends only on the four nearest points and if they are collinear (or on the same parabola) the line (or parabola) is recovered exactly. It can still oscillate when the distances between data points are very uneven. Still, one can probably control the oscillations by adding a few more points, perhaps using some interpolation available outside of Stan.

Smooth interpolation of the black points, optionally augmented with red dots to remove excessive bumps.
BONUS:
So, I was curious just how much smoothness does HMC require. I did a simplistic numerical experiment to measure the energy nonconservation which is a proxy for how much the Metropolis acceptance probability drops every time the integrator walks over a discontinuity.
The idea is to use the leapfrog integrator to simulate a 1D particle hitting a barrier of constant force and observe its energy after it bounces back.
The potential energy is interpolated using the various alternatives described in this post. No Gaussian convolution though because my attempted Python implementation had too many bugs.
For comparison there's also the analytic function log1p_exp(2x)/2 which does not go through the points but creates a similar corner in the potential.

Cubic, quintic, and smooth are prety much indistinguishable in the upper plot. Their derivatives in the lower plot are still distinct.
The particle has mass 10 and incoming momentum 10 so speed is 1 and the distance traveled per timestep before hitting the barrier is numerically equal to step size. It has enough kinetic energy to move past the interpolated corner deep into the constant-force region where it finally slows and turns around. The kinetic energy is observed again after it has left the barrier.
Here's the plot of the energy difference as a function of the integrator's stepsize.

With a large stepsize the particle simply skips over the corner region and every potential looks the same.
Below the critical stepsize of about 0.2 the motion in the analytic potential is fully controlled by a shadow Hamiltonian and only floating point errors contribute to energy noncoservation. Smaller stepsize requires taking more steps and consequently more floating point errors.
The plot seems to suggest that a discontinuity in nth derivative causes energy error of size O(e^n).

@nhuurre, excellent illustration!

Thanks a lot for the ODE example - this is exactly what I would like to be doing.
Some thoughts from my end here: We should settle on a system how we name these functions and what the argument structure should look like. My preference would be to with something like
interpolate_algo(x, x-data, y-data, ... morge arguments ....)
Feel free to modify - but please lay out a system like this which will be make it possible to add in the future in the same logic another algorithm. We will definitely extend in the future interpolation schemes as there are many available.
What I would encourage in doing is to force the x-data, y-data and the tuning parameters of the algorithm to be data in Stan. This decision should be documented in the design doc. Deviations from it should be done cautiously, I think.
Another consideration I would like to see at least discussed, is the need for ordering of the x-space. I would require an ordering of the x-data to ensure that you can do things like binary search (another input could be x-deltas and a x0 while enforcing positive x-deltas, but maybe that's confusing).
While I agree in that we should not provide foot guns to our users, we should still be open to simple things. After all we also provide a max function to users, so that I don't think that it is needed to put linear interpolation schemes of the table here.
@nhuurre Your suggested interpolation scheme looks very nice. I feel very much reminded of my physics courses years back. Nice.

@nhuurre - thanks for the numerical experiments and the interpolation scheme. One environment in which the Gaussian-smoothed interpolation can come in handy is when you have a smooth function tabulated at enough points such that in between points, the function is well-approximated by a line. Using quadratics/cubics can lead to undesired behavior in between points, like bumps.

Feel free to modify - but please lay out a system like this which will be make it possible to add in the future in the same logic another algorithm.

Good idea, will do.

What I would encourage in doing is to force the x-data, y-data and the tuning parameters of the algorithm to be data in Stan.

Another consideration I would like to see at least discussed, is the need for ordering of the x-space. I would require an ordering of the x-data

These both sound good to me.

@nhuurre quadratic envelope in tidyverse
library(tidyverse)
dat <- tibble(
  x=c(1, 2, 3, 4),
  y=c(0.5, 0.8, 0.15, 0.72),
  i=x)

dat_i <- tibble(x_pred=runif(50, min(dat$x), max(dat$x)),
                y_pred=NA_real_,
                i=x_pred)

d <- dat %>%
  mutate(xs=pmap(list(lag(x), x, lead(x)), c),
         ys=pmap(list(lag(y), y, lead(y)), c),
         xsm=map(xs, ~outer(.x, seq(0,2), `^`))) %>%
  head(-1) %>% tail(-1) %>%
  mutate(v=map2(xsm, ys, ~solve(.x, .y))) %>%
  select(x, v)

w <- function(t)
  1/(1 + exp(1/(1-t) - 1/t))
  #1 - t
  #1 - 3*t^2 + 2*t^3

df1 <- bind_rows(dat, dat_i) %>%
  arrange(i) %>%
  mutate(prev_x=x) %>%
  fill(prev_x) %>%
  mutate(next_x=x) %>%
  fill(next_x, .direction="up") %>%
  mutate(t=(x_pred-prev_x)/(next_x-prev_x)) %>%
  left_join(d, by=c("prev_x"="x")) %>%
  rename(prev_v=v) %>%
  left_join(d, by=c("next_x"="x")) %>%
  rename(next_v=v) %>%
  mutate(prev_p=map2_dbl(x_pred, prev_v, ~sum(.x^seq(0,2)*.y)),
         next_p=map2_dbl(x_pred, next_v, ~sum(.x^seq(0,2)*.y))
         ) %>%
  mutate(w=w(t),
         y_pred=ifelse(prev_p>0&next_p>0, w*prev_p+(1-w)*next_p, NA_real_))

df1 %>%
ggplot()+
  geom_point(aes(x,y), size=3)+
  geom_point(aes(x_pred, y_pred), col="royalblue")+
  hrbrthemes::theme_ipsum_rc()

ggsave("quad_envelope.png", width = 7, height = 4)

Smooth interpolation in Stan
// this should be saved to "smooth_interpolation.stan"
functions{

vector get_quad_coeffs(vector x3, vector y3){
  matrix[3,3] xm = rep_matrix(1.0, 3, 3) ;
  for (i in 2:3)
    xm[,i] = xm[,i-1] .* x3;
  return xm \ y3;
  }

matrix grid_to_quad(vector xs, vector ys){
  int N = rows(ys);
  int M = N-1;
  matrix[N, 3] grdm =rep_matrix(not_a_number(), N, 3);
  vector[3] as;
  int idx[3];
  if (N<3) reject("data grid should have at least 3 rows. Found N=",N);
  for (i in 2:M){
    idx = {i-1, i, i+1};
    as = get_quad_coeffs(xs[idx], ys[idx]);
    grdm[i, ] = to_row_vector(as);
  }
  return grdm;
}

real get_w(real t){
  return 1/(1 + exp(1/(1-t) - 1/t));
 // return 1-t;
 // return 1 - 3*pow(t,2) + 2*pow(t,3);
}

real get_smooth(real x, vector xs, vector ys){
  int N =rows(xs);
  real t;
  real w;
  real res;
  matrix[N, 1] v;
  matrix[N,3] grdm = grid_to_quad(xs, ys);
  matrix[3,1] xp = [[1], [x], [x*x]];
  for (i in 1:N){
    if (x<=xs[i] && x>=xs[i-1]) {
      t = (x-xs[i-1])/(xs[i]-xs[i-1]);
      w = get_w(t);
      v = grdm * xp;
      res = w*v[i-1,1] + (1-w)*v[i,1];
    }
  }
  return res;
}

}

Now the R code to test
library(rstan)
library(tidyverse)

dat <- tibble(
  x=c(1, 2, 3, 4, 5),
  y=c(0.5, 0.8, 0.15, 0.72, 0.29))

expose_stan_functions("smooth_interpolation.stan")
dat_i <- tibble(x=seq(1.1, 4.9, by=0.092),
                y=sapply(x, get_smooth, dat$x, dat$y))

ggplot()+
  geom_point(data = dat, aes(x,y), size=3, color="red")+
  geom_point(data= dat_i, aes(x,y), color="black")+
  hrbrthemes::theme_ipsum_rc(grid_col = "grey90")


feature request MCP server tools, LM Studio integrations.

https://github.com/punkpeye/awesome-mcp-servers
https://lmstudio.ai/

Thanks for feature request. Need more info to understand detailed feature scopes. E.g., what's the expected behaviors to use AI Toolkit together with MCP / LM Studio.
And, are there two separated features?


No Zooming in or out by clicking 'Ctrl' + mouse wheel

Is there an existing issue for this?

[X] I have searched the existing issues
[X] I have read the guide to filing a bug

Steps to reproduce
I am trying to zoom in my web page but it is not getting zoomed in by clicking ctrl + mouse wheel but it works with ctrl + '-' or '+'
i created mobile app with flutter and then i run this code for web
Expected results
the page should get zoom in or out by clicking ctrl + mouse wheel
Actual results
it has no effect when i click ctrl + mouse wheel
Code sample
Code sample
[Paste your code here]

Screenshots or Video

Screenshots / Video demonstration
[Upload media here]

Logs
Logs
[Paste your logs here]

Flutter Doctor output
Doctor output
[Paste your output here]

Closing this as a duplicate of https://github.com/flutter/flutter/issues/129933


Tin Ore mining Steam consumption

Mod source
PyAE Beta
Which mod are you having an issue with?

[X] pyalienlife
[X] pyalternativeenergy
[X] pycoalprocessing
[X] pyfusionenergy
[X] pyhightech
[X] pyindustry
[X] pypetroleumhandling
[X] pypostprocessing
[X] pyrawores

Operating system

=Windows 10

What kind of issue is this?

[ ] Compatibility
[ ] Locale (names, descriptions, unknown keys)
[ ] Graphical
[ ] Crash
[ ] Progression
[X] Balance
[ ] Pypostprocessing failure
[ ] Other

What is the problem?
When mining Tin Ore, it still consumes 10 Steam per mining operation like in old pY, which does not factor in the fact that Boiler now only produces 7.5 Steam per second instead of 60. In the early game there is no other way of producing Steam so the solution is to either

Add some other way how to create Steam in the early game - maybe just some Steam with low temperature that cannot be used to generate electricity
Reduce the Steam required to mine Tin Ore

Steps to reproduce
No response
Additional context
In order to have 3 running Fluid Miners on Tin I burn 7.5 MW worth of coal at all times, which is ridiculous in the early game.
Log file
No response

Marking this as resolved. It has the non-issue tag.


Deprecated components are imported by other focus components

Current behaviour
The deprecated Buttton component is imported by non-deprecated components resulting in alot of warnings.
Below the "focus-component/message/index.js" imports the deprecated Button component:

Also, the deprecated "Label" component is imported by "focus-component/common/field/mixin/built-in-components", resulting in a warning each time a fieldFor is used.
I'll update the issue if I find any other deprecated import.
Expected behaviour
Focus components should import the non-deprecated component.

Versions
Focus-core: 0.15.1-beta0
Focus-components: 0.15.4

That's because this message component is also deprecated.
See https://github.com/KleeGroup/focus-components/blob/develop/src/components/message-center/index.js
It was mentioned in an earlier release note.
But your demand is ok. If you want propose a PR.

fixed in PR #1175

Fixed by #1187


az vm capture - needs option for downloading template

The old version of the CLI had a -t switch for downloading the template locally. This is really useful when you are quickly trying to capture and redeploy VMs. Without it, you need to query on the files in storage to get the URI for the template to use it to create a new VM.

@cynthn, CLI 2.0 usually doesn't provide the option to save file, rather we encourage users to use OS built-in piping. So for the capture, you can use > to write to any file you like. az vm capture -g mygroup -n myvm >deployTemplate.json

The thing is that the .json that gets outputted isn't as easy to use as it was in CLI 1.0. I could take the .json output and turn around and create a VM. You have to edit the .json output from 2.0 to include all of the required information for creating a new VM. You don't get prompts for VM name etc.

@cynthn, so you mean the template generated by 2.0 is difference from 1.0?
Regarding prompt for parameters, that is a known thing,  which we can track separately

The difference is the prompt for parameters. So, if that needs to be tracked separately, that works.

Opened #1778


Problem using the Push Bouncer behind a proxy

Hello everybody,
we recently updated to Zulip 2.0.6 and wanted to enable Mobile Notifications. It doesn't work though because our Zulip-server gets a timeout error when trying to send a request to the bouncer. The message reads as follows:

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/zulip/deployments/2019-10-18-06-39-10/zulip-py3-venv/lib/python3.6/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/home/zulip/deployments/2019-10-18-06-39-10/zulip-py3-venv/lib/python3.6/site-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/home/zulip/deployments/2019-10-18-06-39-10/zulip-py3-venv/lib/python3.6/site-packages/urllib3/util/retry.py", line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='push.zulipchat.com', port=443): Max retries exceeded with url: /api/v1/remotes/push/register (Caused by ConnectTimeoutError(<urllib3.connection.VerifiedHTTPSConnection object at 0x7f1703889ba8>, 'Connection to push.zulipchat.com timed out. (connect timeout=30)'))

We configured the proxy as environment variables for the user zulip (http_proxy, https_proxy, HTTP_PROXY and HTTPS_PROXY) but it just doesn't want to work. Can you help us?
Thanks in advance and greetings
Jan

@clk-jkn thanks for the report!  I think the problem is that you need those proxy environment variables to be set in the context of the supervisord job that runs the relevant part of Zulip.
What should work is changing this line in /etc/supervisord/conf.d/zulip.conf to change:
command=/home/zulip/deployments/current/manage.py process_queue
to e.g.
command=env HTTP_PROXY=x HTTPS_PROXY=x /home/zulip/deployments/current/manage.py process_queue
Where x is your HTTP proxy configuration.
(Depending on your RAM there may be more than one of these; you want the one that has missedmessage_mobile_notifications)
Can you check whether that works for you? That won't be our ultimate fix but it will be helpful to have the result of that test to confirm we understand the problem properly.

@timabbott thanks a lot for helping!
I modifed the following line:
command=/home/zulip/deployments/current/manage.py process_queue --multi_threaded deferred_work digest_emails email_mirror embed_links embedded_bots error_reports feedback_messages invites missedmessage_email_senders email_senders missedmessage_emails missedmessage_mobile_notifications outgoing_webhooks signups slow_queries user_activity user_activity_interval user_presence
to:
command=env HTTP_PROXY=http://x HTTPS_PROXY=x /home/zulip/deployments/current/manage.py process_queue --multi_threaded deferred_work digest_emails email_mirror embed_links embedded_bots error_reports feedback_messages invites missedmessage_email_senders email_senders missedmessage_emails missedmessage_mobile_notifications outgoing_webhooks signups slow_queries user_activity user_activity_interval user_presence
where x is our proxy IP. I tried it with and without protocol.
Then I restarted zulip. I am not getting Push Notifications still, but the timeout I recieved before (var/log/zulip/error.log) is gone. I only see a warning

WARN [zerver.lib.push_notifications] Maximum retries exceeded for trigger:10 event:push_notification

in the log file.
So here is what else I did:

Edit settings.py and uncomment PUSH_NOTIFICATION_BOUNCER_URL and PUSH_NOTIFICATION_REDACT_CONTENT
Execute su zulip -c '/home/zulip/deployments/current/manage.py register_server'
Restart zulip

In the file "/etc/supervisor/conf.d/zulip.conf" I have the following 'command=' lines apart from the one mentioned above:
command=/home/zulip/deployments/current/zulip-current-venv/bin/uwsgi --ini /etc/zulip/uwsgi.ini
command=env PYTHONUNBUFFERED=1 /home/zulip/deployments/current/manage.py runtornado <IP_ADDRESS>:9993
command=/home/zulip/deployments/current/manage.py deliver_email
command=/home/zulip/deployments/current/manage.py deliver_scheduled_messages
command=/home/zulip/deployments/current/manage.py process_queue --queue_name=message_sender --worker_num=%(process_num)s
We set the proxy variables in '/etc/environment' and strangely enough to the exact same values in a bash script in '/etc/profile.d/'. One of the two should have been enough already, don't know why both where configured.
Am I missing something obvious? Once again thanks for the help!

Just to be clear, did you replace the x with your actual proxy values?  x was meant to be a standin here for the appropriate values of those variables.
The push notifications are sent from the queue worker I mentioned, so that's what you need to update.

Yes. I replaced it with the IP-Address of our proxy (192.168.x.x, just replaced it by x because I thought it didn't matter). Our server can reach the proxy just fine, as it can update through the proxy just fine.
I will try changing the line
command=/home/zulip/deployments/current/manage.py process_queue --queue_name=message_sender --worker_num=%(process_num)s
aswell, as changing the line with missedmessage_mobile_notifications didn't seem to work, even though the timeout message is gone!

So I just recieved the following email:
`Traceback (most recent call last):
File "/home/zulip/deployments/2019-10-18-06-39-10/zulip-py3-venv/lib/python3.6/site-packages/urllib3/connection.py", line 159, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File "/home/zulip/deployments/2019-10-18-06-39-10/zulip-py3-venv/lib/python3.6/site-packages/urllib3/util/connection.py", line 80, in create_connection
raise err
File "/home/zulip/deployments/2019-10-18-06-39-10/zulip-py3-venv/lib/python3.6/site-packages/urllib3/util/connection.py", line 70, in create_connection
sock.connect(sa)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/zulip/deployments/2019-10-18-06-39-10/zulip-py3-venv/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/home/zulip/deployments/2019-10-18-06-39-10/zulip-py3-venv/lib/python3.6/site-packages/urllib3/connectionpool.py", line 343, in _make_request
self._validate_conn(conn)
File "/home/zulip/deployments/2019-10-18-06-39-10/zulip-py3-venv/lib/python3.6/site-packages/urllib3/connectionpool.py", line 839, in _validate_conn
conn.connect()
File "/home/zulip/deployments/2019-10-18-06-39-10/zulip-py3-venv/lib/python3.6/site-packages/urllib3/connection.py", line 301, in connect
conn = self._new_conn()
File "/home/zulip/deployments/2019-10-18-06-39-10/zulip-py3-venv/lib/python3.6/site-packages/urllib3/connection.py", line 164, in _new_conn
(self.host, self.timeout))
urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.VerifiedHTTPSConnection object at 0x7f2c00dd5a20>, 'Connection to push.zulipchat.com timed out. (connect timeout=30)')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/zulip/deployments/2019-10-18-06-39-10/zulip-py3-venv/lib/python3.6/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/home/zulip/deployments/2019-10-18-06-39-10/zulip-py3-venv/lib/python3.6/site-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/home/zulip/deployments/2019-10-18-06-39-10/zulip-py3-venv/lib/python3.6/site-packages/urllib3/util/retry.py", line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='push.zulipchat.com', port=443): Max retries exceeded with url: /api/v1/remotes/push/register (Caused by ConnectTimeoutError(<urllib3.connection.VerifiedHTTPSConnection object at 0x7f2c00dd5a20>, 'Connection to push.zulipchat.com timed out. (connect timeout=30)'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/zulip/deployments/2019-10-18-06-39-10/zulip-py3-venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/zulip/deployments/2019-10-18-06-39-10/zulip-py3-venv/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
File "./zerver/lib/rest.py", line 143, in rest_dispatch
return target_function(request, **kwargs)
File "/home/zulip/deployments/2019-10-18-06-39-10/zulip-py3-venv/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
File "./zerver/decorator.py", line 624, in _wrapped_func_arguments
raise err
File "./zerver/decorator.py", line 617, in _wrapped_func_arguments
return target_view_func(request, profile, *args, **kwargs)
File "./zerver/decorator.py", line 853, in wrapped_func
return func(request, *args, **kwargs)
File "./zerver/decorator.py", line 456, in _wrapped_view_func
return view_func(request, *args, **kwargs)
File "./zerver/lib/request.py", line 220, in _wrapped_view_func
return view_func(request, *args, **kwargs)
File "./zerver/views/push_notifications.py", line 29, in add_apns_device_token
add_push_device_token(user_profile, token, PushDeviceToken.APNS, ios_app_id=appid)
File "./zerver/lib/push_notifications.py", line 384, in add_push_device_token
send_to_push_bouncer('POST', 'push/register', post_data)
File "./zerver/lib/remote_server.py", line 53, in send_to_push_bouncer
headers=headers)
File "/home/zulip/deployments/2019-10-18-06-39-10/zulip-py3-venv/lib/python3.6/site-packages/requests/api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "/home/zulip/deployments/2019-10-18-06-39-10/zulip-py3-venv/lib/python3.6/site-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/home/zulip/deployments/2019-10-18-06-39-10/zulip-py3-venv/lib/python3.6/site-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/home/zulip/deployments/2019-10-18-06-39-10/zulip-py3-venv/lib/python3.6/site-packages/requests/adapters.py", line 504, in send
raise ConnectTimeout(e, request=request)
requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='push.zulipchat.com', port=443): Max retries exceeded with url: /api/v1/remotes/push/register (Caused by ConnectTimeoutError(<urllib3.connection.VerifiedHTTPSConnection object at 0x7f2c00dd5a20>, 'Connection to push.zulipchat.com timed out. (connect timeout=30)'))
Deployed code:

ZULIP_VERSION: 2.0.6
version: 2.0.6

Request info:

path: /api/v1/users/me/apns_device_token
POST: {'token': ['[object Object]'], 'appid': ['org.zulip.Zulip']}
REMOTE_ADDR: "['<IP_ADDRESS>']"
QUERY_STRING: "['']"
SERVER_NAME: "['']"`

Seems like the timeout is infact not gone after changing the commandline. I will try what I mentioned in my previous message and see if that makes it any better.

Hello,
so I still haven't figured this out and am out of ideas... Does anyone still have an idea?
Thanks

can anybody solve this problem?

Sadly this Problem still exists.

Starting with Zulip 4.0, we now document how to configure an HTTP proxy for outgoing HTTP traffic from a Zulip instance in https://zulip.readthedocs.io/en/latest/production/deployment.html#using-an-outgoing-http-proxy.
@alexmv FYI.


add path modification to .bashrc

Hi all!
I recently installed rust for the first time on my Ubuntu 18.04 machine and noticed that $HOME/.cargo/bin gets added to the .profile and .bash_profile files but not .bashrc. This caused me a little bit of headache figuring out why new terminals couldn't find the cargo command. To fix this I've added .bashrc to the files that get updated with the new PATH when installing rustup. This action will only be performed if the .bashrc file exists and works exactly the same as #1179.
Thanks for taking a look!

@mstallmo Why add to .bashrc when it adds to .profile which will be sourced before .bashrc? There are a lot of other shells as well though.


Remove yarn.lock from auto-generated files list (follow-up)

This is a follow-up to #4445, which intended to make yarn.lock no longer be treated as an auto-generated file (to fix #4348), however only removed the tests rather than also the handling in generated.rb.
As of this PR, b36ea7a is now fully reverted.
Fixes #4348.

Thanks! This was my blunder... :sweat

Many thanks :-)

@Alhadis Hmmm, merging this whilst the release PR was pending has caused a bit of a complication WRT the versions and contents 😞  I'm going to need to get a bit creative to get this into v7.3.1

Sorry about that. :/ If I'd known that it wasn't possible to squeeze in last minute changes, I wouldn't have been so quick to merge.


Fix out of bounds table offset panic

So I have a TUI project I'm working on where I've supplied a method to filter out data from the Table widget, using a regex match. Whenever I do this I want to preserve the previous table state, so that the table can still scroll up or down relative to its previous position. For example, if just 1 entry were removed it would be preferable to preserve the offset instead of reset it to 0 and scroll down to the currently selected element. The issue this led to was an out-of-bounds index whenever the offset was greater than the length of the new data. The fix takes only 1 line: clamp the offset to the last index in the new list.

Thanks a lot for the detailed report. I've fixed this in #516  to add tests and fix it in List which had the same issue.


chore: remove react native elements from examples

Description
I've removed React Native Elements from the examples. This also removes a lot of other dependency bloat and should speed up development. As a benefit, the app looks much nicer.

Fantastic! Thank you.


http -> https

edited http into https for quering the OSM api ... hope this edit is enough, or still something missing?

Hello @MichaelVL , is there an easy way to see whether this tiny patch makes OSMfocus work again with recent OSM api?

Hi,
You will need to build the application and upload it to either a simulated or a real Android device to test it. This requires you have an Android development environment installed, but is otherwise not particularly complicated.

Hello, I can confirm this PR fixes the app.
I've created an unofficial repository based on Android Studio (and that includes this patch too):
https://github.com/fansanelli/osm-focus
I've published the repo just in case someone else wants to build it using Android Studio.
Francesco


KinematicBody2D yields unexpected outcomes when passing negated y value with zero as x component

Godot version:

e930fb9
OS/device including version:

Windows 8.1
Issue description:

KinematicBody2D.move_and_slide() breaks when I pass it a negated Vector2(0, positive_number) value. Recoil from shooting should move the character upwards when shooting downwards, but instead it moves the character downwards much more quickly than expected. All other 7 directions function as intended (including downwards diagonals).

Minimal reproduction project:

The movement/recoil code is in character.gd.
Charge/shoot with space, move/change directions with the arrow keys.
MoveAndSlideBugTestProject.zip

A more minimal example would be good, as it's hard to assess if the issue is with move_and_slide or your AnimationTree here (commenting out the last two lines of character.gd make that "downwards recoil" issue the same for all direction).

I was having an impossible time isolating the issue. all the numbers were coming back correct but the character was moving in the wrong direction. The peeps over at Godot Engine discord figured it out though. Turns out it was a silly mistake I made with colliders (forgot to change the bullet's collider layer). Thanks!


[API] API-ify Soul Cage so integration with other mods is easier.

Requested by @ProfessorProspector for https://github.com/TechReborn/TechReborn

well probably more for an addon but yes.

Preferably I could just extend a BaseCage and tell it when to handle the mob spawning. Something like canSpawn() and I could return true if it has enough energy and stuff.

Well I assume you would want to be able to modify speed as well

ah yes, that too. I also need to add a Nicolas Soul Cage that is super fast :P

I'm not sure how feasible doing it all through the API is. But I can move some checks into their own methods. So you'd extend TileEntityCage and override getCooldown() (to change spawn speed), getSpawnAmount() (to change amount of mobs spawned), and canSpawn() (if spawning is allowed).
http://paste.ubuntu.com/15623779/

Yeah, looks good.


Friendbot fund is 200 but account GET is 404

What version are you using?
"stellar-sdk": "^4.0.0"

What did you do?
Funded and then immediately attempted to GET an account.
http://tyler.link/z79z3k
You can replicate this issue here:
https://hack-stellar.now.sh/
Just click "Generate Keypair" and then "Fund Account".
Note it won't happen consistently, you may have to repeat the above sequence several times before you get your first 404.

What did you expect to see?
A successful 200 response for the account GET request
What did you see instead?
A 404. If the funding was successful you shouldn't get a 404 no matter how soon you make subsequent requests.

After some period of time does Horizon return 200 OK for the account? How long does it take?
Horizon ingests data from the network and there's no guarantee that it ingests the last ledger so fast that there is no period of time between the account existing and Horizon knowing it exists. Ideally this period of time is small but it is eventually consistent, not strongly consistent.

After some period of time does Horizon return 200 OK for the account? How long does it take?
Yes. Quick. Maybe ~1 second though I haven’t tested that specifically. My complaint is less that core and horizon aren’t in sync and more that friendbot should wait to respond until we’re sure a GET on that account will be 200. However I’m thinking now this is perhaps unnecessary as we’ll need to be building for these time gaps in every horizon POST, PATCH type call. No need to make an exception here.

I am curious though if we track the time gap and have any guarantee or even just average, max times that those gaps can be/have been. ~1 second is very different than ~30 seconds. Curious what affects that time and how susceptible it is to variation. Hard to build for inconsistency especially when a 404 could mean either doesn’t exist or just doesn’t exist yet... but it might... in a second or 3.

Thanks for the report. Yes, this seems important and I suspect the data source for /accounts/{id} is to blame. Previously this was read from the Core DB, now we use ingested data in horizon DB. This is happening because in txsub we check both sources: Core and Horizon DBs to check if tx was added to a ledger. It's possible that the latest ledger is still being ingested by Horizon thus 404. Unfortunately, we can't just remove Core DB check because some Horizon instances don't ingest failed transactions. I can see two fixed, long term and short term:

Long term fix is to always ingest all transactions (including failed). This may increase storage needs but failed transactions are essential for some components like fee stats or txsub.
To fix this before 1.0.0 we can skip Core DB check here:
https://github.com/stellar/go/blob/eb2ef0e9e1a6acba8218c7bd525c0f53a53dda8f/services/horizon/internal/txsub/results/db/main.go#L41-L57
if the Horizon instance is ingesting failed txs. This way txsub will keep quering Horizon DB until the latest ledger is ingested.

I agree with @bartekn's analysis. Doing fix 2 now to help some instances makes sense to me.
Before implementing the long term fix, we would need to assess the storage/query performance impact.

:+1: on including failed transactions by default. they're part of consensus and shouldn't be ignored

Quick fix ready: https://github.com/stellar/go/pull/2277

@tyvdh the fix has just been deployed to https://horizon-testnet.stellar.org/. Please check it out.

Can't get it to break so seems fixed! Very nice, thanks!

Great, thanks! Let's keep it open so we can continue working on the long term fix in the future.


[eslint-plugin-azure-sdk] Rule "@azure/azure-sdk/ts-no-namespaces" is redundant

There is already a rule in typescript-eslint for this purpose, so we don't need our own custom rule for it.
We can remove src/rules/ts-no-namespaces.ts from common/tools/eslint-plugin-azure-sdk and update the base config to use typescript-eslint/no-namespace instead. We'll need to make sure that the linter works with all packages afterwards (rush lint).
See the docs on the typescript-eslint repo.

Code pointers for those interested to contributing a fix to this issue:

Set up your dev env
ESLint Plugin source package

I have attempted to implement a fix for this issue in this PR: https://github.com/Azure/azure-sdk-for-js/pull/18676


go-swagger route can't handle Chinese characters properly

Problem statement
go-swagger will ignore swagger:route section when there is Chinese character in it.
Swagger specification
code to generate swagger.json
package swagger

// swagger:route GET /online get room list 中
//
// Lists pets filtered by some parameters.
//
// This will show all available pets by default.
// You can get the pets that are out of stock
//
//     Responses:
//       default: test
//
func getOnline() {}

result
{
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "schemes": [
    "http",
    "https"
  ],
  "swagger": "2.0",
  "info": {
    "title": "Ksweb API.",
    "version": "1.0.0"
  },
  "basePath": "/api",
  "paths": {},
  "definitions": {
...
// others

but if remove the '中' character in the go code, the swagger.json will have the router.
{
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "schemes": [
    "http",
    "https"
  ],
  "swagger": "2.0",
  "info": {
    "title": "Ksweb API.",
    "version": "1.0.0"
  },
  "basePath": "/api",
  "paths": {
    "/online": {
      "get": {
        "description": "This will show all available pets by default.\nYou can get the pets that are out of stock",
        "tags": [
          "get",
          "room"
        ],
        "summary": "Lists pets filtered by some parameters.",
        "operationId": "list",
        "responses": {
          "default": {
            "$ref": "#/responses/test"
          }
        }
      }
    }
  },
  "definitions": {
...
// abbreviate details

Steps to reproduce
swagger generate spec -o ./swagger.json -m
generate the swagger.json, ignore the model definition here.
Environment
swagger version: 0.10.0
go version: go.1.8.3 darwin/amd64
OS:   macOS 10.12.5

I am sorry that I am wrong. The problem remains and can be reproduction with which I mention, but the real problem is "operationId" can't be Chinese characters.
It's a problem but I think it is not important, so I choose to close this issue.


Suggestion: FCNPC_OnPluginError callback

I think its good idea if we have FCNPC_OnPluginError callback to track runtime/plugin errors... like other plugins such Streamer

What errors are you thinking about?

the errors that are print to the console log already
internal errors
user input validation
others ...

Regarding the errors that are currently print out to the console (with the [FCNPC] Error prefix), most of them are not 'runtime' errors, but errors that should be resolved when the script is being written. So that defeats the purpose of this new callback.
Regarding internal errors, the user doesn't really have much benefit with those. There is already a crashlog feature in place that users don't really know how to interpret, so adding another similar thing to that will only add to the confusion.
Regarding input validation, I can see this as the prime use for a feature like this. However, I'm honestly not that interested, since I haven't seen many people post on the forums with questions regarding why xyz didn't work. You can already detect if something went wrong with the natives based on the return values (e.g. FCNPC_Create returns INVALID_PLAYER_ID if it failed).

Plugin related errors, anything

I'm not interested in this feature. But you can make a PR.


The TFLite model is unable to run on GPU

why you want to run the tflite model on gpu?

@610265158 Because it is not fast enough on mobile phone. I am currently testing on Qualcomm 730 and it is running at about 20ms per face on CPU. It is problematic when there are many faces. Hopefully it can run faster on GPU. Ideally, <5 ms will be good.

tflite is not fast, bro.

Are MNN and NCNN fast on GPU? Or just faster on CPU?

The model structure is not so fast, you should tune the structure based on your device and your frame work.


Crashes when temp files are removed.

Hi.
i use emacs and flycheck and while i was doing a search i kept editing my file. And since i have flycheck enabled it generates a temporary file named "flycheck_XXXXXXXX". Because of this rak failed with the following exception
A worker in a parallel iteration (hyper or race) initiated here:
  in sub MAIN at /home/demanuel/.rakubrew/versions/moar-master/install/share/perl6/site/sources/1DB59DA63325592C0EB2D7F93BCB6EA641AF8111 (App::Rak) line 1357
  in block <unit> at /home/demanuel/.rakubrew/versions/moar-master/install/share/perl6/site/resources/732D462F1780FA65BC56EC589341A86285D15050 line 11
  in sub MAIN at /home/demanuel/.rakubrew/versions/moar-master/install/share/perl6/site/bin/rak line 3
  in block <unit> at /home/demanuel/.rakubrew/versions/moar-master/install/share/perl6/site/bin/rak line 1

Died at:
    Failed to open file /home/demanuel/github/C7-Technical-Test/src/test/sfr/failover/flycheck_test_exposure_manager.py: No such file or directory
      in sub MAIN at /home/demanuel/.rakubrew/versions/moar-master/install/share/perl6/site/sources/1DB59DA63325592C0EB2D7F93BCB6EA641AF8111 (App::Rak) line 1357
      in block <unit> at /home/demanuel/.rakubrew/versions/moar-master/install/share/perl6/site/resources/732D462F1780FA65BC56EC589341A86285D15050 line 11
      in sub MAIN at /home/demanuel/.rakubrew/versions/moar-master/install/share/perl6/site/bin/rak line 3
      in block <unit> at /home/demanuel/.rakubrew/versions/moar-master/install/share/perl6/site/bin/rak line 1

Unfortunately it's not possible to disable the writing of temp files ( https://github.com/flycheck/flycheck/issues/334 ). Is it possible to avoid this crash?

So, if I get this right, the problem is that when rak makes its list of files to check, it will crash if the file no longer exists by the time it will be checked.  Which, I guess, is a more general problem, but also very worthy of getting fixed :-)

So, if I get this right, the problem is that when rak makes its list of files to check, it will crash if the file no longer exists by the time it will be checked.

correct :-)

I have fixed this in my dev version.  I hope to be able to release that sometime during the weekend.

This should be fixed in the .97 version that was just uploaded.  So closing this issue.  Please re-open if it still exists!  Thanks!


Fix #75 where parseTM did not properly calculate fractional seconds.

Did a jsperf and on my machine this code is 4 times faster than the other way to fix it with padEnd.

Coverage increased (+0.1%) to 51.991% when pulling f9f93f1114e9cf054d537547666158a4eca40a28 on yagni:master into 4b0eae76c25550c4d50491b2c2cf4e4787e86d08 on cornerstonejs:master.


🐛 Operator precedence rules can break if expressions.

❌ doesn't compile:
let makeVerses = n => if n >= 0 then verse n :: makeVerses (n - 1) else []

✅ does compile:
let makeVerses = n => if n >= 0 then (verse n :: makeVerses (n - 1)) else []

Might be something to do with operator precedence of :: messing with the expression, might also be the function call verse n making the parser thing that else should follow that.

The following also compiles:
let makeVerses = n => if n >= 0 then verse n :: (makeVerses (n - 1)) else []


[master] remove firstboot from zipl after it has been executed

it is used to avoid the ignition setting again when restart VM
Signed-off-by: ylpan<EMAIL_ADDRESS>

lgtm
just some questions: what's the impact if not remove this? if something happened right after remove this first boot such as crash, what will happen?

it we don't remove it, the ignition file will be used to configure VM each time VM restart. In ocp env, it will cause the VM to get config (master/work) from api-int.XXX.XXX, even if it has already been set for the first time. For the worst, if all master VM down, it will never been able to restarted again since they can not get config anymore.


Nick: Watch tradersfind.com

Nick requests the watch of the watch_keyword tradersfind\.com. See the MS search here and the Stack Exchange search in text, in URLs, and in code.

tradersfind\.com has been seen in 1 true positive, 0 false positives, and 0 NAAs.

Approved by cigien in Charcoal HQ


docs(v2): Showcase the pnpm docs

Motivation
(Write your motivation here.)
Have you read the Contributing Guidelines on pull requests?
(Write your answer here.)
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!)
Related PRs
(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)

Thanks !
Cool to see i18n already used :)

Yes, you should really bump the version to 2. It works as well as 1.

great to know ;)  thanks for the feedback


Add district offices

This addresses #343 by making the following changes:

adds the legislators-district-offices.yaml file
documents the file and its fields in README.md
extends scripts/alternate_bulk_formats.py to produce corresponding JSON and CSV files
does validation of the district offices file using scripts/office_validator.py
modifies test/validate.py to do office validation (for TravisCI/CircleCI)

The helper script used to do geocoding is also included. The push to gh-pages should work as well, though I'm unable to test that.

Looks good to me. Thanks! Any other maintainers have thoughts?
I won't block a merge with these comments but just some data thoughts:

It's normally a little cleaner to omit fields that have empty values, i.e. drop lines entirely whose values are the empty string.
A more logical field order would make the data easier to read, e.g. id first, then all the address fields in the order they would appear on an envelope, then phone and fax, then longitude/latitude.

I like both of these ideas, made the changes and added (non-error) checks to the validation script. Lat/lon are included after address since they're geographical.

@tcarobruce Thanks for the change! That looks good.
It looks like the district office validation script is in fact creating some build errors:
https://travis-ci.org/unitedstates/congress-legislators/builds/292335968
Any thoughts on those errors?

Tim Murphy (M001151) resigned in the interim. I merged in the upstream change and removed his offices. Looks like it's working now!
Perhaps the office validator should suppress warnings when run under CI to make errors easier to find.

Perhaps the office validator should suppress warnings when run under CI to make errors easier to find.

Yeah, that does sound good -- it appeared to be a deluge of errors at a quick glance.
But not a blocker for this PR, IMO. @JoshData, this is good with me if it's good with you.

Looks good to me!

:tada:


Debugger UX should show stack for current thread instead of a treeview with all threads

Debugging any ASP.NET Core application using devkit (I turned off just my code as well), I see something like this:

Can we make it show the thread we're stepping show up there and not all threads? I don't know if that means have a thread switcher UX or another "multiple threads with stacks UX".
What options do we have?

Closing this.


Support sslMode and useSystemTrustStore for MariaDB

Choose a PR Template
Switch to "Preview" on this description then select one of the choices below.
Click here to open a PR for a Data Plane API.
Click here to open a PR for a Control Plane (ARM) API.

/azp run

/azp run


Replaced lodash dep with es5 filtering

Hi!
I've replaced the lodash "uniq" dependency from the project with a es5 filtering method, so it depends on "react-side-effect" only :)
Cheers!
Robin

I like it! This project's been a bit dormant since I left PactCoffee, looking to transfer ownership now so it can be maintained.

I can take the maintenance on me. We use this lib in one of our production apps, so it would be a good fit there 😀

Oh no I meant — transfer ownership to my own account so I can keep it maintained (rather than have it under my old employer's org)

Ah I've read it wrongly then, excusez moi

Made it into https://github.com/iest/react-body-classname/releases/tag/v1.1.0


UI Options panel should occupy 100% width of the client

Describe the bug
Currently the UIO panel is restricted to the width of the content area of the Guide site. It would be better to take advantage of the full width of the browser window if possible.
Originally filed as FLOE-513
To reproduce
Steps to reproduce the behavior:

Go to https://guide.inclusivedesign.ca/practices/collaborate
Expand the UI Options panel
Resize window past 80rem
Notice how UIO stays within the 80rem max.

Screenshots

Screenshot of UIO stuck within the 80rem width.
Additional context or notes
A solution would be to add a new parent container to docs-template-container and move UIO that new parent container.

Likely to be addressed with styling changes need for #54


Relax naming restraints of templates

Currently a valid names start with a letter, and only contain letters, numbers, or underscores (_).
Allow using numbers as start char and allow any dash (-). That allows using UUID as template name.

cc @Kartones


Handle exit code when calling resolve-import-conflicts

@mernst You don't think it's better like this in one script?

@mernst I am not a fan of the structured you proposed with calling another script, it creates too much dependencies between the scripts and too much calling around in my opinion. I looked at the script and made the return values explicit because it makes it easier to understand what we are trying to do here. For me in the current way it is a lot more intuitive.
I have a problem with gitmerge_resolve.sh, the scripts only seems to remove some conflict markers but the exit statement seems to preserve the old return value so in the end it will still be marked as a merge failure, thus this script is not really doing anything since it won't be tested due to merge conflict. I am not 100% sure what the desired behavior is here.
That is why I think making the return values explicit is important.

I was trying to leave AST-Merging-Evaluation functionality (like printing "Conflict" and running merge commit --abort out of resolve-import-conflicts which is independently useful and exists at https://github.com/plume-lib/git-scripts.  We might eventually want to use the version from there.  In the meanwhile, see https://github.com/benedikt-schesch/AST-Merging-Evaluation/pull/218, which is a better alternative to this pull request.

#218 Is better


MDD - AS. Shortcuts.

PR Checklist
Please check if your PR fulfills the following requirements:

Carbon Requirements

[ ] Select Dracula Theme

[ ] Select right programming language

[ ] Set largest font size

Commit requirements

[ ] Image should be added to root

[ ] Naming should be short description of tip

Appearance can be more legible, shortcuts looks nested.
Less used shortcuts can be deleted (Exp: Open file)
Shortcuts should be added for Mac Os keyboard.


Fix the SELECT diagram

It's messed up.
@knz, could we work together on this? Or can you suggest someone who can help? It's been difficult for me to massage the 2.0 grammar into a single intelligible diagram.

yes I think I understand what's wrong. please put a little spot in my calendar for today we can have a look.

(30mn)


ci(testing-pr.yaml): skip UI generation errors to not block other tests

Description
Skip UI build generation errors in the meantime
related #332

:tada: This PR is included in version 1.8.2 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:


postgresql: fix build on darwin

This fixes the build of postgresql on OS X as reported by @jwiegley.
Tested on both NixOS en OS X.
@edolstra this also needs to be cherry picked on release-16.09.

I thought this was already fixed.

@LnL7 thanks for the tip. I pushed a correction.

@LnL7 thanks for the merge. Could you also cherry pick this on release-16.09 please because that also contains the darwin bug?

I'm not sure if changes like this are usually backported to nixos release branches.

@LnL7 note that @edolstra cherry picked my postgresql-9.6 patch (which introduced the darwin error) on release-16.09. So the fix should also be cherry picked on that branch.


Added UTM links

This task is in regards to the Communication team:

UTM links were added in terms of tracking.

Best regards,
Nam Bui

 Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.You have signed the CLA already but the status is still pending? Let us recheck it.


Line spacing breaks when changing the font size.

Hello,
Thanks a lot for this awesome theme. I like it a lot. But I am facing an issue. When I change the font size, the line spacing breaks and it gets all jumbled up. The issue is especially prominent in the header sections.
This is the editor view

And here is the preview

And this is what happens if I increase the fonts

That's not good! I'll check it out.
On Fri, May 21, 2021, 05:31 kaiwizz @.***> wrote:

Hello,
Thanks a lot for this awesome theme. I like it a lot. But I am facing an
issue. When I change the font size, the line spacing breaks and it gets all
jumbled up. The issue is especially prominent in the header sections.
This is the editor view
[image: image]
https://user-images.githubusercontent.com/17363383/119123708-a8150800-ba51-11eb-9110-c8826bfd4c3b.png
And here is the preview
[image: image]
https://user-images.githubusercontent.com/17363383/119123770-bc590500-ba51-11eb-935d-c5411cf48abe.png
And this is what happens if I increase the fonts
[image: image]
https://user-images.githubusercontent.com/17363383/119123880-de528780-ba51-11eb-8fd9-bd179297040d.png
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/kognise/obsidian-atom/issues/7, or unsubscribe
https://github.com/notifications/unsubscribe-auth/AKEVYGPJG7E4TT44XUFSEM3TOYZBXANCNFSM45I4GSPA
.

@kognise any update?

I'm reallllly sorry for the absurdly long wait, fixed by 4a6cd4ece4ea37493a068af95b6c592e8fcaaee6.


linux, voice not found

homebridge       | Error: SIOD ERROR: unbound variable : en1_mbrola
homebridge       |
homebridge       |     at Socket.child.stderr.once (/homebridge/node_modules/homebridge-alexa-hyundai/node_modules/say/platform/base.js:44:16)
homebridge       |     at Object.onceWrapper (events.js:277:13)
homebridge       |     at Socket.emit (events.js:189:13)
homebridge       |     at addChunk (_stream_readable.js:284:12)
homebridge       |     at readableAddChunk (_stream_readable.js:261:13)
homebridge       |     at Socket.Readable.push (_stream_readable.js:220:10)
homebridge       |     at Pipe.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)

should have done
voice_kal_diphone

not
kal_diphone


Tabsetpanel Layout Bug

Bug: Tabset panel does not layout anymore.
Reproduction: Open "ChartDemo", go into the 2. Tab. Shrink the window until mode "small". Pull the window bigger until the split panel is restored. Tabset is empty.
It seems one panel gets set to visible false, which means it does not layout, but the parent seems to wait on it. Must make a small reproduction example first.


feat: Table column calculation uses layout spacing ✨

This uses the new spacing feature of the Layout struct to allocate columns spacing in the Table widget.
This changes the behavior of the table column layout in the following ways:

Selection width is always allocated.

if a user does not want a selection width ever they should use HighlightSpacing::Never

Column spacing is prioritized over other constraints

if a user does not want column spacing, they should use Table::new(...).column_spacing(0)

Selection width is always allocated.

Does this make it breaking?

I don’t consider it breaking because previously what the solver did was unstable and not well defined. There is a change in behavior from what it mostly likely did to what it now will always do. I would be very surprised if a user was relying on this behavior because it would probably flicker a lot.
That said I’m happy to mark it as breaking so it stands out in the changelogs.

Ah, I think I misinterpreted what you were saying. You're saying that we allocate the space even if it's zero (due to being no selection). I thought you meant we always allocate the non-zero width event if there's no selection. Am I mistaken on that?

we allocate the space even if it's zero (due to being no selection)

Yes. Specifically, we allocate the space for the selection using
let [_selection_area, columns_area] =
    Rect::new(0, 0, max_width, 1).split(&Layout::horizontal([
        Constraint::Fixed(selection_width),
        Constraint::Proportional(0),
    ]));

and only render columns to the columns_area.
So the column for highlight_symbol is always allocated when it should be (when selections are made and when highlight spacing is WhenSelected OR when highlight spacing is WhenSelected).
column_spacing is added as a Fixed constraint into the columns_area, so it will be prioritized the most when the column widths are being calculated.

I added more visual tests for specifying this exact behavior into the tests.

I've improved the tests. I think once the priorities are set in stone, we should add a lot more tests and cover all the corner cases.

This was good feedback!
I'm going to merge this and revisit when I work on the tests for constraint priorities. I'll resolve the conversations, merge and then unresolve them again.


Refactor bugfix/150-refactor-spatial-avg (PR #152)

Description

This PR is a refactoring effort of PR #152.
Summary of Changes

Update spatial_avg() weights kwarg default val to "generate"

Closes #147

Refactor get_weights()

Update so that it only gets weights based on axis arg
Add _get_longitude_weights() and _get_latitude_weights()
Add _calculate_weights()

Update combine_weights() to not parse the axis_weights() dict

Only the relevant weights from get_weights() based on specified axis arg

Refactor _align_longitude_to_360_axis()
Update _swap_lon_axes to _swap_lon_axis

Checklist

[x] My code follows the style guidelines of this project
[x] I have performed a self-review of my own code
[x] My changes generate no new warnings
[x] Any dependent changes have been merged and published in downstream modules

If applicable:

[x] I have added tests that prove my fix is effective or that my feature works
[x] New and existing unit tests pass with my changes (locally and CI/CD build)
[x] I have commented my code, particularly in hard-to-understand areas
[x] I have made corresponding changes to the documentation
[ ] I have noted that this is a breaking change for a major release (fix or feature that would cause existing functionality to not work as expected)

@pochedls This PR is still in progress, but you can check out the changes so far and my latest review comments.

Hi @pochedls, this PR is ready for review.

@tomvothecoder - I'm wondering if I can rebase my branch (and then this branch could be re-based). It would be helpful to have the data_vars="minimum" (and perhaps a fix to #158 on this branch for testing).

@pochedls Yes, you can rebase your branch with main and I'll rebase this branch onto your's.
I'll take a closer look at #158 and see if it warrants a separate PR.

@pochedls Yes, you can rebase your branch with main and I'll rebase this branch onto your's.
I'll take a closer look at #158 and see if it warrants a separate PR.

I believe I correctly rebased last night - so hopefully this branch can be updated. It's okay if #158 is a separate PR - assign it to me if you'd like me to take an initial stab at it.

I believe I correctly rebased last night - so hopefully this branch can be updated. It's okay if #158 is a separate PR - assign it to me if you'd like me to take an initial stab at it.

@pochedls This branch has been rebased on your branch. If you're open to it, you can give #158 a shot!


Multithreaded modules

Hi guys, I'm inspecting the code and I've been wondering whether a module is multi-thread (multi-process) or not. I was able to figure out that the prediction module exploits a threadpool, therefore it should be multi-thread. What about control, planning and so on and so forth? Some tips on how to figure it out? Thanks in advance.

In short, a simple module is single threaded.
Because the code usually create a thread through new thread(), and there is no unified configuration, it can only be viewed through the code
multi-thread : perception, planning, canbus
single-thread: control, localization
process and thread
And be careful to distinguish between threads and processes.

cyber_launch will create a process
dag file will create some threads

Thanks for the reply. So I was not able to find out where planning create new threads. I would like to go deeper in order to better understand how those modules work. I also saw that cyber_launch create a new process (mainboard) which, as you said, create some threads, how many threads? How can I inspect all of this stuff? Thanks again.

There are ways to count, the easiest way is to view threads by ps -ef | grep xxx.
If you require analysis from the code, you can take attention in cyber::Async or new std::thread. In fact, Cyber automatically schedules system processes. But some modules will also create threads by themselves, which is not recommended.
You can find some new std::thread in module, actually I think cyber::Async is better.
If you want to really understand these in depth, you need to understand cyber scheduling then.

Closed due to inactivity. If the problem persists, pls feel free to reopen it or create a new one and refer to it.