period

my power spectra are believable? a comparison between lomb-scargle and fft (scipy.signal and numpy.fft)

此生再无相见时 提交于 2019-12-05 01:24:02
问题 Could anyone kindly point out why I get very different results? There are many peaks which should not appear.In fact,there should be only one peak. I am a python newbie and all comments about my code below are welcome. The test data is here.enter link description here You can directly wget https://clbin.com/YJkwr . Its first column are the arrival times for a series of photons.A light source emits photons randomly. The total time is 55736s and there are 67398 photons. I try to detect some

LocalDate minus a Period get wrong result

回眸只為那壹抹淺笑 提交于 2019-12-04 12:15:43
问题 LocalDate minus a Period (like "28 years, 1 months and 27 days"),get wrong result. But minus a Period (only have days unit ,like "10282"days) get right result. Is there anything to notice? public static void main(String[] args) { printAgeAndBirthday(1989, 2, 22); printBirthdayFromPeriod(28, 1, 27); } private static void printBirthdayFromPeriod(int years, int months, int days) { final Period period = Period.of(years, months, days); final LocalDate now = LocalDate.now(); final LocalDate

Fast Fourier Transform in R

时间秒杀一切 提交于 2019-12-04 07:31:48
问题 I have a dataset with the number of hourly visits an animal made during a period of 12 months. I want to use the Fast Fourier Transform to examine cyclical patterns and periodicity. In the past, I have used Statistica for this this; however, I would like to use R to get a plot of the spectral density vs. period. Is there an easy way to do this in R? I would like to identify 12 and 24 hr peak in activity if possible. 回答1: You may consider the following functions. periodogram from TSA package

do_decimal_point and do_thousands_sep Not Working

落花浮王杯 提交于 2019-12-04 02:31:02
问题 do_decimal_point and do_thousands_sep seem to be completely ignored by my stream. What I want is to do is use a period for my thousands_sep and a comma for my decimal_point in get_money. So I override moneypunct but it is just ignored :( struct punct_facet : public moneypunct<char> { char_type do_decimal_point() const { return ','; } char_type do_thousands_sep() const { return '.'; } }; int main() { istringstream USCurrency("1,234.56 -1,234.56 1.234,56 -1.234,56"); USCurrency.imbue(locale

How can I detect if a float has a repeating decimal expansion in C#?

删除回忆录丶 提交于 2019-12-04 00:40:11
问题 I simply need to know how I can detect repeating decimal expansion in floats. Example: 0.123456789123456789 The repeating portion of the number would be 123456789. I want to automatize this in C#, is there any smart solution? 回答1: There's a nice trick for calculating rational approximations to a given float (based on some properties of Euclid's algorithm for GCDs). We can use this to determine whether or not the "best" approximation is of the form A/(2^a 5^b) , if it is then the float

Run a function periodically in Scala

我的梦境 提交于 2019-12-03 18:32:33
问题 I want to call an arbitrary function every n seconds. Basically I want something identical to SetInterval from Javascript. How can I achieve this in Scala? 回答1: You could use standard stuff from java.util.concurrent : import java.util.concurrent._ val ex = new ScheduledThreadPoolExecutor(1) val task = new Runnable { def run() = println("Beep!") } val f = ex.scheduleAtFixedRate(task, 1, 1, TimeUnit.SECONDS) f.cancel(false) Or java.util.Timer : val t = new java.util.Timer() val task = new java

I am getting wrong time between two dates in Joda-Time

谁都会走 提交于 2019-12-03 01:21:38
问题 I am getting incorrect results whatever I do. Could anyone give me some advise please :). Here is the code of my program the is responsible for getting the time between two dates. I am getting a result but the problem is that it is incorrect and I have having trouble finding the problem. I have to Joda library in my project. if (timerightnow.isSelected()) { DateFormat getdate = new SimpleDateFormat("dd/MM/yy HH:mm:ss"); Date getdate1 = new Date(); String datenow = getdate1.toString(); String

Java Time period in decimal number of years

旧时模样 提交于 2019-12-02 17:01:30
问题 If I calculate the difference between 2 LocalDate 's in java.time using: Period p = Period.between(testDate, today); Then I get an output with the number of years, months, days like: Days = 9 Months = 6 Years = 18 Does anyone know a clean way to represent that as a decimal type value (ie, above would be something around 18.5... )? 回答1: I would avoid using Period, and instead just calculate the difference in days: float years = testDate1.until(today, ChronoUnit.DAYS) / 365.2425f; 回答2: You

Java Time period in decimal number of years

核能气质少年 提交于 2019-12-02 08:43:16
If I calculate the difference between 2 LocalDate 's in java.time using: Period p = Period.between(testDate, today); Then I get an output with the number of years, months, days like: Days = 9 Months = 6 Years = 18 Does anyone know a clean way to represent that as a decimal type value (ie, above would be something around 18.5... )? I would avoid using Period, and instead just calculate the difference in days: float years = testDate1.until(today, ChronoUnit.DAYS) / 365.2425f; You mentioned in one of your comments that you need quarter year precision if you need the current quarter you can use

Binding to fields containing a period in DataTable in C#/WPF

只谈情不闲聊 提交于 2019-12-02 01:26:40
I have a SQL CE database, which is beyond my control, that has fields in the format of ., complete with a period in the column name. The columns will always be different, so I cannot have a strong-typed data field. I've been tasked with displaying dynamic table data into a DataGrid. Normally, this would be easy -- auto-generate the columns and everything is cool. Easy example. However, I'm not allowed to do this, since the '.' character in the column names nukes the binding. Right now, I'm trying to add a layer of translation to the dataset (probably will have to maintain a dictionary with