Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notice: Undefined offset #25

Open
nitinmukesh opened this issue Jun 21, 2021 · 21 comments
Open

Notice: Undefined offset #25

nitinmukesh opened this issue Jun 21, 2021 · 21 comments

Comments

@nitinmukesh
Copy link

I was able to setup the code and run index.php using XAMPP using PHP 5.6 version.

index.php

<?php

require './vendor/autoload.php';

use Jyotish\Base\Data;
use Jyotish\Base\Locality;
use Jyotish\Base\Analysis;
use Jyotish\Ganita\Method\Swetest;
use Jyotish\Dasha\Dasha;
$Locality = new Locality([
            'longitude' => "11.09",
            'latitude' => "79.6",
            'altitude' => 0,
            ]);
$DateTime = new DateTime();
$DateTime->setTimezone(new DateTimeZone('Asia/Kolkata'));
$DateTime->setDate(2017,09,26);
$DateTime->setTime(19,18);
$Ganita = new Swetest(["swetest" => "./vendor/kunjara/swetest/win/"]);
// for linux
// run sudo apt install libswe-dev
// after that use 
// $Ganita = new Swetest(["swetest" => "/usr/bin/"]);
$data = new Data($DateTime, $Locality, $Ganita);
// To Calculate Panchangam
$data->calcParams();
$data->calcRising();
$data->calcPanchanga();
// To calculate Upagraha
$data->calcUpagraha();
// To calculate Birth chart Divisions
$data->calcVargaData(["D1","D2","D3","D4","D7","D9","D10","D12",
"D16","D20","D24","D27","D30","D40","D45","D60"]);

I am however getting the following errors and no idea what is wrong. I also checked "vendor\kunjara\swetest\win" for swetest.exe and it is present. Please any help on solving the issue


Notice: Undefined offset: 2 in D:\xampp\htdocs\jyotish\src\Ganita\Method\Swetest.php on line 281

Notice: Undefined offset: 2 in D:\xampp\htdocs\jyotish\src\Ganita\Method\Swetest.php on line 283

Notice: Undefined offset: 3 in D:\xampp\htdocs\jyotish\src\Ganita\Method\Swetest.php on line 283

Notice: Undefined offset: 5 in D:\xampp\htdocs\jyotish\src\Ganita\Method\Swetest.php on line 284

Notice: Undefined offset: 6 in D:\xampp\htdocs\jyotish\src\Ganita\Method\Swetest.php on line 284

Notice: Undefined offset: 3 in D:\xampp\htdocs\jyotish\src\Ganita\Method\Swetest.php on line 281

Notice: Undefined offset: 2 in D:\xampp\htdocs\jyotish\src\Ganita\Method\Swetest.php on line 283

Notice: Undefined offset: 3 in D:\xampp\htdocs\jyotish\src\Ganita\Method\Swetest.php on line 283

Notice: Undefined offset: 5 in D:\xampp\htdocs\jyotish\src\Ganita\Method\Swetest.php on line 284

Notice: Undefined offset: 6 in D:\xampp\htdocs\jyotish\src\Ganita\Method\Swetest.php on line 284

Notice: Undefined offset: 4 in D:\xampp\htdocs\jyotish\src\Ganita\Method\Swetest.php on line 281

Notice: Undefined offset: 2 in D:\xampp\htdocs\jyotish\src\Ganita\Method\Swetest.php on line 283

Notice: Undefined offset: 3 in D:\xampp\htdocs\jyotish\src\Ganita\Method\Swetest.php on line 283

Notice: Undefined offset: 5 in D:\xampp\htdocs\jyotish\src\Ganita\Method\Swetest.php on line 284

Notice: Undefined offset: 6 in D:\xampp\htdocs\jyotish\src\Ganita\Method\Swetest.php on line 284

Notice: Undefined offset: 5 in D:\xampp\htdocs\jyotish\src\Ganita\Method\Swetest.php on line 281

Notice: Undefined offset: 2 in D:\xampp\htdocs\jyotish\src\Ganita\Method\Swetest.php on line 283

