interpolation

How can you produce sharp paint results when rotating a BufferedImage?

帅比萌擦擦* 提交于 2019-12-18 11:09:50
问题 One attempted approach was to use TexturePaint and g.fillRect() to paint the image. This however requires you to create a new TexturePaint and Rectangle2D object each time you paint an image, which isn't ideal - and doesn't help anyway. When I use g.drawImage(BufferedImage,...) , the rotated images appear to be blurred/soft. I'm familiar with RenderingHints and double-buffering (which is what I'm doing, I think), I just find it difficult to believe that you can't easily and efficiently rotate

Interpolate missing values in a time series with a seasonal cycle

让人想犯罪 __ 提交于 2019-12-18 10:36:48
问题 I have a time series for which I want to intelligently interpolate the missing values. The value at a particular time is influenced by a multi-day trend, as well as its position in the daily cycle. Here is an example in which the tenth observation is missing from myzoo start <- as.POSIXct("2010-01-01") freq <- as.difftime(6, units = "hours") dayvals <- (1:4)*10 timevals <- c(3, 1, 2, 4) index <- seq(from = start, by = freq, length.out = 16) obs <- (rep(dayvals, each = 4) + rep(timevals, times

How can I get the output of a matplotlib plot as an SVG?

人走茶凉 提交于 2019-12-18 10:26:40
问题 I need to take the output of a matplotlib plot and turn it into an SVG path that I can use on a laser cutter. import matplotlib.pyplot as plt import numpy as np x = np.arange(0,100,0.00001) y = x*np.sin(2*pi*x) plt.plot(y) plt.show() For example, below you see a waveform. I would like to be able to output or save this waveform as an SVG path that I can later work with in a program such as Adobe Illustrator. I am aware of an SVG library called "Cairo" that matplotlib can use ( matplotlib.use(

Bivariate structured interpolation of large array with NaN values or mask

跟風遠走 提交于 2019-12-18 05:56:56
问题 I am trying to interpolate regularly gridded windstress data using Scipy's RectBivariateSpline class. At some grid points, the input data contains invalid data entries, which are set to NaN values. To start with, I used the solution to Scott's question on bidimensional interpolation. Using my data, the interpolation returns an array containing only NaNs. I have also tried a different approach assuming my data is unstructured and using the SmoothBivariateSpline class. Apparently I have too

How do I escape #{ from string interpolation

。_饼干妹妹 提交于 2019-12-18 05:47:14
问题 I have a heredoc where I am using #{} to interpolate some other strings, but there is an instance where I also want to write the actual text #{some_ruby_stuff} in my heredoc, WITHOUT it being interpolated. Is there a way to escape the #{. I've tried "\", but no luck. Although it escapes the #{} , it also includes the "\": >> <<-END #{RAILS_ENV} \#{RAILS_ENV} END => " development \#{RAILS_ENV}\n" 回答1: I think the backslash-hash is just Ruby being helpful in some irb-only way. >> a,b = 1,2 #=>

Higher order local interpolation of implicit curves in Python

走远了吗. 提交于 2019-12-18 05:12:43
问题 Given a set of points describing some trajectory in the 2D plane, I would like to provide a smooth representation of this trajectory with local high order interpolation. For instance, say we define a circle in 2D with 11 points in the figure below. I would like to add points in between each consecutive pair of points in order or produce a smooth trace. Adding points on every segment is easy enough, but it produces slope discontinuities typical for a "local linear interpolation". Of course it

Three dimensional (3D) matrix interpolation in Matlab

大兔子大兔子 提交于 2019-12-18 03:49:25
问题 I have a 3D matrix in Matlab of certain size, however I would need to interpolate it to obtain matrix of larger size. size(M) ans= 50 108 86 I need that matrix to be interpolated and finally obtain a matrix of size 100x213x140 . Any ideas of how to do it using interp3 ? Is this possible at all? I've tried Vq = interp3(M,1:100,1:213,1:140) Error using griddedInterpolant/subsref The input data has inconsistent size. Error in interp3 (line 178) Vq = F(Xq,Yq,Zq); If I use meshgrid : [X,Y,Z] =

C# Linear Interpolation

时光毁灭记忆、已成空白 提交于 2019-12-18 02:51:05
问题 I'm having issues interpolating a data file, which i have converted from .csv into an X array and Y array where X[0] corresponds to point Y[0] for example. I need to interpolate between the values to give me a smooth file at the end. I am using a Picoscope to output the function which means each line is equally spaced in time, so only using Y values, which is why I'm trying to do this in a strange way when you see my code. The kind of values it has to deal with are: X Y 0 0 2.5 0 2.5 12000 7

C# Linear Interpolation

只愿长相守 提交于 2019-12-18 02:50:45
问题 I'm having issues interpolating a data file, which i have converted from .csv into an X array and Y array where X[0] corresponds to point Y[0] for example. I need to interpolate between the values to give me a smooth file at the end. I am using a Picoscope to output the function which means each line is equally spaced in time, so only using Y values, which is why I'm trying to do this in a strange way when you see my code. The kind of values it has to deal with are: X Y 0 0 2.5 0 2.5 12000 7

Is there easy way in python to extrapolate data points to the future?

别说谁变了你拦得住时间么 提交于 2019-12-18 02:48:22
问题 I have a simple numpy array, for every date there is a data point. Something like this: >>> import numpy as np >>> from datetime import date >>> from datetime import date >>> x = np.array( [(date(2008,3,5), 4800 ), (date(2008,3,15), 4000 ), (date(2008,3, 20), 3500 ), (date(2008,4,5), 3000 ) ] ) Is there easy way to extrapolate data points to the future: date(2008,5,1), date(2008, 5, 20) etc? I understand it can be done with mathematical algorithms. But here I am seeking for some low hanging