B
    $t^                 @   s   d dl mZ d dlmZ d dlmZ d dlZ	d dl
Z
d dlZd dlZd dlZd dlZd dlZd dlZed e Ze \ZZZe e Ze	dd eD Ze Ze \ZZZe e Z dddZ!dd Z"dS )    )display)widgetsNignorec             C   s   g | ]}t |jqS  )npproductshape).0Ztempsr   r   C/Users/vegardjervell/Documents/6_semester/matmod/matmod11V4/main.py
<listcomp>   s    r   皙?T,    c             C   s   | dkr6||kr&t d|d  |d }tj||d n| dkrnt dtdttdd	d
d tj|tt	t
|d n| dkrt dttjdttdd	d
d tttt nF| dkrt  n4| dkrt  n"| dkrt  n| dkrt  d S )NzC-curvesz>I wont let you put T_min >= T_max, so I'm going to set T_min =
   )T_minT_maxzT-t WeldzCalculating T(q,y,t) in z. points (all combinations of q, y and t) took    s )sep)ylogzX-q WeldzCalculating X(q,y) in z points (all displayed) took zT-t Jominy stickzX-x Jominy stickzT-t ExtrusionzX-h Extrusion)printc_curvesZplot_C_curves_V2num_Tt_weld_valsroundt_Tt_weld_curvesweldingZ
plot_Tt_V3Tt_weld_curves
weld_yvalsTt_weld_timesr   r   	Xq_curvesr   t_Xq_curvesZplot_Xqqvd_line	Xq_y_valsjominy_stickZplot_TtZplot_Xxextruded_profileZplot_Xh)caseqvdr   r   r   r   r   r
   main   s&    "


r(   c                 s   t jdddddddgdd	} t jtjtjtjd
ddt jdddt jdddd
dddt jdddd
ddd t	|  t 
 t jt|  d fdd}| j|dd t	 d S )NzX-q WeldzX-x Jominy stickzX-h ExtrusionzC-curveszT-t WeldzT-t Jominy stickzT-t ExtrusionZCase)optionsdescriptionFz-$\frac{q_0}{vd} \left[\frac{kJ}{mm^2}\right]$)minmaxstepcontinious_updater*   TzLogarithmic y-axis)valuer*   2   i  r   z	$T_{min}$i"  )r+   r,   r-   r.   r*   r/   <   i  z	$T_{max}$)r&   r'   r   r   r   c          	      s   | d } | dkr t  g}nz| dkr8t g}nb| dkrLt g }nN| dkr`t g }n:| dkrtt g }n&| dkrt g }n| dkrt g }   tt |jd	 g W d Q R X d S )
NnewzC-curveszT-t WeldzX-q WeldzT-t Jominy stickzX-x Jominy stickzT-t ExtrusionzX-h Extrusion)widHBoxclear_outputr   VBoxchildren)r&   Zcase_controls)r   r   case_outputoutputr'   r   r   r
   display_case_controlsN   s$    
z"run.<locals>.display_case_controlsr/   )names)r4   DropdownFloatSlidercZqvd_slider_minZqvd_slider_maxZqvd_slider_stepToggleButton	IntSliderr   Outputinteractiver(   observe)r&   r;   r   )r   r   r9   r:   r'   r   r
   run<   s     


rE   )r   Tr   r   )#IPython.displayr   
ipywidgetsr   r4   matplotlib.pyplotpyplotpltnumpyr   r   r   r$   r%   	constantsr?   timewarningsfilterwarningsprocess_timet0Zget_Tt_curvesr   r   r   r   sumr   Zget_Xq_curvesr    r"   r#   r!   r(   rE   r   r   r   r
   <module>   s(   

"