Notice: Undefined offset: 3 in D:\xampp\htdocs\jyotish\src\Ganita\Method\Swetest.php on line 283

Notice: Undefined offset: 5 in D:\xampp\htdocs\jyotish\src\Ganita\Method\Swetest.php on line 284

Notice: Undefined offset: 6 in D:\xampp\htdocs\jyotish\src\Ganita\Method\Swetest.php on line 284

Warning: Division by zero in D:\xampp\htdocs\jyotish\src\Panchanga\AngaDefiner.php on line 267

@qwertynik
Copy link

Did you manage to resolve this @nitinmukesh?

@nitinmukesh
Copy link
Author

@qwertynik Nope

@qwertynik
Copy link

@nitinmukesh Notices and warnings can be ignored. Ideally they should be addressed.

@nitinmukesh
Copy link
Author

@qwertynik Did you managed to run it

@qwertynik
Copy link

qwertynik commented Feb 19, 2022

Yes @nitinmukesh
Adding below line at the end of the code sample you posted should help.
print_r($data->getData());

@nitinmukesh
Copy link
Author

@qwertynik Thank you. I actually deleted this as I don't know PHP and could not solve the issue.

I am gonna try again. Thinking of converting this to nodejs and create public API for everyone to use. Not sure how much time I will get to learn PHP.

@krishnaguragain
Copy link

@nitinmukesh I managed to run this. Let me know what kind of help do you need at krishnaguragain @ outlook.com

@qwertynik
Copy link

@krishnaguragain

Did you manage to calculate the Nakshatras using this library?

@nitinmukesh
Copy link
Author

nitinmukesh commented Feb 25, 2022

@qwertynik Nikhil I am also looking to calculate Nakshatras for each planet. I see there is a lot of code related to the same but not exposed in output.

I see this site is using the same code and shows Nakshatras.
https://sidereal.live/

@nitinmukesh
Copy link
Author

@krishnaguragain I managed to run it and see the output. Thank you.

@jantech
Copy link

jantech commented Mar 6, 2022

@qwertynik Nikhil I am also looking to calculate Nakshatras for each planet. I see there is a lot of code related to the same but not exposed in output.

I see this site is using the same code and shows Nakshatras. https://sidereal.live/

@nitinmukesh , Could you please share the details how to resolve the issues? Thanks.

@jscuba
Copy link

jscuba commented Mar 18, 2022

This is a relatively simple way to get this library up and running on AWS Lambda. https://github.com/jscuba/jyotish-lambda

I'll post this to a few of the issues. It might be helpful as a reference too.

I had to sort of manually pull the nakshatras. I'm not much of a PHP programmer as you can probably tell.

@nitinmukesh
Copy link
Author

Thank you @jscuba .
https://github.com/jscuba/jyotish-lambda/blob/main/index.php

Any possibility to add Combust and Retro against each planet.

It's there in GrahaEnvironment.php
public function isAstangata()

@nitinmukesh
Copy link
Author

@jantech

Install XAMPP with PHP 7
Download the code from here and put in xampp/htdocs folder
https://github.com/jscuba/jyotish

install dependencies using composer

@jscuba
Copy link

jscuba commented May 2, 2022

@nitinmukesh You can check the speed of the planet to see if it's retrograde. Negative value indicates retrograde. I added combustion. I also saw getRashiAvastha() there, so I added the dignity as well.

@nitinmukesh
Copy link
Author

@jscuba

