[pycalcal] 2 new revisions pushed by enrico.s...@gmail.com on 2011-10-17 15:46 GMT

5 views
Skip to first unread message

pyca...@googlecode.com

unread,
Oct 17, 2011, 11:47:08 AM10/17/11
to pyca...@googlegroups.com
2 new revisions:

Revision: 7faf055ef184
Author: Enrico Spinielli <enrico.s...@gmail.com>
Date: Mon Oct 17 07:43:59 2011
Log: Minor changes
http://code.google.com/p/pycalcal/source/detail?r=7faf055ef184

Revision: 146b2fb52ec7
Author: Enrico Spinielli <enrico.s...@gmail.com>
Date: Mon Oct 17 08:46:31 2011
Log: n/a
http://code.google.com/p/pycalcal/source/detail?r=146b2fb52ec7

==============================================================================
Revision: 7faf055ef184
Author: Enrico Spinielli <enrico.s...@gmail.com>
Date: Mon Oct 17 07:43:59 2011
Log: Minor changes
http://code.google.com/p/pycalcal/source/detail?r=7faf055ef184

Modified:
/calendrica-3.0.cl
/pycalcal.nw

=======================================
--- /calendrica-3.0.cl Sat Oct 24 10:58:23 2009
+++ /calendrica-3.0.cl Mon Oct 17 07:43:59 2011
@@ -163,7 +163,7 @@
bali-luang bali-dwiwara bali-triwara bali-caturwara
bali-pancawara bali-sadwara bali-saptawara bali-asatawara
bali-sangawara bali-dasawara bali-day-from-fixed
- bali-luang-from-fixed bali-dwiwara-from-fixedok.tex
+ bali-luang-from-fixed bali-dwiwara-from-fixed
bali-triwara-from-fixed bali-caturwara-from-fixed
bali-pancawara-from-fixed bali-sadwara-from-fixed
bali-saptawara-from-fixed bali-asatawara-from-fixed
=======================================
--- /pycalcal.nw Sun Feb 21 07:11:47 2010
+++ /pycalcal.nw Mon Oct 17 07:43:59 2011
@@ -6,7 +6,7 @@

