Code Monkey home page Code Monkey logo

pynomo's Introduction

pynomo's People

Contributors

djboulet avatar jonasstein avatar lefakkomies avatar tevorbl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pynomo's Issues

Title in two lines

Hi,
I am trying to write the titles for N_params_1, N_params_2 because they are just too long. I have tried using \par and \\ without any luck. I have also tried following:

    'title':r'\small First line'  '\n'
            r' second line $(unit)$',

However, \par works in 'extra_titles': and it works.
Please let me know how to write the title in two lines. Thanks.

error on examples using scipy

Hello,

I have installed the package as explained in the documentation and I have tried to run the examples.
Some examples like ex_axes_1.py or ex_BMI.py are working great.
Others more complex like LC_filter.py or ex_amortized_loan.py are failling with the following error (last part) :

File "C:\_UsersDatas\Miniconda3\envs\nomography\Lib\site-packages\scipy\optimize\_optimize.py", line 899, in _minimize_neldermead
    fsim[k] = func(sim[k])
    ~~~~^^^
TypeError: float() argument must be a string or a real number, not 'complex'

I guess it is linked to a change in the last version of scipy.
The version I am using is scipy 1.11.3 py311hc1ccb85_0 on windows.

What was the version of scipy used to develop PyNomo?

By the way, nice work! 😃
I try to use Nomography in my current research work to obtain a fast design tool and at the same time more insights from the equation.

Can I lie the bar horizontal?

Hi, thanks for your work.
I dont like the bar stand straight. Can I lie the bar horizontal? Just like nomogram in R.
Thank you again.

Reverse Engineer

Is there a way to reverse engineer a nomograph using your software?

Colouring option does not work anymore

Hi, I have been using the Pynomo package for a while now, it truly is a wonderful tool.
I switched from the version 0.2.2 to the latest one (0.3.4) recently, to experiment the Nomogen script.
I ran the following commands to install the required packages :

python -m pip install --upgrade pip
pip install numpy
pip install scipy
pip install pyx
pip install six
pip install pynomo

While the main code works, both for Nomogen and Nomographer, some of my previous nomograms cannot be drawn anymore.

I encounter a NameError when adding 'v_line_color' for a type 5 nomogram, or modifying text colour and size within 'pyx_extra_defs'.
The command prompt then returns an error message, respectively : name 'color' is not defined ; name 'self' is not defined ; name 'type' is not defined .
The isopleth personalisation works still.

I do not know python and have not been able to fix this issue.
Any help would be much appreciated.

Empty PDF

I have used Pynomo on older machines in the past. Tried installing on new machine only to encounter various problems with Python 2.6 and Python 3. Current install is on Python 2.7 numpy 1.16.6 PyX 0.12.1 Pynomo 0.3.2

When I run a test pynomo script a pdf is made that is empty. Command Prompt traceback is copied below. I've run to the end of what I'm able to do myself without asking for help. I would appreciate any help. Thanks

C:\Users\Richard\Documents\Pynomo>python retainingwall.py
Traceback (most recent call last):
File "retainingwall.py", line 84, in
Nomographer(main_params)
File "C:\Python27\lib\site-packages\pynomo\nomographer.py", line 232, in init
wrapper.draw_nomogram(c, params['post_func'])
File "C:\Python27\lib\site-packages\pynomo\nomo_wrapper.py", line 268, in draw_nomogram
canvas.writePDFfile(self.filename)
File "C:\Python27\lib\site-packages\pyx\canvas.py", line 48, in wrappedindocument
return method(d, file, **write_kwargs)
File "C:\Python27\lib\site-packages\pyx\document.py", line 171, in writePDFfile
pdfwriter.PDFwriter(self, _outputstream(file, "pdf"), **kwargs)
File "C:\Python27\lib\site-packages\pyx\pdfwriter.py", line 316, in init
catalog = PDFcatalog(document, self, registry)
File "C:\Python27\lib\site-packages\pyx\pdfwriter.py", line 142, in init
self.PDFpages = PDFpages(document, writer, registry)
File "C:\Python27\lib\site-packages\pyx\pdfwriter.py", line 201, in init
page = PDFpage(page, pageno, self, writer, registry)
File "C:\Python27\lib\site-packages\pyx\pdfwriter.py", line 235, in init
self.PDFcontent = PDFcontent(page, writer, self.pageregistry)
File "C:\Python27\lib\site-packages\pyx\pdfwriter.py", line 267, in init
page.processPDF(contentfile, writer, acontext, registry, self.bbox)
File "C:\Python27\lib\site-packages\pyx\document.py", line 132, in processPDF
self._process("processPDF", *args)
File "C:\Python27\lib\site-packages\pyx\document.py", line 126, in _process
getattr(cc, processMethod)(contentfile, writer, context, registry, bbox)
File "C:\Python27\lib\site-packages\pyx\canvas.py", line 199, in processPDF
item.processPDF(file, writer, context, registry, nbbox)
File "C:\Python27\lib\site-packages\pyx\text.py", line 733, in processPDF
self.ensuredvicanvas()
File "C:\Python27\lib\site-packages\pyx\text.py", line 705, in ensuredvicanvas
self.finishdvi()
File "C:\Python27\lib\site-packages\pyx\text.py", line 1042, in finishdvi
self.execute(None, self.defaulttexmessagesend + self.texmessagesend)
File "C:\Python27\lib\site-packages\pyx\text.py", line 1034, in execute
raise TexResultError("unhandled TeX response (might be an error)", self)
pyx.text.TexResultError: unhandled TeX response (might be an error)
The expression passed to TeX was:
\end%
After parsing the return message from TeX, the following was left:
*

