python-zmanim icon indicating copy to clipboard operation
python-zmanim copied to clipboard

Implement ComplexZmanimCalendar

Open ghost opened this issue 6 years ago • 8 comments

Are there any plans to port over the ComplexZmanimCalendar class from KosherJava? Or is it already implemented elsewhere?

ghost avatar Feb 10 '19 10:02 ghost

I have no plans to do this at this time. Every method of the Complex calculations can be performed using the overloaded ZmanimCalendar methods, and I didn't want the responsibility of keeping the code in sync as new opinions are being continuously added to the Complex class.

pinnymz avatar Feb 10 '19 16:02 pinnymz

Can you give an example of how I would be able to do it with the ZmanimCalendar methods?

ghost avatar Feb 10 '19 22:02 ghost

Do you have a specific zman and opinion you'd like an example for, or would any suffice?

pinnymz avatar Feb 11 '19 03:02 pinnymz

Any

ghost avatar Feb 11 '19 04:02 ghost

Here's how 5 (randomly selected) calculations may be implemented:

class ComplexZmanimCalendar(ZmanimCalendar):
   def misheyakir11Point5Degrees(self):
      return self.alos({'degrees': 11.5})
      
   def sofZmanShmaMGA19Point8Degrees(self):
      day_start = self.alos({'degrees': 19.8})
      day_end = self.tzais({'degrees': 19.8})
      return self.sof_zman_shema(day_start, day_end)
      
   def tzaisAteretTorah(self):
      return self.tzais({'offset': 40})
      
   def bainHasmashosRT13Point5MinutesBefore7Point083Degrees(self):
      timeOffset = -13.5
      degreeOffset = 7 + (5.0 / 60)
      return self.tzais({'degrees': degreeOffset, 'offset': timeOffset})
      
   def tzais120Zmanis(self):
      return self.tzais({'zmanis_offset': 120})

pinnymz avatar Feb 11 '19 04:02 pinnymz

@plonibarploni can I assume this has been resolved?

pinnymz avatar Apr 03 '19 19:04 pinnymz

Yes, but it would be nice if this was included in a readme or wiki page. Thanks

ghost avatar Apr 03 '19 19:04 ghost

@pinnymz I know that this issue is all but resolved, however, I felt like I should say that just because it is easy to create all the methods in the ComplexZmanimCalendar class, it shouldn't mean that you can't create a bunch of convenience methods for your users. It's not like there are all new zmanim opinions popping up everyday.

I feel like someone who wants to use your repo, wouldn't want to have to keep a separate python file that implements the proper methods wherever he goes to use Python and this repo.

I know it might be a lot of work, but I believe that it would be a very good idea to implement the ComplexZmanimCalendar class to the best of your ability. The result being that someone who wants to use your repo, can just install it and use the bainHasmashosRT13Point5MinutesBefore7Point083Degrees() method right away for example.

In the end, it is your repository, so do what you want. However, I felt like I should give the idea a push. Kol Tuv!

Elyahu41 avatar Jul 02 '21 02:07 Elyahu41