% for proper typesetting of angles...but it lacks h/m/s forms
\usepackage{siunitx}
-\def\dms{\ang[padangle=none,astroang]} % a synomim
+\def\dms{\ang[angle-symbol-over-decimal=true]} % a synomim
% waiting for siunitx extension for h/m/s...
\usepackage{euro}
\newcommand\phour[1]{\hbox{$#1^{\rm h}$}}
@@ -148,7 +148,7 @@
\urlstyle{leostyle}


-\setcounter{tocdepth}{0} % indice fino a section
+%\setcounter{tocdepth}{0} % indice fino a section


\begin{document}
@@ -3725,9 +3725,9 @@
The \emph{mean} obliquity is defined by the following
formula~\cite[equ.~22.2]{meeus:astroalgo}:
\begin{equation}
\label{eq:meanobliquity}
- \varepsilon_0 = \dms{23;26;21.448} -
- \dms{;;46.8150} T -
- \dms{;;.00059} T^2 +
+ \varepsilon_0 = \dms{23;26;21.448} -
+ \dms{;;46.8150} T -
+ \dms{;;.00059} T^2 +
\dms{;;.001813} T^3
\end{equation}
<<time and astronomy>>=
@@ -3744,6 +3744,22 @@
@ A formula with better precision (\dms{;;0.01} after $1000$ years and few
seconds of arc after $10000$ years around $J2000.0$) over a wider time
($10000$
years around $J2000.0$) span is given by~\cite[equ.~22.3]{meeus:astroalgo}:
+\begin{eqnarray}
+ \label{eq:precisemeanobliquity}
+ \varepsilon_0 & = & \dms{23;26;21.448} \nonumber \\
+ & & -\dms{;;4680.93} U \nonumber \\
+ & & -\dms{;;1.55} U^2 \nonumber \\
+ & & +\dms{;;1999.25} U^3 \nonumber \\
+ & & -\dms{;;51.38} U^4 \nonumber \\
+ & & -\dms{;;249.67} U^5 \\
+ & & -\dms{;;39.05} U^6 \nonumber \\
+ & & +\dms{;;7.12} U^7 \nonumber \\
+ & & +\dms{;;27.87} U^6 \nonumber \\
+ & & +\dms{;;5.79} U^7 \nonumber \\
+ & & +\dms{;;2.45} U^9 \nonumber \\
+\end{eqnarray}
+
+
<<time and astronomy>>=
def `precise_obliquity(tee):
"""Return precise (mean) obliquity of ecliptic at moment tee."""
@@ -7845,10 +7861,6 @@
[1967, 1, 30]
\end{verbatim}

-%%%%%%%%
-\subsection*{Converting coordinates}
-
-

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -7863,8 +7875,11 @@
service for astronomical applications as made available by the US Naval
Observatory web services \cite{USNO} or the IMCCE~\cite{imcce}.

-I created a google app for \pcc.
-In a diirectory named 'calendrica' I did put \texttt{calendrica.py}
+I created a google app for \pcc, accessible at
\url{http://calendrica.appspot.com}.
+
+Here is what I did to make it (sort of) work.
+
+In a directory named 'calendrica' I did put \texttt{calendrica.py}
and \texttt{app.yaml}. I also create a 'lib' directory where I copied
the whole \texttt{mpmath} distribution.
You can run in web app in your development environment using

==============================================================================
Revision: 146b2fb52ec7
Author: Enrico Spinielli <enrico.s...@gmail.com>
Date: Mon Oct 17 08:46:31 2011
Log: n/a
http://code.google.com/p/pycalcal/source/detail?r=146b2fb52ec7

Modified:
/pycalcal.nw

=======================================
--- /pycalcal.nw Mon Oct 17 07:43:59 2011
+++ /pycalcal.nw Mon Oct 17 08:46:31 2011
@@ -1,8 +1,10 @@
-%-*- mode: Noweb; noweb-code-mode: python-mode; tab-width: 4 -*-
% draft is convinient to show over/under boxes,
% BUT it does NOT inlude graphics nor create links
%\documentclass[a4paper,draft,pdftex]{report}
\documentclass[a4paper,pdftex]{report}
+
+
+\usepackage{fp}

% for proper typesetting of angles...but it lacks h/m/s forms
\usepackage{siunitx}
@@ -8410,6 +8412,7 @@
<<Makefile: files declarations>>=
NW_MAIN=pycalcal.nw
NW_SRC=
+TOOLS=prefix excerpt premarkup blankexcerpt blankpremarkup sconstruct
PYTHON_SITE_PACKAGES=/Library/Python/2.6/site-packages
UNIT_TEST_FILES=basicCodeUnitTest.py \
egyptianAndArmenianCalendarsUnitTest.py \
@@ -8458,11 +8461,14 @@
@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
<<Makefile: suffixes>>=
.SUFFIXES:
-.SUFFIXES: .nw .tex .py .dvi .defs .html .pdf .mp .asy .mps .gv .png
+.SUFFIXES: .nw .tex .py .dvi .defs .html .pdf .mp .asy .mps .gv .png .cl

.nw.py:
$(NOTANGLE) -filter btdefn -R$*.py - $(CPIF) $*.py

+.nw.cl:
+ $(NOTANGLE) -filter btdefn -R$*.cl - $(CPIF) $*.cl
+
.nw.html:
$(NOWEAVE) -filter l2h -filter btdefn -index -html $*.nw $(CPIF) $*.html

@@ -8512,29 +8518,49 @@
.PRECIOUS: %.aux %.bbl

.PHONY : all
-all: figures pycalcal.pdf $(NW_MAIN:.nw=.py) pycalcaltests.py
-
+all: tools code tests doc
+
+.PHONY : tools
+tools:
+ if [[ ! -x "prefix" ]]; \
+ then \
+ $(MAKE) $(TOOLS); \
+ fi;
+
+
+.PHONY : code
+code: pycalcal.py pycalcaltests.py
+
+.PHONY : tests
+tests: testSunset.cl
+ $(MAKE) testdata
+ $(MAKE) $(UNIT_TEST_FILES)
+
+
+.PHONY : doc
+doc:
+ -$(MAKE) figures
+ -$(MAKE) index
+ $(MAKE) pycalcal.pdf
+
+
+###############################
.PHONY : index
+index: pycalcal.defs
+
pycalcal.defs: $(NW_MAIN) premarkup
$(NODEFS) - $(CPIF) $*.defs

#all.defs: pycalcal.defs
# cat pycalcal.defs ${CPIF} all.defs
# sort -u $(NW_ALL:.nw=.defs) $(CPIF) all.defs
-
-# TeX (use predefined rule)
-pycalcal.tex: premarkup
-
-# do not depend on target figures (asymptote ones take quale long time)
-pycalcal.pdf: $(NW_MAIN:.nw=.tex)
-
-# Python files (for pycalcal.py use predefined rule +
-# extra dependency on premarkup)
-pycalcal.py: premarkup
-
-# figures
+###############################
+
+
+###############################
.PHONY : figures
figures: fig_ra-dec.pdf fig_ecliptic.pdf fig_alt-az.pdf
+###############################


<<Makefile: distro>>
@@ -8555,6 +8581,7 @@

@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
<<Makefile: distro>>=
+###############################
DISTRO_FILES=$(NW_MAIN) $(NW_MAIN:.nw=.py) $(NW_MAIN:.nw=.pdf) \
README INSTALL STATUS COPYRIGHT_DERSHOWITZ_REINGOLD \
makemake.sh \
@@ -8565,25 +8592,33 @@
$(NW_MAIN:.nw=.bib) \
figure.mp \
astro.mp \
- alt-az.asy
+ alt-az.asy \
+ testSunset.cl

.PHONY : distro
distro: all
tar -czf pycalcal_$$(date +"%Y%m%d%H%M").tar.gz $(DISTRO_FILES)
+###############################
+

@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Unit test and target
<<Makefile: unit tests and targets>>=
-pycalcaltests.py: pycalcal.py
+###############################
+pycalcaltests.py:
$(NOTANGLE) -filter btdefn -R$*.py - $(CPIF) $*.py

-.PHONY : test
-test: pycalcaltests.py $(NW_MAIN:.nw=.py) testdata ut
+testSunset.cl:
+ $(NOTANGLE) -filter btdefn -R$*.cl - $(CPIF) $*.cl
+
+
+.PHONY : check
+check: code tests
python pycalcaltests.py 2>&1 | tee testResult.txt

-.PHONY : singletest
-singletest:
- for t in $$(cat Makefile | grep 'UnitTest.py:' | \
+.PHONY : check1by1
+check1by1: code tests
+ for t in $$(cat Makefile | grep -e '^[^ ]*UnitTest.py:' | \
cut -f1 -d':' | grep -v appendix); \
do \
$(MAKE) $$t; \
@@ -8591,8 +8626,11 @@

# create all unit test files
.PHONY : ut
-ut: pycalcaltests.py
- $(MAKE) $(UNIT_TEST_FILES)
+ut:
+ $(MAKE) $$(cat pycalcal.nw | grep -e '^@<<.*UnitTest.py>>=' | \
+ grep -v appendix | sed -e 's/@<<//g' -e 's/>>=//g')
+# $(MAKE) $(UNIT_TEST_FILES)
+

<<Makefile: basics unit tests and target>>
<<Makefile: egyptian and armenian unit tests and target>>
@@ -8620,6 +8658,7 @@
trasformLatexDates2Cvs:
notangle -RtrasformLatexDates2Cvs $(NW_MAIN) $(CPIF)
trasformLatexDates2Cvs
-chmod ug+x trasformLatexDates2Cvs
+###############################


@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -8835,7 +8874,7 @@

@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
<<Makefile: clean>>=
-.PHONY : clean clobber superclean
+.PHONY : clean clobber xclean
clobber: clean

clean:
@@ -8847,9 +8886,10 @@
pycalcal.idx *UnitTest.py *UnitTest_result.txt \
html/ calendrica/ pycalcal*.gz figure.mpx \
$$(ls | grep "figure.[0-9][0-9]*") figure-*.pdf fig_*.pdf \
- *.mps *mpx fig_*.0
-
-superclean: clean
+ *.mps *mpx fig_*.0 SConstruct
+
+# ask to remove all files not recognized by hg
+xclean: clean
for f in $$(hg status | grep -e '^?' | sed -e 's/^? //g'); \
do \
rm -i $$f; \
@@ -8861,6 +8901,9 @@
%%%%%%%%%%%%%%%%%%%%%%%%%
\section{SConstruct It}
\label{sec:scons}
+I installed scons via the usual \texttt{\$ sudo python setup.py install}
from
+the SCons distribution directory.
+
Here is my experiment with SCons
<<SConstruct>>=
# <<generated code warning>>
@@ -8998,9 +9041,11 @@
%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Floating-point nuances}
\label{sec:examples}
+In oder to check numerical results, I compared \cl\ output with \py.
+(I used both CLisp [on PC and Linux] and SBCL [this is easier to install
on OS X]).
A snippet of \cl\ code from Prof.~Reingold.
<<testSunset.cl>>=
-#!/usr/bin/env clisp
+#!/usr/bin/env sbcl
;; -*- Mode: Lisp -*-

(load "calendrica-3.0.cl")
@@ -9121,6 +9166,22 @@
\appendix
%\appendixpage
%\addappheadtotoc
+%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%
+\chapter{Version control}
+I stored my code in google code repo,
\url{http://code.google.com/p/pycalcal/},
+based on Mercurial version control system.
+For an introduction to Mercurial read the excellent tutorial from Joel
Spolsky
+at \url{http://hginit.com/index.html}.
+
+Usual commands I use:
+\begin{verbatim}
+$ cd <my repo>
+$ hg status # to see what has changed
+$ hg add file1 # to add a new element in the repo
+$ hg update # to retrieve changes from the repo
+$ hg commit # to commit changes to the repo
+\end{verbatim}
%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Chunks}

Reply all
Reply to author
Forward
0 new messages