tex: major issue: So far, no MiKTeX administrator has checked for updates.

Issues aligning additional type 8 scales to f2 in a type 2 nomogram

I've been trying to design a Type 2 nomogram to compute design point from settling time and percent overshoot assuming second-order linear system type behavior. I am able to make it work as a Type 1 nomogram, but when I try to make it Type 2 i have odd issues where an additional type 8 scale that is aligned correctly when in the f1 or f3 position is not aligned in the f2 position. The only way I've been able to make this work is to make several Type 2 nomograms on top of each other with the different scales that should be aligned all as f2.
design-point-nomogram-type2.pdf
design-point-nomogram-type1.pdf

Error when importing pynomo

Hello,

When I run the command:
from pynomo import *

The following error arises:
ImportError: cannot import name 'arange' from 'scipy'

How can I solve this issue? Thank you!

nomography.org registration impossible

I don't know if you are affiliated with the discussion website, but maybe you know how to contact them. It is currently impossible to register for an account. It rejects all answers to the "Which graphs is this board about:" registration question.

"Type 5" nomogram not able to be computed.

I'm trying to plot a nomogram for the following projectile motion function: y = x * tan(theta) - 0.5g * x^2 / (4.236^2 * cos(theta)^2) where x and y are the input parameters and theta is the output value of the nomogram. g is a constant 9.81 m/s^2.

I believe this problem to be a Type 5 nomogram.

The program I've written to try and plot this is as follows:

import math
from pynomo.nomographer import *
import sys
import numpy
sys.path.insert(0, ".")

def x_expression(x, theta):
    #  x * tan(theta) - 0.5g * x^2 / (4.236^2 * cos(theta)^2)
    print("iteration")
    print("Type of x")
    print(type(x))
    if type(x) == numpy.ndarray:
        print("Type of x.item(0)")
        print(x.item(0))

        x = x.item(0).real

    print("Type of theta")
    print(type(theta))

    theta_r = math.radians(theta)
    output = x * math.tan(theta_r) - ((9.81 / 2) * math.pow(x, 2)) / \
        (math.pow(4.236, 2) * math.pow(math.cos(theta_r), 2))

    return output


# print(x_expression(1, 15))

# u: y-displacement in meters
# v: x-displacement in meters, theta in degrees
all_in_all_block = {
    'block_type': 'type_5',
    'u_func': lambda y: y,
    # 'v_func': lambda x, theta: math.pow(theta, 2),
    'v_func': lambda x, theta: x_expression(x, theta),
    # 'v_func': lambda x, theta: x * math.tan(math.radians(theta)) - ((9.81 / 2) * math.pow(x, 2)) / (math.pow(4.236, 2) * math.pow(math.cos(math.radians(theta)), 2)),
    'u_values': [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0],
    'v_values': [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0],
    'wd_tick_levels': 2,
    'wd_tick_text_levels': 1,
    'wd_tick_side': 'right',
    'wd_title': 'wd = u-v',
    'u_title': 'u: y-displacement (meters)',
    'v_title': 'v: x-displacement (meters)',
    'wd_title_opposite_tick': True,
    'wd_title_distance_center': 2.5,
    'isopleth_values': [[6.5, 7, 'x']],
}

main_params = {
    # 'filename': 'tutorial1a.eps',
    'filename': 'tutorial1a.pdf',
    'paper_height': 11.0,
    'paper_width': 8.5,
    'block_params': [all_in_all_block],
    'transformations': [('rotate', 0.01), ('scale paper',)],
    'title_str': r'\LARGE Trajectory calculator.',
}

Nomographer(main_params)

However, I must be missing something crucial, as this keeps coming up:

...
Type of theta
<class 'int'>
Traceback (most recent call last):
  File "nomoProjectile.py", line 64, in <module>
    Nomographer(main_params)
  File "/usr/local/lib/python3.6/dist-packages/pynomo/nomographer.py", line 224, in __init__
    isopleths.draw(c)
  File "/usr/local/lib/python3.6/dist-packages/pynomo/isopleth.py", line 147, in draw
    self._solve_()
  File "/usr/local/lib/python3.6/dist-packages/pynomo/isopleth.py", line 159, in _solve_
    isopleth.solve(self.solutions)
  File "/usr/local/lib/python3.6/dist-packages/pynomo/isopleth.py", line 992, in solve
    isopleth_values_single, idx)
  File "/usr/local/lib/python3.6/dist-packages/pynomo/isopleth.py", line 1049, in solve_single
    x_v, y_v, x_v_ini, y_v_ini = self.xy_v_u(isopleth_values[1], isopleth_values[0])
  File "/usr/local/lib/python3.6/dist-packages/pynomo/isopleth.py", line 1132, in xy_v_u
    for value in values_list_complex:
TypeError: 'float' object is not iterable

I'm not sure what's going on here... can anyone help me out?

ex_compound_nomo_2.py broken ?

Thanks for this great software. I just installed it and managed to create a nomogram (Ohm's Law), quite basic but rewarding enough!
Now, need to tackle the determinant section. It's quite steep.
Anyway, I could not generate "ex_compound_nomo_2.py" with python 2.7.12 from the example section.
Traceback (most recent call last): File "ex_compound_nomo_2.py", line 160, in <module> Nomographer(main_params) File "/usr/local/lib/python2.7/dist-packages/pynomo/nomographer.py", line 82, in __init__ height=block_para['height']) File "/usr/local/lib/python2.7/dist-packages/pynomo/nomo_wrapper.py", line 1012, in set_block length_f1_ini = max(self.F1(self.params_F1['u_min']), self.F1(self.params_F1['u_max'])) - \ File "ex_compound_nomo_2.py", line 30, in <lambda> 'function': lambda u: log(u), NameError: global name 'log' is not defined

Walter

invalid syntax circ_scale.py, line 459

$ python setup.py install --user

returns here with python3

byte-compiling build/bdist.linux-x86_64/egg/pynomo/circ_scale.py to circ_scale.cpython-34.pyc
  File "build/bdist.linux-x86_64/egg/pynomo/circ_scale.py", line 459
    print "self.offset_f2 %g" % (self.offset_f2 * 180.0 / 3.1415)
                            ^
SyntaxError: invalid syntax

I guess ( ) are missing.

Issues rotating a scale 90 degrees?

I am trying to make Type 8 scales to illustrate how to use a slide rule to do a calculation, but when I try a rotation transformation for -90 I get errors. +90 works, but -90 makes more sense for how the slide rule looks when used.
sliderule.pdf

Mandatory rotation (missing default or bug?)

In the PDF manual Creating Nomograms with the PyNomo Software: Version 1.1 for PyNomo Release 0.2.2, Ron Doerfler stipulates that:

There are a few transformations to the nomogram that can be included in the main parameters. One is a very tiny rotation—some rotation is mandatory, so we just rotate it an unnoticeable amount.

Effectively, almost all examples include a 0.01 degree rotation. Without this unnoticeable rotation, some elements of the nomograph are not displayed in their expected position.

Users shouldn't be required to systematically apply some trick to make the software behave correctly and/or as expected.

  • If it's a bug then it should be solved.
  • If it's a justified quirk due to some mathematical principle (for instance, an inescapable division by zero) then pynomo is missing a default. A rotation ought to be applied to all nomographs by default : auto_rotate() # True by default.

