Questions tagged [spectral]

145 questions
1
vote
0 answers

How can a spectral reaction diffusion solver be written on Shadertoy?

Even with a 20 point Laplacian operator there are still coordinate system artifacts with a circularly symmetric seed. That is one reason to try a spectral solver. The main code for the above mentioned simplest Laplacian with a forward Euler solver…
David Jonsson
  • 318
  • 5
  • 19
1
vote
0 answers

How to open/read an ENVI file in R

I'm new at using GIS with R and I'm trying to open an ENVI file containing hyperspectral data following the suggestions from this post R how to read ENVI .hdr-file?, but I don't seem to be able to do so. I tried three different approaches but all of…
1
vote
1 answer

Scikit Spectral Clustering fails to classify concentric circles

Here is some code to set up the clustering problem: import numpy as np import matplotlib.pyplot as plt # KMeans # # Class=2 # Center(2.5,2.5), r1 = 2, r2 = 1 X1 = np.zeros(500*4) X2 = np.zeros(500*4) r1 = 2; r2 = 1; a = 2.5; b = 2.5 # generate…
Ray Jio
  • 21
  • 2
1
vote
1 answer

R: Inverse fft() to confirm my manual DFT algorithm inaccurate?

Using R, before assessing some metric of accuracy on my own manual implementation of DFT, I wanted to do a sanity check on how well stats::fft() performs by doing the following: sig.ts = ts( sin(2*pi*freq1*t) + sin(2*pi*freq2*t) ); sig.rt =…
Christian
  • 13
  • 1
  • 4
1
vote
1 answer

How to read wavelength information from envi file in spectral python libraray?

I am working on hyperspectral imagery which is in envi format. I have successfully read it using spectral python library. Now , I want to get each band (wavelength center). Kindly suggest method for this task.
KHIZER
  • 21
  • 4
1
vote
0 answers

AttributeError: 'int' object has no attribute '_forward_pre_hooks'

def define_module(self): ndf, nef = self.df_dim, self.ef_dim self.encode_img = nn.Sequential( nn.Conv2d(3, ndf, 4, 2, 1, bias=False), nn.LeakyReLU(0.2, inplace=True), # state size. (ndf) x 32 x 32 …
1
vote
1 answer

Spectral viewcube in Google CoLab

Help. Trying to get a hypercube in a Google CoLab Notebook using Python 3. hdc is a 3d numpy array: [x,y,channel] This code fails: !pip install spectral from spectral import * view_cube(hdc_reshaped, bands=[29, 19, 9]) This complains…
lr100
  • 648
  • 1
  • 9
  • 29
1
vote
0 answers

Error: could not find function "interpolate.fft" (R module spectral IS installed)

My code: library(spectral) x <- seq(0,99) y <- sin(x/6) + 0.5*cos(x/22) z <- interpolate.fft(y) RStudio says: Error in interpolate.fft(y) : could not find function "interpolate.fft" When I try to use it as spectral::interpolate.fft(y), the error is…
Greg
  • 11
  • 1
1
vote
0 answers

Iterate through rows in hyperspectral image

I have code that displays a hyperspectral images (cube). I have to images: Image 1: hyperspectral image that has N number of rows and N number of columns. Image 2: hyperspectral image that has only one row, but it has the same number of columns…
Reut
  • 1,555
  • 4
  • 23
  • 55
1
vote
1 answer

How to use a color palette created with pyplot.Spectral for scatterplots in a loop?

I have a dataset of points in two dimensions that I want to classify using the K-means technique. The data: import numpy as np x1 = np.array([3,1,1,2,1,6,6,6,5,6,7,8,9,8,9,9,8]) x2 = np.array([5,4,5,6,5,8,6,7,6,7,1,2,1,2,3,2,3]) X =…
Carlos Davila
  • 129
  • 2
  • 9
1
vote
1 answer

Butterworth filtering of EEG data in R

I'm very new at R and EEG signalling so please excuse me if the answer to the question is obvious. I'm trying to perform a Butterworth filter to an EEG signal to extract the Alpha band. When I executed the filter, the resulting signal looked very…
1
vote
1 answer

Efficiently converting a list of dictionaries with embedded arrays to DataFrame

I have a list of dictionaries, with spectral data inside the responses field. I also have array of wavelengths for labelling the columns for the spectral data. The list/input looks like this: data = [ { 'date': '2018-01-01', 'measurement':…
Dave
  • 454
  • 1
  • 7
  • 17
1
vote
0 answers

How to embed a matplotlib annotation action into a function?

With matplotlib you can have interaction with a plotted image for instance for annotation. You then get after the interaction some data that you usually like to save. I would like to incorporate that all in a function, but I don't know how to do…
JMath
  • 63
  • 1
  • 7
1
vote
1 answer

Spectral Test in R

I would like to change my code in a way that 10000 points are placed in a [0,1]^2 plot. I tries changing 256 to 10000 but it generates weird placement. I should change the factors 137 and 187 but not sure how to change it. Anyone knows the logic…
antetokounmpo
  • 167
  • 1
  • 7
1
vote
1 answer

Reversing order of colorbrewer palette while using statebins package

statebins( dataset ,state_col= "state", value_col="value", brewer_pal = "Spectral",) I'm using statebins package to plot energy consumption of 50 states of US. Though Spectral palette from colorbrewer look well on the plot: this is in the…