I see the isAstangata is not working correctly. Sun at 12 and Moon at 19 degree is showing as non combust which is incorrect.
I found the issue is in
public function isAstangata()
{
if (in_array($this->optionBhagaAstangata, [Biblio::BOOK_SS, Biblio::BOOK_BJ])) {

It is always picking default value as 6 whereas it should pick values from
Graha.php
public static $bhagaAstangata = [

I am not sure how to fix it. Please could you help with this issue

@nitinmukesh
Copy link
Author

@jscuba

I added additional information in the code provided by you. Please update in your code

`
$nakshatra = null;
foreach ($vargaData['graha'] as $grahaKey => $value) {
$nakshatra = $angaDefiner->getNakshatra(false, false, $grahaKey);
$vargaData['graha'][$grahaKey]['nakshatra'] = $nakshatra;
$Graha = Graha::getInstance($grahaKey)->setEnvironment($data);
$vargaData['graha'][$grahaKey]['astangata'] = $Graha->isAstangata(); // combustion
$vargaData['graha'][$grahaKey]['rashiAvastha'] = $Graha->getRashiAvastha(); // dignity
$vargaData['graha'][$grahaKey]['gocharastha'] = $Graha->isGocharastha(); // gocharastha
$vargaData['graha'][$grahaKey]['bhavaCharacter'] = $Graha->getBhavaCharacter(); // Bhava Character
$vargaData['graha'][$grahaKey]['tempRelation'] = $Graha->getTempRelation(); // Get tatkalika (temporary) relations
$vargaData['graha'][$grahaKey]['relation'] = $Graha->getRelation(); // Get summary relations
$vargaData['graha'][$grahaKey]['vargottama'] = $Graha->isVargottama(); // Vargottama
$vargaData['graha'][$grahaKey]['yogakaraka'] = $Graha->isYogakaraka(); // yogakaraka
$vargaData['graha'][$grahaKey]['mrityu'] = $Graha->isMrityu(); // graha is in mrityu bhaga
$vargaData['graha'][$grahaKey]['pushkaraNavamsha'] = $Graha->isPushkara(Graha::PUSHKARA_NAVAMSHA); // graha is in pushkara navamsha
$vargaData['graha'][$grahaKey]['pushkaraBhaga'] = $Graha->isPushkara(Graha::PUSHKARA_BHAGA); // graha is in pushkara bhaga
$vargaData['graha'][$grahaKey]['yuddha'] = $Graha->isYuddha(); // graha is in planetary war
$vargaData['graha'][$grahaKey]['avastha'] = $Graha->getAvastha(); // Get avastha of graha
$vargaData['graha'][$grahaKey]['dispositor'] = $Graha->getDispositor(); // Get ruler of the bhava, where graha is positioned

}

`

@jscuba
Copy link

jscuba commented May 30, 2022

@nitinmukesh I ended up writing my own combustion calculation. This is some javascript to give you an idea.

  const sunDegree = vargaData.graha.Sy.rashi * 30.0 + vargaData.graha.Sy.degree

  // and then for each planet...

  let dist = Math.abs(sunDegree - (data.rashi * 30.0 + data.degree))
  dist = Math.min(dist, 360 - dist)

  switch (data.graha) {
    case 'Sy':
      break
    case 'Ch':
      if (dist < 12) {
        data.combust = true
      }
      break
    case 'Ma':
      if (dist < 17) {
        data.combust = true
      }
      break
    case 'Bu':
      if (data.speed >= 0) {
        if (dist < 14) {
          data.combust = true
        }
      } else if (dist < 12) {
        data.combust = true
      }
      break
    case 'Gu':
      if (dist < 11) {
        data.combust = true
      }
      break
    case 'Sk':
      if (data.speed >= 0) {
        if (dist < 10) {
          data.combust = true
        }
      } else if (dist < 8) {
        data.combust = true
      }
      break
    case 'Sa':
      if (dist < 15) {
        data.combust = true
      }
      break
    case 'Ra':
      break
    case 'Ke':
      break
    default:
      break
  }

Thanks for the additional info for jyotish-lambda. I'll add it.

@nitinmukesh
Copy link
Author

nitinmukesh commented May 31, 2022

@jscuba Thank you m8.

Have a look at this.

You can mouse over graha in D1
https://golden-longma-0a62a5.netlify.app/nits.html

Only desktop friendly

@nitinmukesh
Copy link
Author

nitinmukesh commented Jun 23, 2022

@jscuba

Do you have any understanding how to prepare Bhava Chalit. I have seen several videos and read articles but can't gather my thoughts on how to implement (coding). May be I am old enough to get this through my head.

@jscuba
Copy link

jscuba commented Jun 26, 2022

@nitinmukesh No, sorry. I hadn't heard of it until you mentioned it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants