spatstat/spatstat.linnet

How to change resolution of Zimage in rhohat.lpp

Closed this issue · 3 comments

Dear developers, I'm not sure if the following reasoning does make sense, but I was wondering if it's possible to modify the code behind evalCovar.lppm to adjust the resolution of the object Zimage when creating a linim object starting from a linfun object. In particular, I noticed that, at the moment, the argument eps is ignored in evalCovar.lppm, and I was wondering if it can be used when creating the linim object named Zimage.

I tried to implement that idea in a separate fork of this repository and this is the result:

library(spatstat.linnet)
set.seed(1)
Y <- runiflpp(50, domain(chicago))
rhoY <- rhohat(Y, "y", eps = 5)
plot(predict(rhoY))

rhoY <- rhohat(Y, "y", eps = 20)
plot(predict(rhoY))

Created on 2021-08-24 by the reprex package (v2.0.0)

(the current version returns a 128 x 128 image in both cases).

I'm not sure the resolution of Zimage can be modified like that, and I'm not sure I can "reuse" the argument eps (since it defines the grid used to evaluate the covariate). In any case, if you agree, I could complete the implementation and create a pull request.

Sorry for all these issues.

The implementation of evalCovar.lppm is not yet finished, so the argument eps is not currently handled by the code.

However, the argument eps was intended to control the spacing of sample points along the network, not the pixel size of the approximating pixel image. The usage of eps and nd was meant to be similar to their use in lppm.

(I assume you are aware that a linim object carries two sets of data, one of which is a pixel image of class im, and the other is a data frame representing sample points along the network.)

But I can see that it would be useful to control the resolution of the approximating pixel image as well as the sample point data.

I will change the specification, so that evalCovar.lppm accepts arguments eps and dimyx (which will be interpreted by as.mask to control pixel dimensions of the image) and delta and nd (to control the spacing of sample points along the network).

Finally, you didn't say why you needed to change the pixel resolution, but if it was purely to improve the graphics, then it would be easier to use the argument fatten in plot.linim.

Thank you very much for your answer.

I will change the specification, so that evalCovar.lppm accepts arguments eps and dimyx (which will be interpreted by as.mask to control pixel dimensions of the image) and delta and nd (to control the spacing of sample points along the network).

Ok, thanks.

Finally, you didn't say why you needed to change the pixel resolution, but if it was purely to improve the graphics, then it would be easier to use the argument fatten in plot.linim.

Yes, it is just for graphical purposes since the output image does not look great for larger linear networks. Unfortunately, I forgot about fatten argument in plot.linim so, for the moment, I will just change that parameter.

Done (in spatstat.linnet 2.3-0.002)