Giter Club home page Giter Club logo

vedicdatetime's People

Contributors

neerajdhanraj avatar prajwalkpatil avatar rstub avatar saradindusengupta avatar yihui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vedicdatetime's Issues

Problem with updating swephR on CRAN

Hi,
I am maintaining the swephR package that you are using. I have to update the package, because it is using some C constructs that are no longer accepted by CRAN. Fortunately, the current version of the underlying C library fixes these. Unfortunately, this changes the computation for some things slightly. And this causes some tests in your package to fail. As a consequence, I cannot update swephR.

I see at least two possibilities:

  • You could reformulate the tests such that you are not testing for the explicit values and instead just test the general structure.
  • You could reformulate the tests such the expected result would depend on the version of swephR being used.

Do you have any preferences? Or do you have other ideas?

If you are interested, I could provide a PR for one of these approaches. The problem is, that a new release for VedicDateTime would be needed quite soon so that swephR can also be released within the time frame set by CRAN.

Thanks for considering!

Multiple ritu names are returned by get_ritu_name when adhika masa flag is set by the masa function

Multiple ritu names are returned by get_ritu_name when adhika masa flag is set by the masa function

When it is Adhika masa, flag 1 is set, get_ritu_name returns multiple ritu names as array

e.g. For 18 July 2023

> masa(gregorian_to_jd(18,07,2023),  c(16.99, 81.79, +5.5))
[1] 5 1
> get_ritu_name(masa(gregorian_to_jd(18,07,2023),  c(16.99, 81.79, +5.5)))
[1] "Varsha"  "Vasanta"

where as for a non adhika masa, only single ritu name is returned

e.g. For 18 August 2023

> masa(gregorian_to_jd(18,08,2023),  c(16.99, 81.79, +5.5))
[1] 5 0
> get_ritu_name(masa(gregorian_to_jd(18,08,2023),  c(16.99, 81.79, +5.5)))
[1] "Varsha"

Wrong yoga computation, resulting in out of bounds array access in get_yoga_name function

Thanks a lot for the amazing library.

While I was trying to use get_yoga_name, I've observed that returned name contains 'NA'. So I have tried observing code execution using breakpoints to see what might be happening within get_yoga_name. Following are my observations

Sample 1

get_yoga_name(gregorian_to_jd(05,07,2023), c(16.99, 81.79, +5.5))
[1] "Vaidhriti till 7:47:38 & NA till 27:48:33"

Sample 2

yoga(gregorian_to_jd(05,07,2023), c(16.99, 81.79, +5.5))
[1] 27 7 47 38 28 27 48 33

I could see that in the for loop, during 2nd iteration **variable j value is set to 5 ** resulting in accessing 5th element in the yoga_ array i.e. 28 in this example, which in turn produces 'NA' value due to out of bound access of yogas array.

I suspect there is an issue in yoga function which wrongly computed value 28 for 5th element in yoga_ array.

get_yoga_name <- function(jd,place){
  yoga_ = yoga(jd,place)
  size = length(yoga_)
  size = size / 4
  j <- 1
  yoga_name <- ""
  for(i in 1:size){
    #* 'NA' caused by following line of code during 2nd iteration
    yoga_name <- paste(yoga_name,yogas[yoga_[j]]," till",sep = "")
    yoga_name <- paste(yoga_name,paste(yoga_[j+1], yoga_[j+2], yoga_[j+3], sep = ":"))
    if(size > 1 && i == 1){
      yoga_name <- paste(yoga_name,"& ")
    }
    j <- 5
  }
  return (yoga_name)
}

Array out-of-bounds while computing tithi

While computing tithi, same problem as that of #14 is encountered.

get_tithi_name(gregorian_to_jd(27,5,2025),c(17.32, 76.83, +5.5))
[1] "Amavasya till 8:32:23 & NA till 29:2:60"

Some tests fail on PowerPC: [ FAIL 3 | WARN 0 | SKIP 4 | PASS 16 ]

R version 4.3.0 (2023-04-21) -- "Already Tomorrow"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: powerpc-apple-darwin10.8.0 (32-bit)

> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional test configuration?
> # Learn more about the roles of various files in:
> # * https://r-pkgs.org/tests.html
> # * https://testthat.r-lib.org/reference/test_package.html#special-files
> 
> library(testthat)
> library(VedicDateTime)
> 
> test_check("VedicDateTime")
[ FAIL 3 | WARN 0 | SKIP 4 | PASS 16 ]

══ Skipped tests ═══════════════════════════════════════════════════════════════
• Old swephR version (4)

══ Failed tests ════════════════════════════════════════════════════════════════
── Failure ('test_nakshatra.R:8:3'): Check positive testcase ───────────────────
nakshatra(vd$jd, vd$place) (`actual`) not equal to c(25, 24, 24, 1) (`expected`).

  `actual`: 25 24 24 2
`expected`: 25 24 24 1
── Failure ('test_tithi.R:8:3'): Check positive testcase ───────────────────────
tithi(vd$jd, vd$place) (`actual`) not equal to c(20, 20, 55, 35) (`expected`).

  `actual`: 20 20 55 36
`expected`: 20 20 55 35
── Failure ('test_yoga.R:8:3'): Check positive testcase ────────────────────────
yoga(vd$jd, vd$place) (`actual`) not equal to c(5, 27, 26, 12) (`expected`).

  `actual`: 5 27 26 13
`expected`: 5 27 26 12

[ FAIL 3 | WARN 0 | SKIP 4 | PASS 16 ]
Error: Test failures
Execution halted

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.