import from SF

Hi,

thank you for writing pynomo.

As far I understand, you want to move from SF to github.
Still after a long time this page says, it is not ready to use.
You can import the complete project from SF in github.
Then make your updates/changes and it is ready to use.
I am looking forward to a pynomo repository on github.

ModuleNotFoundError: No module named 'nomo_wrapper'

Hi,
I've tried installing pynomo using pip3 as well as git clone + "python3 setup.py install --user", but I can't get past this:

$ python3
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

from pynomo.nomographer import *
Traceback (most recent call last):
File "", line 1, in
File "/home/adam/.local/lib/python3.6/site-packages/PyNomo-0.3.0-py3.6.egg/pynomo/nomographer.py", line 16, in
ModuleNotFoundError: No module named 'nomo_wrapper'

Any idea what I'm doing wrong?

Discrete values

I just discovered this project this weekend and am curious if it might be possible to translate a react app I developed into a one-sheet nomogram. The react app is a calculator that determines a result based off of five inputs, but the problem I haven't figured out is if I can create scales with discrete values. This might mean Type 5 with jagged contour lines, but I'm having trouble getting a Type 2 working either. For example, I have a correspondence table that looks like this:

const fighterLevels = new Map<number, number>([
  [0, 21],
  [1, 20],
  [3, 18],
  [5, 16],
  [7, 14],
  [9, 12],
  [11, 10],
  [13, 8],
  [15, 6],
  [17, 4],
]);

The point is it is not smoothed - while 1 corresponds to 20, 2 should correspond to 20 as well. Then 3 should jump to 18. (For context, this is a combat skills table from old school 1st edition Dungeons & Dragons.) Other tables have wider gaps in places, so there is no true continuous pattern.

When defining the lookup function for 'function': lambda u: lookup(u), I first tried to return discrete values for each integer, but then when running python <script>.py, the process hung and never completed.

When I changed it to return something more along the lines of continuous values,

def lookup(level):
    if level < 1:
        return 21 - level
    elif 1 < level <= 2:
        return 22 - level
    elif 2 < level <= 3:
        return 21 - level
    elif 3 < level <= 4:
        return 22 - level
    elif 4 < level <= 5:
        return 21 - level
    elif 5 < level <= 6:
        return 22 - level
    elif 6 < level <= 7:
        return 21 - level
   [...]

The simple type2 graph I was trying to create didn't really turn out clean (I chopped off the upper section):

image

At any rate, is this possible to use discrete value correspondences? The basic idea is that "level" is an integer input, which corresponds to another discrete value, which in turn will be compared with other discrete values to get more discrete values, until a final discrete value is found. (You can see what I mean by checking out the react app at https://tunesmith.github.io/adnd-combat-tools/calculator - it's basically 5 discrete values that lead to the big integer on the right.)

Apologies if this isn't the right forum, I wasn't sure if this is feature request or just something supported that I don't know how to do.

make_grid broken in python3

The 'make_grid' feature in main_params block seems broken under python3. Inserting 'make_grid':True, at line 117 in ex_BMI.py main_params block causes the following error:

Traceback (most recent call last):
File "ex_BMI.py", line 120, in
Nomographer(main_params)
File "../pynomo/nomographer.py", line 217, in init
self.make_grid(params, c)
File "../pynomo/nomographer.py", line 250, in make_grid
Nomo_Axis(func_f=lambda u: u,
NameError: name 'Nomo_Axis' is not defined

v_title doesn't render on type 5 nomograph under certain conditions

Using ex_type5_nomo_1.py as test code, v_title only renders if the number of elements in v_values is in the range 7 < n < 13.

v_title renders with:

'v_values': [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0] and
'v_values': [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0]

but not with

'v_values': [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] or
'v_values': [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0,13.0]

u_title doesn't have the same limitation.

pynomo.org seems broken

Apologies for opening a github issue for what is actually a website issue, but when I try to visit pynomo.org I get an error page:
image

new install, example files will not run.

So I try to run your own example programs after following the install guide for python 3. however nothing seems to work. All of the depency are installed. The system is running an up to date release of void linux.
pynomofail

Is there something I can do to generate your example files? I would like to follow the tutorial pdf and make some of my own nomographs.

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.